tech.carpentum.sdk.payment.EndpointWithIdDefinition.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of payment-client-v2 Show documentation
Show all versions of payment-client-v2 Show documentation
Carpentum Payment system Java SDK
The newest version!
package tech.carpentum.sdk.payment
/**
* Definition of parametrized endpoint.
*
* Used by individual API classes:
*
* - [IncomingPaymentsApi]
* - [OutgoingPaymentsApi]
*
* See also [EndpointDefinition].
*/
data class EndpointWithIdDefinition(
val method: EndpointDefinition.Method,
val resource: String
) {
init {
require(resource.contains(idPlaceholder)) { "Resource must contain '$idPlaceholder'!" }
}
fun forId(id: String): EndpointDefinition {
return EndpointDefinition(method, resource.replace(idPlaceholder, id))
}
fun anyId(): EndpointDefinition {
return EndpointDefinition(method, resource.replace(idPlaceholder, ".*"))
}
private companion object {
private const val idPlaceholder = "{id}"
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy