diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 51acdaa4..8ea07c9a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.37.0" + ".": "0.38.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 610d8317..da919d93 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7b65f996788617c2d2f2e8e941d366edd1a2844f15eefec555e220b03bbc6d4c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d4f03b16daf0bae33be634c959dafb0e21b0bcb156beb162f8235394dca88e7c.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a380baa..1ba496a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.38.0 (2025-02-27) + +Full Changelog: [v0.37.0...v0.38.0](https://github.com/orbcorp/orb-java/compare/v0.37.0...v0.38.0) + +### Features + +* **api:** api update ([#286](https://github.com/orbcorp/orb-java/issues/286)) ([a0ba171](https://github.com/orbcorp/orb-java/commit/a0ba171d068ac12040aa4081a3985db0e2f0f4e3)) + + +### Chores + +* **client:** use deep identity methods for primitive array types ([#283](https://github.com/orbcorp/orb-java/issues/283)) ([6e2862d](https://github.com/orbcorp/orb-java/commit/6e2862d364872246891f5b1f37a137f27edd3c39)) +* **internal:** add async service tests ([#281](https://github.com/orbcorp/orb-java/issues/281)) ([8171ba6](https://github.com/orbcorp/orb-java/commit/8171ba671b8a5fb9d55477984a765f7235d50c53)) +* **internal:** improve sync service tests ([8171ba6](https://github.com/orbcorp/orb-java/commit/8171ba671b8a5fb9d55477984a765f7235d50c53)) +* **internal:** refactor `ServiceParamsTest` ([#285](https://github.com/orbcorp/orb-java/issues/285)) ([7894edb](https://github.com/orbcorp/orb-java/commit/7894edb4bd1b2a0780d839c23e08861e10aa080e)) + + +### Documentation + +* readme parameter tweaks ([8171ba6](https://github.com/orbcorp/orb-java/commit/8171ba671b8a5fb9d55477984a765f7235d50c53)) + ## 0.37.0 (2025-02-26) Full Changelog: [v0.36.0...v0.37.0](https://github.com/orbcorp/orb-java/compare/v0.36.0...v0.37.0) diff --git a/README.md b/README.md index 9c46e4f3..a3dc61b4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.37.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.38.0) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-java:0.37.0") +implementation("com.withorb.api:orb-java:0.38.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.37.0") com.withorb.api orb-java - 0.37.0 + 0.38.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 6c2f472c..b86d7012 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.37.0" // x-release-please-version + version = "0.38.0" // x-release-please-version } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt index b1dbf27a..9cf3ba5a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt @@ -26,6 +26,42 @@ internal fun , V> SortedMap.toImmutable(): SortedMap value.contentHashCode() - is String -> value - is Boolean -> value - is Long -> value - is Double -> value - else -> value?.hashCode() - }, - ) - } - return hashCode - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this.javaClass != other.javaClass) return false + private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) } - other as MultipartFormValue<*> + override fun hashCode(): Int = hashCode - if (name != other.name || contentType != other.contentType || filename != other.filename) - return false - - return when { - value is ByteArray && other.value is ByteArray -> value contentEquals other.value - else -> value?.equals(other.value) ?: (other.value == null) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } + + return other is MultipartFormValue<*> && + name == other.name && + value contentEquals other.value && + contentType == other.contentType && + filename == other.filename } override fun toString(): String = diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt index 3b4fbf7d..02638f15 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt @@ -12,7 +12,10 @@ import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional -/** Delete top-up by external ID */ +/** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ class CustomerCreditTopUpDeleteByExternalIdParams private constructor( private val externalCustomerId: String, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt index 12a73212..bfac4066 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt @@ -12,7 +12,10 @@ import com.withorb.api.core.toImmutable import java.util.Objects import java.util.Optional -/** Delete top-up */ +/** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ class CustomerCreditTopUpDeleteParams private constructor( private val customerId: String, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt index 11be6ea4..9515f0ff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt @@ -5766,6 +5766,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5776,6 +5779,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5812,6 +5818,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5841,6 +5850,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5875,6 +5891,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5906,6 +5925,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5922,9 +5949,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5943,11 +5972,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5957,10 +5988,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6046,6 +6079,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6546,6 +6588,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6572,11 +6653,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6722,17 +6805,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt index 478ba10e..ea64fb83 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt @@ -5754,6 +5754,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5764,6 +5767,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5800,6 +5806,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5829,6 +5838,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5863,6 +5879,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5894,6 +5913,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5910,9 +5937,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5931,11 +5960,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5945,10 +5976,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6034,6 +6067,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6534,6 +6576,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6560,11 +6641,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6710,17 +6793,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt index 677e17bf..37bc79ee 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt @@ -5754,6 +5754,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5764,6 +5767,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5800,6 +5806,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5829,6 +5838,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5863,6 +5879,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5894,6 +5913,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5910,9 +5937,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5931,11 +5960,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5945,10 +5976,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6034,6 +6067,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6534,6 +6576,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6560,11 +6641,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6710,17 +6793,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index 47ea344b..3dcd1992 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -710,6 +710,9 @@ private constructor( @JsonProperty("external_price_id") @ExcludeMissing private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -726,6 +729,9 @@ private constructor( @JsonProperty("price_id") @ExcludeMissing private val priceId: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -754,6 +760,13 @@ private constructor( fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** A list of fixed fee quantity transitions to initialize on the price interval. */ fun fixedFeeQuantityTransitions(): Optional> = Optional.ofNullable( @@ -780,6 +793,16 @@ private constructor( /** The id of the price to add to the subscription. */ fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with its + * attached customer's customer_id. When usage_customer_ids is provided, the subscription + * includes usage events from the specified customers only. Provided usage_customer_ids must + * be either the customer for this subscription itself, or any of that customer's children. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + /** * The start date of the price interval. This is the date that the price will start billing * on the subscription. @@ -809,6 +832,13 @@ private constructor( @ExcludeMissing fun _externalPriceId(): JsonField = externalPriceId + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** A list of fixed fee quantity transitions to initialize on the price interval. */ @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing @@ -837,6 +867,17 @@ private constructor( /** The id of the price to add to the subscription. */ @JsonProperty("price_id") @ExcludeMissing fun _priceId(): JsonField = priceId + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with its + * attached customer's customer_id. When usage_customer_ids is provided, the subscription + * includes usage events from the specified customers only. Provided usage_customer_ids must + * be either the customer for this subscription itself, or any of that customer's children. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -853,11 +894,13 @@ private constructor( discounts().ifPresent { it.forEach { it.validate() } } endDate().ifPresent { it.validate() } externalPriceId() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } maximumAmount() minimumAmount() price().ifPresent { it.validate() } priceId() + usageCustomerIds() validated = true } @@ -876,6 +919,7 @@ private constructor( private var discounts: JsonField>? = null private var endDate: JsonField = JsonMissing.of() private var externalPriceId: JsonField = JsonMissing.of() + private var filter: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField>? = null @@ -883,6 +927,7 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var price: JsonField = JsonMissing.of() private var priceId: JsonField = JsonMissing.of() + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -892,12 +937,14 @@ private constructor( discounts = add.discounts.map { it.toMutableList() } endDate = add.endDate externalPriceId = add.externalPriceId + filter = add.filter fixedFeeQuantityTransitions = add.fixedFeeQuantityTransitions.map { it.toMutableList() } maximumAmount = add.maximumAmount minimumAmount = add.minimumAmount price = add.price priceId = add.priceId + usageCustomerIds = add.usageCustomerIds.map { it.toMutableList() } additionalProperties = add.additionalProperties.toMutableMap() } @@ -1066,6 +1113,27 @@ private constructor( this.externalPriceId = externalPriceId } + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** A list of fixed fee quantity transitions to initialize on the price interval. */ fun fixedFeeQuantityTransitions( fixedFeeQuantityTransitions: List? @@ -1324,6 +1392,61 @@ private constructor( /** The id of the price to add to the subscription. */ fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1350,11 +1473,13 @@ private constructor( (discounts ?: JsonMissing.of()).map { it.toImmutable() }, endDate, externalPriceId, + filter, (fixedFeeQuantityTransitions ?: JsonMissing.of()).map { it.toImmutable() }, maximumAmount, minimumAmount, price, priceId, + (usageCustomerIds ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -48415,17 +48540,17 @@ private constructor( return true } - return /* spotless:off */ other is Add && startDate == other.startDate && allocationPrice == other.allocationPrice && discounts == other.discounts && endDate == other.endDate && externalPriceId == other.externalPriceId && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Add && startDate == other.startDate && allocationPrice == other.allocationPrice && discounts == other.discounts && endDate == other.endDate && externalPriceId == other.externalPriceId && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && price == other.price && priceId == other.priceId && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, allocationPrice, discounts, endDate, externalPriceId, fixedFeeQuantityTransitions, maximumAmount, minimumAmount, price, priceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(startDate, allocationPrice, discounts, endDate, externalPriceId, filter, fixedFeeQuantityTransitions, maximumAmount, minimumAmount, price, priceId, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Add{startDate=$startDate, allocationPrice=$allocationPrice, discounts=$discounts, endDate=$endDate, externalPriceId=$externalPriceId, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" + "Add{startDate=$startDate, allocationPrice=$allocationPrice, discounts=$discounts, endDate=$endDate, externalPriceId=$externalPriceId, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, price=$price, priceId=$priceId, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -50744,6 +50869,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -50751,6 +50879,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -50772,6 +50903,13 @@ private constructor( */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * A list of fixed fee quantity transitions to use for this price interval. Note that this * list will overwrite all existing fixed fee quantity transitions on the price interval. @@ -50788,6 +50926,16 @@ private constructor( fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with its + * attached customer's customer_id. When usage_customer_ids is provided, the subscription + * includes usage events from the specified customers only. Provided usage_customer_ids must + * be either the customer for this subscription itself, or any of that customer's children. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + /** The id of the price interval to edit. */ @JsonProperty("price_interval_id") @ExcludeMissing @@ -50808,6 +50956,13 @@ private constructor( */ @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * A list of fixed fee quantity transitions to use for this price interval. Note that this * list will overwrite all existing fixed fee quantity transitions on the price interval. @@ -50825,6 +50980,17 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with its + * attached customer's customer_id. When usage_customer_ids is provided, the subscription + * includes usage events from the specified customers only. Provided usage_customer_ids must + * be either the customer for this subscription itself, or any of that customer's children. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -50839,8 +51005,10 @@ private constructor( priceIntervalId() billingCycleDay() endDate().ifPresent { it.validate() } + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } startDate().ifPresent { it.validate() } + usageCustomerIds() validated = true } @@ -50857,10 +51025,12 @@ private constructor( private var priceIntervalId: JsonField? = null private var billingCycleDay: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var filter: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField>? = null private var startDate: JsonField = JsonMissing.of() + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -50868,9 +51038,11 @@ private constructor( priceIntervalId = edit.priceIntervalId billingCycleDay = edit.billingCycleDay endDate = edit.endDate + filter = edit.filter fixedFeeQuantityTransitions = edit.fixedFeeQuantityTransitions.map { it.toMutableList() } startDate = edit.startDate + usageCustomerIds = edit.usageCustomerIds.map { it.toMutableList() } additionalProperties = edit.additionalProperties.toMutableMap() } @@ -50947,6 +51119,27 @@ private constructor( fun endDate(billingCycleRelative: BillingCycleRelativeDate) = endDate(EndDate.ofBillingCycleRelative(billingCycleRelative)) + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean [computed property](/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * A list of fixed fee quantity transitions to use for this price interval. Note that * this list will overwrite all existing fixed fee quantity transitions on the price @@ -51022,6 +51215,61 @@ private constructor( fun startDate(billingCycleRelative: BillingCycleRelativeDate) = startDate(StartDate.ofBillingCycleRelative(billingCycleRelative)) + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * subscription. By default, a subscription only considers usage events associated with + * its attached customer's customer_id. When usage_customer_ids is provided, the + * subscription includes usage events from the specified customers only. Provided + * usage_customer_ids must be either the customer for this subscription itself, or any + * of that customer's children. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -51046,8 +51294,10 @@ private constructor( checkRequired("priceIntervalId", priceIntervalId), billingCycleDay, endDate, + filter, (fixedFeeQuantityTransitions ?: JsonMissing.of()).map { it.toImmutable() }, startDate, + (usageCustomerIds ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -51474,17 +51724,17 @@ private constructor( return true } - return /* spotless:off */ other is Edit && priceIntervalId == other.priceIntervalId && billingCycleDay == other.billingCycleDay && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Edit && priceIntervalId == other.priceIntervalId && billingCycleDay == other.billingCycleDay && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceIntervalId, billingCycleDay, endDate, fixedFeeQuantityTransitions, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(priceIntervalId, billingCycleDay, endDate, filter, fixedFeeQuantityTransitions, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Edit{priceIntervalId=$priceIntervalId, billingCycleDay=$billingCycleDay, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, startDate=$startDate, additionalProperties=$additionalProperties}" + "Edit{priceIntervalId=$priceIntervalId, billingCycleDay=$billingCycleDay, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt index d8427e44..836dbef2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt @@ -5763,6 +5763,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5773,6 +5776,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5809,6 +5815,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5838,6 +5847,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5872,6 +5888,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5903,6 +5922,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5919,9 +5946,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5940,11 +5969,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5954,10 +5985,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6043,6 +6076,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6543,6 +6585,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6569,11 +6650,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6719,17 +6802,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt index b0131e78..39c24e8d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt @@ -5764,6 +5764,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5774,6 +5777,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5810,6 +5816,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5839,6 +5848,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5873,6 +5889,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5904,6 +5923,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5920,9 +5947,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5941,11 +5970,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5955,10 +5986,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6044,6 +6077,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6544,6 +6586,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6570,11 +6651,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6720,17 +6803,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt index 6953bd75..186ec4c4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt @@ -5761,6 +5761,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5771,6 +5774,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5807,6 +5813,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5836,6 +5845,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5870,6 +5886,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5901,6 +5920,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5917,9 +5944,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5938,11 +5967,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5952,10 +5983,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6041,6 +6074,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6541,6 +6583,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6567,11 +6648,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6717,17 +6800,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt index 49068a7e..c0a1ec5c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt @@ -5770,6 +5770,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5780,6 +5783,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5816,6 +5822,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5845,6 +5854,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5879,6 +5895,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5910,6 +5929,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5926,9 +5953,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5947,11 +5976,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5961,10 +5992,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6050,6 +6083,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6550,6 +6592,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6576,11 +6657,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6726,17 +6809,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt index a586a244..8bf84b4c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt @@ -5778,6 +5778,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5788,6 +5791,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5824,6 +5830,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5853,6 +5862,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5887,6 +5903,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5918,6 +5937,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5934,9 +5961,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5955,11 +5984,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5969,10 +6000,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6058,6 +6091,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6558,6 +6600,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6584,11 +6665,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6734,17 +6817,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt index e9cd0d1a..19852f26 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt @@ -5774,6 +5774,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5784,6 +5787,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5820,6 +5826,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5849,6 +5858,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5883,6 +5899,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5914,6 +5933,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5930,9 +5957,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5951,11 +5980,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5965,10 +5996,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6054,6 +6087,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6554,6 +6596,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6580,11 +6661,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6730,17 +6813,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt index d7b65822..c94cbe3f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt @@ -5770,6 +5770,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5780,6 +5783,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5816,6 +5822,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5845,6 +5854,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5879,6 +5895,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5910,6 +5929,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5926,9 +5953,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5947,11 +5976,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5961,10 +5992,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6050,6 +6083,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6550,6 +6592,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6576,11 +6657,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6726,17 +6809,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt index 54b418b7..63cff8c7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt @@ -5761,6 +5761,9 @@ private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("filter") + @ExcludeMissing + private val filter: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = @@ -5771,6 +5774,9 @@ private constructor( @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_customer_ids") + @ExcludeMissing + private val usageCustomerIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5807,6 +5813,9 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** An additional filter to apply to usage queries. */ + fun filter(): Optional = Optional.ofNullable(filter.getNullable("filter")) + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5836,6 +5845,13 @@ private constructor( */ fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + fun usageCustomerIds(): Optional> = + Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids")) + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** The day of the month that Orb bills for this price */ @@ -5870,6 +5886,9 @@ private constructor( @ExcludeMissing fun _endDate(): JsonField = endDate + /** An additional filter to apply to usage queries. */ + @JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField = filter + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -5901,6 +5920,14 @@ private constructor( @ExcludeMissing fun _startDate(): JsonField = startDate + /** + * A list of customer IDs whose usage events will be aggregated and billed under this price + * interval. + */ + @JsonProperty("usage_customer_ids") + @ExcludeMissing + fun _usageCustomerIds(): JsonField> = usageCustomerIds + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5917,9 +5944,11 @@ private constructor( currentBillingPeriodEndDate() currentBillingPeriodStartDate() endDate() + filter() fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } } price().validate() startDate() + usageCustomerIds() validated = true } @@ -5938,11 +5967,13 @@ private constructor( private var currentBillingPeriodEndDate: JsonField? = null private var currentBillingPeriodStartDate: JsonField? = null private var endDate: JsonField? = null + private var filter: JsonField? = null private var fixedFeeQuantityTransitions: JsonField>? = null private var price: JsonField? = null private var startDate: JsonField? = null + private var usageCustomerIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5952,10 +5983,12 @@ private constructor( currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate endDate = priceInterval.endDate + filter = priceInterval.filter fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() } price = priceInterval.price startDate = priceInterval.startDate + usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() } additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -6041,6 +6074,15 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An additional filter to apply to usage queries. */ + fun filter(filter: String?) = filter(JsonField.ofNullable(filter)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** An additional filter to apply to usage queries. */ + fun filter(filter: JsonField) = apply { this.filter = filter } + /** * The fixed fee quantity transitions for this price interval. This is only relevant for * fixed fees. @@ -6541,6 +6583,45 @@ private constructor( this.startDate = startDate } + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: List?) = + usageCustomerIds(JsonField.ofNullable(usageCustomerIds)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: Optional>) = + usageCustomerIds(usageCustomerIds.orElse(null)) + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun usageCustomerIds(usageCustomerIds: JsonField>) = apply { + this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() } + } + + /** + * A list of customer IDs whose usage events will be aggregated and billed under this + * price interval. + */ + fun addUsageCustomerId(usageCustomerId: String) = apply { + usageCustomerIds = + (usageCustomerIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(usageCustomerId) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6567,11 +6648,13 @@ private constructor( checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate), checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate), checkRequired("endDate", endDate), + checkRequired("filter", filter), checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map { it.toImmutable() }, checkRequired("price", price), checkRequired("startDate", startDate), + checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -6717,17 +6800,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}" } @NoAutoDetect diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt index d3ba0a7b..0595a1de 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsync.kt @@ -40,7 +40,10 @@ interface TopUpServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Delete top-up */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ @JvmOverloads fun delete( params: CustomerCreditTopUpDeleteParams, @@ -61,7 +64,10 @@ interface TopUpServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Delete top-up by external ID */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ @JvmOverloads fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt index 2356bff1..d4552def 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncImpl.kt @@ -98,7 +98,10 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) - /** Delete top-up */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ override fun delete( params: CustomerCreditTopUpDeleteParams, requestOptions: RequestOptions, @@ -166,7 +169,10 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie private val deleteByExternalIdHandler: Handler = emptyHandler().withErrorHandler(errorHandler) - /** Delete top-up by external ID */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ override fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, requestOptions: RequestOptions, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt index 2ad8dc55..efdb4d59 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpService.kt @@ -39,7 +39,10 @@ interface TopUpService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpListPage - /** Delete top-up */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ @JvmOverloads fun delete( params: CustomerCreditTopUpDeleteParams, @@ -60,7 +63,10 @@ interface TopUpService { requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpCreateByExternalIdResponse - /** Delete top-up by external ID */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ @JvmOverloads fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt index 0ca6a7bd..275ae5f1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceImpl.kt @@ -91,7 +91,10 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) - /** Delete top-up */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ override fun delete(params: CustomerCreditTopUpDeleteParams, requestOptions: RequestOptions) { val request = HttpRequest.builder() @@ -152,7 +155,10 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt private val deleteByExternalIdHandler: Handler = emptyHandler().withErrorHandler(errorHandler) - /** Delete top-up by external ID */ + /** + * This deactivates the top-up and voids any invoices associated with pending credit blocks + * purchased through the top-up. + */ override fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, requestOptions: RequestOptions, diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/UtilsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/UtilsTest.kt new file mode 100644 index 00000000..b1b67ea6 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/UtilsTest.kt @@ -0,0 +1,33 @@ +package com.withorb.api.core + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class UtilsTest { + @Test + fun contentDeepEquals() { + assertThat(42 contentEquals 42).isTrue() + assertThat(42 contentEquals "Hello World!").isFalse() + assertThat(byteArrayOf(1, 2, 3) contentEquals byteArrayOf(1, 2, 3)).isTrue() + assertThat(byteArrayOf(1, 2, 3) contentEquals byteArrayOf(1, 2, 4)).isFalse() + assertThat( + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) contentEquals + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) + ) + .isTrue() + assertThat( + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) contentEquals + arrayOf(byteArrayOf(1), byteArrayOf(2, 3)) + ) + .isFalse() + } + + @Test + fun contentToString() { + assertThat((42).contentToString()).isEqualTo("42") + assertThat("Hello World!".contentToString()).isEqualTo("Hello World!") + assertThat(byteArrayOf(1, 2, 3).contentToString()).isEqualTo("[1, 2, 3]") + assertThat(arrayOf(byteArrayOf(1, 2), byteArrayOf(3)).contentToString()) + .isEqualTo("[[1, 2], [3]]") + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt index d72b4b63..0472d181 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelResponseTest.kt @@ -392,6 +392,7 @@ class SubscriptionCancelResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionCancelResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -483,6 +484,7 @@ class SubscriptionCancelResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -889,6 +891,7 @@ class SubscriptionCancelResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionCancelResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -978,6 +981,7 @@ class SubscriptionCancelResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionCancelResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt index a2b0dc76..c78dc3ab 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCreateResponseTest.kt @@ -392,6 +392,7 @@ class SubscriptionCreateResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionCreateResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -483,6 +484,7 @@ class SubscriptionCreateResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -889,6 +891,7 @@ class SubscriptionCreateResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionCreateResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -978,6 +981,7 @@ class SubscriptionCreateResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionCreateResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt index cad51d62..17ef7804 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt @@ -31,6 +31,7 @@ class SubscriptionPriceIntervalsParamsTest { .addAmountDiscountCreationParamsDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Add.FixedFeeQuantityTransition.builder() .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -105,6 +106,7 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .priceId("h74gfhdjvn7ujokd") + .addUsageCustomerId("string") .build() ) .addAddAdjustment( @@ -135,6 +137,7 @@ class SubscriptionPriceIntervalsParamsTest { .priceIntervalId("sdfs6wdjvn7ujokd") .billingCycleDay(0L) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition.builder() .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -142,6 +145,7 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .addEditAdjustment( @@ -176,6 +180,7 @@ class SubscriptionPriceIntervalsParamsTest { .addAmountDiscountCreationParamsDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Add.FixedFeeQuantityTransition .builder() @@ -252,6 +257,7 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .priceId("h74gfhdjvn7ujokd") + .addUsageCustomerId("string") .build() ) .addAddAdjustment( @@ -282,6 +288,7 @@ class SubscriptionPriceIntervalsParamsTest { .priceIntervalId("sdfs6wdjvn7ujokd") .billingCycleDay(0L) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition .builder() @@ -290,6 +297,7 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .addEditAdjustment( @@ -323,6 +331,7 @@ class SubscriptionPriceIntervalsParamsTest { .addAmountDiscountCreationParamsDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Add.FixedFeeQuantityTransition .builder() @@ -399,6 +408,7 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .priceId("h74gfhdjvn7ujokd") + .addUsageCustomerId("string") .build() ) ) @@ -435,6 +445,7 @@ class SubscriptionPriceIntervalsParamsTest { .priceIntervalId("sdfs6wdjvn7ujokd") .billingCycleDay(0L) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition .builder() @@ -443,6 +454,7 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt index 567ee880..efa99c31 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponseTest.kt @@ -394,6 +394,7 @@ class SubscriptionPriceIntervalsResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsResponse.PriceInterval .FixedFeeQuantityTransition @@ -486,6 +487,7 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -896,6 +898,7 @@ class SubscriptionPriceIntervalsResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -985,6 +988,7 @@ class SubscriptionPriceIntervalsResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionPriceIntervalsResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt index 43b747c1..51f81281 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponseTest.kt @@ -395,6 +395,7 @@ class SubscriptionSchedulePlanChangeResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionSchedulePlanChangeResponse.PriceInterval .FixedFeeQuantityTransition @@ -487,6 +488,7 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -897,6 +899,7 @@ class SubscriptionSchedulePlanChangeResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionSchedulePlanChangeResponse.PriceInterval .FixedFeeQuantityTransition @@ -987,6 +990,7 @@ class SubscriptionSchedulePlanChangeResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionSchedulePlanChangeResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt index ee7ce10d..c09503dc 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt @@ -390,6 +390,7 @@ class SubscriptionTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( Subscription.PriceInterval.FixedFeeQuantityTransition.builder() .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -480,6 +481,7 @@ class SubscriptionTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -883,6 +885,7 @@ class SubscriptionTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( Subscription.PriceInterval.FixedFeeQuantityTransition.builder() .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -971,6 +974,7 @@ class SubscriptionTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscription.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt index 7a4ce183..d1b4a26b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponseTest.kt @@ -393,6 +393,7 @@ class SubscriptionTriggerPhaseResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionTriggerPhaseResponse.PriceInterval .FixedFeeQuantityTransition @@ -485,6 +486,7 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -894,6 +896,7 @@ class SubscriptionTriggerPhaseResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionTriggerPhaseResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -983,6 +986,7 @@ class SubscriptionTriggerPhaseResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionTriggerPhaseResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt index ee2d0abe..5489206a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponseTest.kt @@ -397,6 +397,7 @@ class SubscriptionUnscheduleCancellationResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUnscheduleCancellationResponse.PriceInterval .FixedFeeQuantityTransition @@ -489,6 +490,7 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -901,6 +903,7 @@ class SubscriptionUnscheduleCancellationResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUnscheduleCancellationResponse.PriceInterval .FixedFeeQuantityTransition @@ -991,6 +994,7 @@ class SubscriptionUnscheduleCancellationResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionUnscheduleCancellationResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt index a52cedae..d35cf6ec 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest.kt @@ -402,6 +402,7 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.PriceInterval .FixedFeeQuantityTransition @@ -494,6 +495,7 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -922,6 +924,7 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.PriceInterval .FixedFeeQuantityTransition @@ -1012,6 +1015,7 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt index ff7dd50a..36304519 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponseTest.kt @@ -400,6 +400,7 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUnschedulePendingPlanChangesResponse.PriceInterval .FixedFeeQuantityTransition @@ -492,6 +493,7 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -909,6 +911,7 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUnschedulePendingPlanChangesResponse.PriceInterval .FixedFeeQuantityTransition @@ -999,6 +1002,7 @@ class SubscriptionUnschedulePendingPlanChangesResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionUnschedulePendingPlanChangesResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt index 087d07ca..3ddd5ffa 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponseTest.kt @@ -397,6 +397,7 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUpdateFixedFeeQuantityResponse.PriceInterval .FixedFeeQuantityTransition @@ -489,6 +490,7 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -901,6 +903,7 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUpdateFixedFeeQuantityResponse.PriceInterval .FixedFeeQuantityTransition @@ -991,6 +994,7 @@ class SubscriptionUpdateFixedFeeQuantityResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionUpdateFixedFeeQuantityResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt index 8541e40c..78283d4a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponseTest.kt @@ -393,6 +393,7 @@ class SubscriptionUpdateTrialResponseTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUpdateTrialResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -484,6 +485,7 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -893,6 +895,7 @@ class SubscriptionUpdateTrialResponseTest { .currentBillingPeriodEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currentBillingPeriodStartDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( SubscriptionUpdateTrialResponse.PriceInterval.FixedFeeQuantityTransition .builder() @@ -982,6 +985,7 @@ class SubscriptionUpdateTrialResponseTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) assertThat(subscriptionUpdateTrialResponse.redeemedCoupon()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt index 4bb4d048..e628922b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionsTest.kt @@ -418,6 +418,7 @@ class SubscriptionsTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( Subscription.PriceInterval.FixedFeeQuantityTransition.builder() .effectiveDate( @@ -526,6 +527,7 @@ class SubscriptionsTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( @@ -940,6 +942,7 @@ class SubscriptionsTest { OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("filter") .addFixedFeeQuantityTransition( Subscription.PriceInterval.FixedFeeQuantityTransition.builder() .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1036,6 +1039,7 @@ class SubscriptionsTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .redeemedCoupon( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt index 64d552e7..3666dfb2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/ServiceParamsTest.kt @@ -2,7 +2,6 @@ package com.withorb.api.services -import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.equalTo import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath @@ -16,17 +15,12 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.withorb.api.client.OrbClient import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue -import com.withorb.api.core.jsonMapper -import com.withorb.api.models.Customer import com.withorb.api.models.CustomerCreateParams -import java.time.OffsetDateTime import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @WireMockTest -class ServiceParamsTest { - - private val JSON_MAPPER: JsonMapper = jsonMapper() +internal class ServiceParamsTest { private lateinit var client: OrbClient @@ -34,27 +28,17 @@ class ServiceParamsTest { fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { client = OrbOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .webhookSecret("My Webhook Secret") - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) .build() } @Test - fun customersCreateWithAdditionalParams() { - val additionalHeaders = mutableMapOf>() - - additionalHeaders.put("x-test-header", listOf("abc1234")) - - val additionalQueryParams = mutableMapOf>() - - additionalQueryParams.put("test_query_param", listOf("def567")) + fun create() { + val customerService = client.customers() + stubFor(post(anyUrl()).willReturn(ok("{}"))) - val additionalBodyProperties = mutableMapOf() - - additionalBodyProperties.put("testBodyProperty", JsonValue.from("ghi890")) - - val params = + customerService.create( CustomerCreateParams.builder() .email("dev@stainlessapi.com") .name("x") @@ -130,106 +114,17 @@ class ServiceParamsTest { .build() ) .timezone("timezone") - .additionalHeaders(additionalHeaders) - .additionalBodyProperties(additionalBodyProperties) - .additionalQueryParams(additionalQueryParams) + .putAdditionalHeader("Secret-Header", "42") + .putAdditionalQueryParam("secret_query_param", "42") + .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) .build() - - val apiResponse = - Customer.builder() - .id("id") - .addAdditionalEmail("string") - .autoCollection(true) - .balance("balance") - .billingAddress( - Customer.BillingAddress.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .postalCode("postal_code") - .state("state") - .build() - ) - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") - .email("email") - .emailDelivery(true) - .exemptFromAutomatedTax(true) - .externalCustomerId("external_customer_id") - .hierarchy( - Customer.Hierarchy.builder() - .addChild( - Customer.Hierarchy.Child.builder() - .id("id") - .externalCustomerId("external_customer_id") - .build() - ) - .parent( - Customer.Hierarchy.Parent.builder() - .id("id") - .externalCustomerId("external_customer_id") - .build() - ) - .build() - ) - .metadata( - Customer.Metadata.builder() - .putAdditionalProperty("foo", JsonValue.from("string")) - .build() - ) - .name("name") - .paymentProvider(Customer.PaymentProvider.QUICKBOOKS) - .paymentProviderId("payment_provider_id") - .portalUrl("portal_url") - .shippingAddress( - Customer.ShippingAddress.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .postalCode("postal_code") - .state("state") - .build() - ) - .taxId( - Customer.TaxId.builder() - .country(Customer.TaxId.Country.AD) - .type(Customer.TaxId.Type.AD_NRT) - .value("value") - .build() - ) - .timezone("timezone") - .accountingSyncConfiguration( - Customer.AccountingSyncConfiguration.builder() - .addAccountingProvider( - Customer.AccountingSyncConfiguration.AccountingProvider.builder() - .externalProviderId("external_provider_id") - .providerType( - Customer.AccountingSyncConfiguration.AccountingProvider - .ProviderType - .QUICKBOOKS - ) - .build() - ) - .excluded(true) - .build() - ) - .reportingConfiguration( - Customer.ReportingConfiguration.builder().exempt(true).build() - ) - .build() - - stubFor( - post(anyUrl()) - .withHeader("x-test-header", equalTo("abc1234")) - .withQueryParam("test_query_param", equalTo("def567")) - .withRequestBody(matchingJsonPath("$.testBodyProperty", equalTo("ghi890"))) - .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) ) - client.customers().create(params) - - verify(postRequestedFor(anyUrl())) + verify( + postRequestedFor(anyUrl()) + .withHeader("Secret-Header", equalTo("42")) + .withQueryParam("secret_query_param", equalTo("42")) + .withRequestBody(matchingJsonPath("$.secretProperty", equalTo("42"))) + ) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt new file mode 100644 index 00000000..744e38e4 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt @@ -0,0 +1,190 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.AlertCreateForCustomerParams +import com.withorb.api.models.AlertCreateForExternalCustomerParams +import com.withorb.api.models.AlertCreateForSubscriptionParams +import com.withorb.api.models.AlertDisableParams +import com.withorb.api.models.AlertEnableParams +import com.withorb.api.models.AlertRetrieveParams +import com.withorb.api.models.AlertUpdateParams +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AlertServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.retrieve(AlertRetrieveParams.builder().alertId("alert_id").build()) + + val alert = alertFuture.get() + alert.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.update( + AlertUpdateParams.builder() + .alertConfigurationId("alert_configuration_id") + .addThreshold(AlertUpdateParams.Threshold.builder().value(0.0).build()) + .build() + ) + + val alert = alertFuture.get() + alert.validate() + } + + @Disabled("plan_version=0 breaks Prism") + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val pageFuture = alertServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun createForCustomer() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.createForCustomer( + AlertCreateForCustomerParams.builder() + .customerId("customer_id") + .currency("currency") + .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .addThreshold( + AlertCreateForCustomerParams.Threshold.builder().value(0.0).build() + ) + .build() + ) + + val alert = alertFuture.get() + alert.validate() + } + + @Test + fun createForExternalCustomer() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.createForExternalCustomer( + AlertCreateForExternalCustomerParams.builder() + .externalCustomerId("external_customer_id") + .currency("currency") + .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .addThreshold( + AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build() + ) + .build() + ) + + val alert = alertFuture.get() + alert.validate() + } + + @Test + fun createForSubscription() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.createForSubscription( + AlertCreateForSubscriptionParams.builder() + .subscriptionId("subscription_id") + .addThreshold( + AlertCreateForSubscriptionParams.Threshold.builder().value(0.0).build() + ) + .type(AlertCreateForSubscriptionParams.Type.USAGE_EXCEEDED) + .metricId("metric_id") + .build() + ) + + val alert = alertFuture.get() + alert.validate() + } + + @Test + fun disable() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.disable( + AlertDisableParams.builder() + .alertConfigurationId("alert_configuration_id") + .subscriptionId("subscription_id") + .build() + ) + + val alert = alertFuture.get() + alert.validate() + } + + @Test + fun enable() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val alertServiceAsync = client.alerts() + + val alertFuture = + alertServiceAsync.enable( + AlertEnableParams.builder() + .alertConfigurationId("alert_configuration_id") + .subscriptionId("subscription_id") + .build() + ) + + val alert = alertFuture.get() + alert.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt new file mode 100644 index 00000000..7cab25ab --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CouponServiceAsyncTest.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CouponArchiveParams +import com.withorb.api.models.CouponCreateParams +import com.withorb.api.models.CouponFetchParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CouponServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val couponServiceAsync = client.coupons() + + val couponFuture = + couponServiceAsync.create( + CouponCreateParams.builder() + .newCouponPercentageDiscount(0.0) + .redemptionCode("HALFOFF") + .durationInMonths(12L) + .maxRedemptions(1L) + .build() + ) + + val coupon = couponFuture.get() + coupon.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val couponServiceAsync = client.coupons() + + val pageFuture = couponServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun archive() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val couponServiceAsync = client.coupons() + + val couponFuture = + couponServiceAsync.archive(CouponArchiveParams.builder().couponId("coupon_id").build()) + + val coupon = couponFuture.get() + coupon.validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val couponServiceAsync = client.coupons() + + val couponFuture = + couponServiceAsync.fetch(CouponFetchParams.builder().couponId("coupon_id").build()) + + val coupon = couponFuture.get() + coupon.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt new file mode 100644 index 00000000..fa50a947 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CreditNoteCreateParams +import com.withorb.api.models.CreditNoteFetchParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CreditNoteServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val creditNoteServiceAsync = client.creditNotes() + + val creditNoteFuture = + creditNoteServiceAsync.create( + CreditNoteCreateParams.builder() + .addLineItem( + CreditNoteCreateParams.LineItem.builder() + .amount("amount") + .invoiceLineItemId("4khy3nwzktxv7") + .build() + ) + .memo("An optional memo for my credit note.") + .reason(CreditNoteCreateParams.Reason.DUPLICATE) + .build() + ) + + val creditNote = creditNoteFuture.get() + creditNote.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val creditNoteServiceAsync = client.creditNotes() + + val pageFuture = creditNoteServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val creditNoteServiceAsync = client.creditNotes() + + val creditNoteFuture = + creditNoteServiceAsync.fetch( + CreditNoteFetchParams.builder().creditNoteId("credit_note_id").build() + ) + + val creditNote = creditNoteFuture.get() + creditNote.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt new file mode 100644 index 00000000..e48ab6b8 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt @@ -0,0 +1,413 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.CustomerCreateParams +import com.withorb.api.models.CustomerDeleteParams +import com.withorb.api.models.CustomerFetchByExternalIdParams +import com.withorb.api.models.CustomerFetchParams +import com.withorb.api.models.CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams +import com.withorb.api.models.CustomerSyncPaymentMethodsFromGatewayParams +import com.withorb.api.models.CustomerUpdateByExternalIdParams +import com.withorb.api.models.CustomerUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CustomerServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val customerFuture = + customerServiceAsync.create( + CustomerCreateParams.builder() + .email("dev@stainlessapi.com") + .name("x") + .accountingSyncConfiguration( + CustomerCreateParams.AccountingSyncConfiguration.builder() + .addAccountingProvider( + CustomerCreateParams.AccountingSyncConfiguration.AccountingProvider + .builder() + .externalProviderId("external_provider_id") + .providerType("provider_type") + .build() + ) + .excluded(true) + .build() + ) + .addAdditionalEmail("string") + .autoCollection(true) + .billingAddress( + CustomerCreateParams.BillingAddress.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .postalCode("postal_code") + .state("state") + .build() + ) + .currency("currency") + .emailDelivery(true) + .externalCustomerId("external_customer_id") + .hierarchy( + CustomerCreateParams.Hierarchy.builder() + .addChildCustomerId("string") + .parentCustomerId("parent_customer_id") + .build() + ) + .metadata( + CustomerCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .paymentProvider(CustomerCreateParams.PaymentProvider.QUICKBOOKS) + .paymentProviderId("payment_provider_id") + .reportingConfiguration( + CustomerCreateParams.ReportingConfiguration.builder().exempt(true).build() + ) + .shippingAddress( + CustomerCreateParams.ShippingAddress.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .postalCode("postal_code") + .state("state") + .build() + ) + .taxConfiguration( + CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + .taxExempt(true) + .taxProvider( + CustomerCreateParams.TaxConfiguration.NewAvalaraTaxConfiguration + .TaxProvider + .AVALARA + ) + .taxExemptionCode("tax_exemption_code") + .build() + ) + .taxId( + CustomerCreateParams.TaxId.builder() + .country(CustomerCreateParams.TaxId.Country.AD) + .type(CustomerCreateParams.TaxId.Type.AD_NRT) + .value("value") + .build() + ) + .timezone("timezone") + .build() + ) + + val customer = customerFuture.get() + customer.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val customerFuture = + customerServiceAsync.update( + CustomerUpdateParams.builder() + .customerId("customer_id") + .accountingSyncConfiguration( + CustomerUpdateParams.AccountingSyncConfiguration.builder() + .addAccountingProvider( + CustomerUpdateParams.AccountingSyncConfiguration.AccountingProvider + .builder() + .externalProviderId("external_provider_id") + .providerType("provider_type") + .build() + ) + .excluded(true) + .build() + ) + .addAdditionalEmail("string") + .autoCollection(true) + .billingAddress( + CustomerUpdateParams.BillingAddress.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .postalCode("postal_code") + .state("state") + .build() + ) + .currency("currency") + .email("dev@stainlessapi.com") + .emailDelivery(true) + .externalCustomerId("external_customer_id") + .hierarchy( + CustomerUpdateParams.Hierarchy.builder() + .addChildCustomerId("string") + .parentCustomerId("parent_customer_id") + .build() + ) + .metadata( + CustomerUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .name("name") + .paymentProvider(CustomerUpdateParams.PaymentProvider.QUICKBOOKS) + .paymentProviderId("payment_provider_id") + .reportingConfiguration( + CustomerUpdateParams.ReportingConfiguration.builder().exempt(true).build() + ) + .shippingAddress( + CustomerUpdateParams.ShippingAddress.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .postalCode("postal_code") + .state("state") + .build() + ) + .taxConfiguration( + CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration.builder() + .taxExempt(true) + .taxProvider( + CustomerUpdateParams.TaxConfiguration.NewAvalaraTaxConfiguration + .TaxProvider + .AVALARA + ) + .taxExemptionCode("tax_exemption_code") + .build() + ) + .taxId( + CustomerUpdateParams.TaxId.builder() + .country(CustomerUpdateParams.TaxId.Country.AD) + .type(CustomerUpdateParams.TaxId.Type.AD_NRT) + .value("value") + .build() + ) + .build() + ) + + val customer = customerFuture.get() + customer.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val pageFuture = customerServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun delete() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val future = + customerServiceAsync.delete( + CustomerDeleteParams.builder().customerId("customer_id").build() + ) + + val response = future.get() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val customerFuture = + customerServiceAsync.fetch( + CustomerFetchParams.builder().customerId("customer_id").build() + ) + + val customer = customerFuture.get() + customer.validate() + } + + @Test + fun fetchByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val customerFuture = + customerServiceAsync.fetchByExternalId( + CustomerFetchByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .build() + ) + + val customer = customerFuture.get() + customer.validate() + } + + @Test + fun syncPaymentMethodsFromGateway() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val future = + customerServiceAsync.syncPaymentMethodsFromGateway( + CustomerSyncPaymentMethodsFromGatewayParams.builder() + .externalCustomerId("external_customer_id") + .build() + ) + + val response = future.get() + } + + @Test + fun syncPaymentMethodsFromGatewayByExternalCustomerId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val future = + customerServiceAsync.syncPaymentMethodsFromGatewayByExternalCustomerId( + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() + .customerId("customer_id") + .build() + ) + + val response = future.get() + } + + @Test + fun updateByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val customerServiceAsync = client.customers() + + val customerFuture = + customerServiceAsync.updateByExternalId( + CustomerUpdateByExternalIdParams.builder() + .id("external_customer_id") + .accountingSyncConfiguration( + CustomerUpdateByExternalIdParams.AccountingSyncConfiguration.builder() + .addAccountingProvider( + CustomerUpdateByExternalIdParams.AccountingSyncConfiguration + .AccountingProvider + .builder() + .externalProviderId("external_provider_id") + .providerType("provider_type") + .build() + ) + .excluded(true) + .build() + ) + .addAdditionalEmail("string") + .autoCollection(true) + .billingAddress( + CustomerUpdateByExternalIdParams.BillingAddress.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .postalCode("postal_code") + .state("state") + .build() + ) + .currency("currency") + .email("dev@stainlessapi.com") + .emailDelivery(true) + .externalCustomerId("external_customer_id") + .hierarchy( + CustomerUpdateByExternalIdParams.Hierarchy.builder() + .addChildCustomerId("string") + .parentCustomerId("parent_customer_id") + .build() + ) + .metadata( + CustomerUpdateByExternalIdParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .name("name") + .paymentProvider(CustomerUpdateByExternalIdParams.PaymentProvider.QUICKBOOKS) + .paymentProviderId("payment_provider_id") + .reportingConfiguration( + CustomerUpdateByExternalIdParams.ReportingConfiguration.builder() + .exempt(true) + .build() + ) + .shippingAddress( + CustomerUpdateByExternalIdParams.ShippingAddress.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .postalCode("postal_code") + .state("state") + .build() + ) + .taxConfiguration( + CustomerUpdateByExternalIdParams.TaxConfiguration.NewAvalaraTaxConfiguration + .builder() + .taxExempt(true) + .taxProvider( + CustomerUpdateByExternalIdParams.TaxConfiguration + .NewAvalaraTaxConfiguration + .TaxProvider + .AVALARA + ) + .taxExemptionCode("tax_exemption_code") + .build() + ) + .taxId( + CustomerUpdateByExternalIdParams.TaxId.builder() + .country(CustomerUpdateByExternalIdParams.TaxId.Country.AD) + .type(CustomerUpdateByExternalIdParams.TaxId.Type.AD_NRT) + .value("value") + .build() + ) + .build() + ) + + val customer = customerFuture.get() + customer.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt new file mode 100644 index 00000000..e0b7a9e0 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncTest.kt @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.DimensionalPriceGroupCreateParams +import com.withorb.api.models.DimensionalPriceGroupRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DimensionalPriceGroupServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dimensionalPriceGroupServiceAsync = client.dimensionalPriceGroups() + + val dimensionalPriceGroupFuture = + dimensionalPriceGroupServiceAsync.create( + DimensionalPriceGroupCreateParams.builder() + .billableMetricId("billable_metric_id") + .addDimension("region") + .addDimension("instance_type") + .name("name") + .externalDimensionalPriceGroupId("external_dimensional_price_group_id") + .metadata( + DimensionalPriceGroupCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val dimensionalPriceGroup = dimensionalPriceGroupFuture.get() + dimensionalPriceGroup.validate() + } + + @Test + fun retrieve() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dimensionalPriceGroupServiceAsync = client.dimensionalPriceGroups() + + val dimensionalPriceGroupFuture = + dimensionalPriceGroupServiceAsync.retrieve( + DimensionalPriceGroupRetrieveParams.builder() + .dimensionalPriceGroupId("dimensional_price_group_id") + .build() + ) + + val dimensionalPriceGroup = dimensionalPriceGroupFuture.get() + dimensionalPriceGroup.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dimensionalPriceGroupServiceAsync = client.dimensionalPriceGroups() + + val pageFuture = dimensionalPriceGroupServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt new file mode 100644 index 00000000..4beb9dca --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/EventServiceAsyncTest.kt @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.EventDeprecateParams +import com.withorb.api.models.EventIngestParams +import com.withorb.api.models.EventSearchParams +import com.withorb.api.models.EventUpdateParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class EventServiceAsyncTest { + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val eventServiceAsync = client.events() + + val eventFuture = + eventServiceAsync.update( + EventUpdateParams.builder() + .eventId("event_id") + .eventName("event_name") + .properties(JsonValue.from(mapOf())) + .timestamp(OffsetDateTime.parse("2020-12-09T16:09:53Z")) + .customerId("customer_id") + .externalCustomerId("external_customer_id") + .build() + ) + + val event = eventFuture.get() + event.validate() + } + + @Test + fun deprecate() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val eventServiceAsync = client.events() + + val responseFuture = + eventServiceAsync.deprecate(EventDeprecateParams.builder().eventId("event_id").build()) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun ingest() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val eventServiceAsync = client.events() + + val responseFuture = + eventServiceAsync.ingest( + EventIngestParams.builder() + .backfillId("backfill_id") + .debug(true) + .addEvent( + EventIngestParams.Event.builder() + .eventName("event_name") + .idempotencyKey("idempotency_key") + .properties(JsonValue.from(mapOf())) + .timestamp(OffsetDateTime.parse("2020-12-09T16:09:53Z")) + .customerId("customer_id") + .externalCustomerId("external_customer_id") + .build() + ) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun search() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val eventServiceAsync = client.events() + + val responseFuture = + eventServiceAsync.search( + EventSearchParams.builder() + .addEventId("string") + .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncTest.kt new file mode 100644 index 00000000..02006d5a --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncTest.kt @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.InvoiceLineItemCreateParams +import java.time.LocalDate +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class InvoiceLineItemServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceLineItemServiceAsync = client.invoiceLineItems() + + val invoiceLineItemFuture = + invoiceLineItemServiceAsync.create( + InvoiceLineItemCreateParams.builder() + .amount("12.00") + .endDate(LocalDate.parse("2023-09-22")) + .invoiceId("4khy3nwzktxv7") + .name("Item Name") + .quantity(1.0) + .startDate(LocalDate.parse("2023-09-22")) + .build() + ) + + val invoiceLineItem = invoiceLineItemFuture.get() + invoiceLineItem.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt new file mode 100644 index 00000000..ad640f8a --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncTest.kt @@ -0,0 +1,228 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.InvoiceCreateParams +import com.withorb.api.models.InvoiceFetchParams +import com.withorb.api.models.InvoiceFetchUpcomingParams +import com.withorb.api.models.InvoiceIssueParams +import com.withorb.api.models.InvoiceMarkPaidParams +import com.withorb.api.models.InvoicePayParams +import com.withorb.api.models.InvoiceUpdateParams +import com.withorb.api.models.InvoiceVoidInvoiceParams +import com.withorb.api.models.PercentageDiscount +import java.time.LocalDate +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class InvoiceServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.create( + InvoiceCreateParams.builder() + .currency("USD") + .invoiceDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addLineItem( + InvoiceCreateParams.LineItem.builder() + .endDate(LocalDate.parse("2023-09-22")) + .itemId("4khy3nwzktxv7") + .modelType(InvoiceCreateParams.LineItem.ModelType.UNIT) + .name("Line Item Name") + .quantity(1.0) + .startDate(LocalDate.parse("2023-09-22")) + .unitConfig( + InvoiceCreateParams.LineItem.UnitConfig.builder() + .unitAmount("unit_amount") + .build() + ) + .build() + ) + .netTerms(0L) + .customerId("4khy3nwzktxv7") + .discount( + PercentageDiscount.builder() + .addAppliesToPriceId("h74gfhdjvn7ujokd") + .addAppliesToPriceId("7hfgtgjnbvc3ujkl") + .discountType(PercentageDiscount.DiscountType.PERCENTAGE) + .percentageDiscount(0.15) + .reason("reason") + .build() + ) + .externalCustomerId("external-customer-id") + .memo("An optional memo for my invoice.") + .metadata( + InvoiceCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .willAutoIssue(false) + .build() + ) + + val invoice = invoiceFuture.get() + invoice.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.update( + InvoiceUpdateParams.builder() + .invoiceId("invoice_id") + .metadata( + InvoiceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val invoice = invoiceFuture.get() + invoice.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val pageFuture = invoiceServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.fetch(InvoiceFetchParams.builder().invoiceId("invoice_id").build()) + + val invoice = invoiceFuture.get() + invoice.validate() + } + + @Test + fun fetchUpcoming() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val responseFuture = + invoiceServiceAsync.fetchUpcoming( + InvoiceFetchUpcomingParams.builder().subscriptionId("subscription_id").build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun issue() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.issue( + InvoiceIssueParams.builder().invoiceId("invoice_id").synchronous(true).build() + ) + + val invoice = invoiceFuture.get() + invoice.validate() + } + + @Test + fun markPaid() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.markPaid( + InvoiceMarkPaidParams.builder() + .invoiceId("invoice_id") + .paymentReceivedDate(LocalDate.parse("2023-09-22")) + .externalId("external_payment_id_123") + .notes("notes") + .build() + ) + + val invoice = invoiceFuture.get() + invoice.validate() + } + + @Test + fun pay() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.pay(InvoicePayParams.builder().invoiceId("invoice_id").build()) + + val invoice = invoiceFuture.get() + invoice.validate() + } + + @Test + fun voidInvoice() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val invoiceServiceAsync = client.invoices() + + val invoiceFuture = + invoiceServiceAsync.voidInvoice( + InvoiceVoidInvoiceParams.builder().invoiceId("invoice_id").build() + ) + + val invoice = invoiceFuture.get() + invoice.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt new file mode 100644 index 00000000..04afc4ae --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/ItemServiceAsyncTest.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.ItemCreateParams +import com.withorb.api.models.ItemFetchParams +import com.withorb.api.models.ItemUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ItemServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val itemServiceAsync = client.items() + + val itemFuture = + itemServiceAsync.create(ItemCreateParams.builder().name("API requests").build()) + + val item = itemFuture.get() + item.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val itemServiceAsync = client.items() + + val itemFuture = + itemServiceAsync.update( + ItemUpdateParams.builder() + .itemId("item_id") + .addExternalConnection( + ItemUpdateParams.ExternalConnection.builder() + .externalConnectionName( + ItemUpdateParams.ExternalConnection.ExternalConnectionName.STRIPE + ) + .externalEntityId("external_entity_id") + .build() + ) + .name("name") + .build() + ) + + val item = itemFuture.get() + item.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val itemServiceAsync = client.items() + + val pageFuture = itemServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val itemServiceAsync = client.items() + + val itemFuture = itemServiceAsync.fetch(ItemFetchParams.builder().itemId("item_id").build()) + + val item = itemFuture.get() + item.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt new file mode 100644 index 00000000..aa6c6c8d --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/MetricServiceAsyncTest.kt @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.MetricCreateParams +import com.withorb.api.models.MetricFetchParams +import com.withorb.api.models.MetricUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class MetricServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val metricServiceAsync = client.metrics() + + val billableMetricFuture = + metricServiceAsync.create( + MetricCreateParams.builder() + .description("Sum of bytes downloaded in fast mode") + .itemId("item_id") + .name("Bytes downloaded") + .sql("SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'") + .metadata( + MetricCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val billableMetric = billableMetricFuture.get() + billableMetric.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val metricServiceAsync = client.metrics() + + val billableMetricFuture = + metricServiceAsync.update( + MetricUpdateParams.builder() + .metricId("metric_id") + .metadata( + MetricUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val billableMetric = billableMetricFuture.get() + billableMetric.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val metricServiceAsync = client.metrics() + + val pageFuture = metricServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val metricServiceAsync = client.metrics() + + val billableMetricFuture = + metricServiceAsync.fetch(MetricFetchParams.builder().metricId("metric_id").build()) + + val billableMetric = billableMetricFuture.get() + billableMetric.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt new file mode 100644 index 00000000..c68e6368 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt @@ -0,0 +1,151 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.PlanCreateParams +import com.withorb.api.models.PlanFetchParams +import com.withorb.api.models.PlanUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PlanServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val planServiceAsync = client.plans() + + val planFuture = + planServiceAsync.create( + PlanCreateParams.builder() + .currency("currency") + .name("name") + .addPrice( + PlanCreateParams.Price.NewPlanUnitPrice.builder() + .cadence(PlanCreateParams.Price.NewPlanUnitPrice.Cadence.ANNUAL) + .itemId("item_id") + .modelType(PlanCreateParams.Price.NewPlanUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig( + PlanCreateParams.Price.NewPlanUnitPrice.UnitConfig.builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + PlanCreateParams.Price.NewPlanUnitPrice.BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PlanCreateParams.Price.NewPlanUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .currency("currency") + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + PlanCreateParams.Price.NewPlanUnitPrice.InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PlanCreateParams.Price.NewPlanUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + PlanCreateParams.Price.NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .defaultInvoiceMemo("default_invoice_memo") + .externalPlanId("external_plan_id") + .metadata( + PlanCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .netTerms(0L) + .status(PlanCreateParams.Status.ACTIVE) + .build() + ) + + val plan = planFuture.get() + plan.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val planServiceAsync = client.plans() + + val planFuture = + planServiceAsync.update( + PlanUpdateParams.builder() + .planId("plan_id") + .externalPlanId("external_plan_id") + .metadata( + PlanUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val plan = planFuture.get() + plan.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val planServiceAsync = client.plans() + + val pageFuture = planServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val planServiceAsync = client.plans() + + val planFuture = planServiceAsync.fetch(PlanFetchParams.builder().planId("plan_id").build()) + + val plan = planFuture.get() + plan.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt new file mode 100644 index 00000000..18e5da7f --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.PriceCreateParams +import com.withorb.api.models.PriceEvaluateParams +import com.withorb.api.models.PriceFetchParams +import com.withorb.api.models.PriceUpdateParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PriceServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val priceServiceAsync = client.prices() + + val priceFuture = + priceServiceAsync.create( + PriceCreateParams.builder() + .body( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) + .currency("currency") + .itemId("item_id") + .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig( + PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + PriceCreateParams.Body.NewFloatingUnitPrice + .BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PriceCreateParams.Body.NewFloatingUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + PriceCreateParams.Body.NewFloatingUnitPrice + .InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PriceCreateParams.Body.NewFloatingUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .build() + ) + + val price = priceFuture.get() + price.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val priceServiceAsync = client.prices() + + val priceFuture = + priceServiceAsync.update( + PriceUpdateParams.builder() + .priceId("price_id") + .metadata( + PriceUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val price = priceFuture.get() + price.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val priceServiceAsync = client.prices() + + val pageFuture = priceServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun evaluate() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val priceServiceAsync = client.prices() + + val responseFuture = + priceServiceAsync.evaluate( + PriceEvaluateParams.builder() + .priceId("price_id") + .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .customerId("customer_id") + .externalCustomerId("external_customer_id") + .filter("my_numeric_property > 100 AND my_other_property = 'bar'") + .addGroupingKey("case when my_event_type = 'foo' then true else false end") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val priceServiceAsync = client.prices() + + val priceFuture = + priceServiceAsync.fetch(PriceFetchParams.builder().priceId("price_id").build()) + + val price = priceFuture.get() + price.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt new file mode 100644 index 00000000..43dd1480 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncTest.kt @@ -0,0 +1,1140 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.SubscriptionCancelParams +import com.withorb.api.models.SubscriptionCreateParams +import com.withorb.api.models.SubscriptionFetchCostsParams +import com.withorb.api.models.SubscriptionFetchParams +import com.withorb.api.models.SubscriptionFetchScheduleParams +import com.withorb.api.models.SubscriptionFetchUsageParams +import com.withorb.api.models.SubscriptionPriceIntervalsParams +import com.withorb.api.models.SubscriptionSchedulePlanChangeParams +import com.withorb.api.models.SubscriptionTriggerPhaseParams +import com.withorb.api.models.SubscriptionUnscheduleCancellationParams +import com.withorb.api.models.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams +import com.withorb.api.models.SubscriptionUnschedulePendingPlanChangesParams +import com.withorb.api.models.SubscriptionUpdateFixedFeeQuantityParams +import com.withorb.api.models.SubscriptionUpdateParams +import com.withorb.api.models.SubscriptionUpdateTrialParams +import java.time.LocalDate +import java.time.OffsetDateTime +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class SubscriptionServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val subscriptionFuture = + subscriptionServiceAsync.create( + SubscriptionCreateParams.builder() + .addAddAdjustment( + SubscriptionCreateParams.AddAdjustment.builder() + .adjustment( + SubscriptionCreateParams.AddAdjustment.Adjustment + .NewPercentageDiscount + .builder() + .adjustmentType( + SubscriptionCreateParams.AddAdjustment.Adjustment + .NewPercentageDiscount + .AdjustmentType + .PERCENTAGE_DISCOUNT + ) + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .percentageDiscount(0.0) + .isInvoiceLevel(true) + .build() + ) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .planPhaseOrder(0L) + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .addAddPrice( + SubscriptionCreateParams.AddPrice.builder() + .allocationPrice( + SubscriptionCreateParams.AddPrice.AllocationPrice.builder() + .amount("10.00") + .cadence( + SubscriptionCreateParams.AddPrice.AllocationPrice.Cadence + .ONE_TIME + ) + .currency("USD") + .expiresAtEndOfCadence(true) + .build() + ) + .addDiscount( + SubscriptionCreateParams.AddPrice.Discount.builder() + .discountType( + SubscriptionCreateParams.AddPrice.Discount.DiscountType + .PERCENTAGE + ) + .amountDiscount("amount_discount") + .percentageDiscount(0.15) + .usageDiscount(0.0) + .build() + ) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalPriceId("external_price_id") + .maximumAmount("1.23") + .minimumAmount("1.23") + .planPhaseOrder(0L) + .price( + SubscriptionCreateParams.AddPrice.Price.NewSubscriptionUnitPrice + .builder() + .cadence( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .Cadence + .ANNUAL + ) + .itemId("item_id") + .modelType( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .ModelType + .UNIT + ) + .name("Annual fee") + .unitConfig( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .UnitConfig + .builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .currency("currency") + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + SubscriptionCreateParams.AddPrice.Price + .NewSubscriptionUnitPrice + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") + .build() + ) + .priceId("h74gfhdjvn7ujokd") + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .alignBillingWithSubscriptionStartDate(true) + .autoCollection(true) + .awsRegion("aws_region") + .billingCycleAnchorConfiguration( + SubscriptionCreateParams.BillingCycleAnchorConfiguration.builder() + .day(1L) + .month(1L) + .year(0L) + .build() + ) + .couponRedemptionCode("coupon_redemption_code") + .creditsOverageRate(0.0) + .customerId("customer_id") + .defaultInvoiceMemo("default_invoice_memo") + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalCustomerId("external_customer_id") + .externalMarketplace(SubscriptionCreateParams.ExternalMarketplace.GOOGLE) + .externalMarketplaceReportingId("external_marketplace_reporting_id") + .externalPlanId("ZMwNQefe7J3ecf7W") + .filter("my_property > 100 AND my_other_property = 'bar'") + .initialPhaseOrder(2L) + .invoicingThreshold("10.00") + .metadata( + SubscriptionCreateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .netTerms(0L) + .perCreditOverageAmount(0.0) + .planId("ZMwNQefe7J3ecf7W") + .planVersionNumber(0L) + .addPriceOverride(JsonValue.from(mapOf())) + .addRemoveAdjustment( + SubscriptionCreateParams.RemoveAdjustment.builder() + .adjustmentId("h74gfhdjvn7ujokd") + .build() + ) + .addRemovePrice( + SubscriptionCreateParams.RemovePrice.builder() + .externalPriceId("external_price_id") + .priceId("h74gfhdjvn7ujokd") + .build() + ) + .addReplaceAdjustment( + SubscriptionCreateParams.ReplaceAdjustment.builder() + .adjustment( + SubscriptionCreateParams.ReplaceAdjustment.Adjustment + .NewPercentageDiscount + .builder() + .adjustmentType( + SubscriptionCreateParams.ReplaceAdjustment.Adjustment + .NewPercentageDiscount + .AdjustmentType + .PERCENTAGE_DISCOUNT + ) + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .percentageDiscount(0.0) + .isInvoiceLevel(true) + .build() + ) + .replacesAdjustmentId("replaces_adjustment_id") + .build() + ) + .addReplacePrice( + SubscriptionCreateParams.ReplacePrice.builder() + .replacesPriceId("replaces_price_id") + .allocationPrice( + SubscriptionCreateParams.ReplacePrice.AllocationPrice.builder() + .amount("10.00") + .cadence( + SubscriptionCreateParams.ReplacePrice.AllocationPrice + .Cadence + .ONE_TIME + ) + .currency("USD") + .expiresAtEndOfCadence(true) + .build() + ) + .addDiscount( + SubscriptionCreateParams.ReplacePrice.Discount.builder() + .discountType( + SubscriptionCreateParams.ReplacePrice.Discount.DiscountType + .PERCENTAGE + ) + .amountDiscount("amount_discount") + .percentageDiscount(0.15) + .usageDiscount(0.0) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(2.0) + .maximumAmount("1.23") + .minimumAmount("1.23") + .price( + SubscriptionCreateParams.ReplacePrice.Price.NewSubscriptionUnitPrice + .builder() + .cadence( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .Cadence + .ANNUAL + ) + .itemId("item_id") + .modelType( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .ModelType + .UNIT + ) + .name("Annual fee") + .unitConfig( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .UnitConfig + .builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .currency("currency") + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + SubscriptionCreateParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") + .build() + ) + .priceId("h74gfhdjvn7ujokd") + .build() + ) + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .trialDurationDays(999999L) + .addUsageCustomerId("string") + .build() + ) + + val subscription = subscriptionFuture.get() + subscription.validate() + } + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val subscriptionFuture = + subscriptionServiceAsync.update( + SubscriptionUpdateParams.builder() + .subscriptionId("subscription_id") + .autoCollection(true) + .defaultInvoiceMemo("default_invoice_memo") + .invoicingThreshold("10.00") + .metadata( + SubscriptionUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .netTerms(0L) + .build() + ) + + val subscription = subscriptionFuture.get() + subscription.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val pageFuture = subscriptionServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun cancel() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.cancel( + SubscriptionCancelParams.builder() + .subscriptionId("subscription_id") + .cancelOption(SubscriptionCancelParams.CancelOption.END_OF_SUBSCRIPTION_TERM) + .allowInvoiceCreditOrVoid(true) + .cancellationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val subscriptionFuture = + subscriptionServiceAsync.fetch( + SubscriptionFetchParams.builder().subscriptionId("subscription_id").build() + ) + + val subscription = subscriptionFuture.get() + subscription.validate() + } + + @Test + fun fetchCosts() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.fetchCosts( + SubscriptionFetchCostsParams.builder() + .subscriptionId("subscription_id") + .currency("currency") + .timeframeEnd(OffsetDateTime.parse("2022-03-01T05:00:00Z")) + .timeframeStart(OffsetDateTime.parse("2022-02-01T05:00:00Z")) + .viewMode(SubscriptionFetchCostsParams.ViewMode.PERIODIC) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun fetchSchedule() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val pageFuture = + subscriptionServiceAsync.fetchSchedule( + SubscriptionFetchScheduleParams.builder().subscriptionId("subscription_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } + + @Disabled("Incorrect example breaks Prism") + @Test + fun fetchUsage() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val subscriptionUsageFuture = + subscriptionServiceAsync.fetchUsage( + SubscriptionFetchUsageParams.builder() + .subscriptionId("subscription_id") + .billableMetricId("billable_metric_id") + .firstDimensionKey("first_dimension_key") + .firstDimensionValue("first_dimension_value") + .granularity(SubscriptionFetchUsageParams.Granularity.DAY) + .groupBy("group_by") + .secondDimensionKey("second_dimension_key") + .secondDimensionValue("second_dimension_value") + .timeframeEnd(OffsetDateTime.parse("2022-03-01T05:00:00Z")) + .timeframeStart(OffsetDateTime.parse("2022-02-01T05:00:00Z")) + .viewMode(SubscriptionFetchUsageParams.ViewMode.PERIODIC) + .build() + ) + + val subscriptionUsage = subscriptionUsageFuture.get() + subscriptionUsage.validate() + } + + @Disabled("Incorrect example breaks Prism") + @Test + fun priceIntervals() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.priceIntervals( + SubscriptionPriceIntervalsParams.builder() + .subscriptionId("subscription_id") + .addAdd( + SubscriptionPriceIntervalsParams.Add.builder() + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .allocationPrice( + SubscriptionPriceIntervalsParams.Add.AllocationPrice.builder() + .amount("10.00") + .cadence( + SubscriptionPriceIntervalsParams.Add.AllocationPrice.Cadence + .ONE_TIME + ) + .currency("USD") + .expiresAtEndOfCadence(true) + .build() + ) + .addAmountDiscountCreationParamsDiscount(0.0) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalPriceId("external_price_id") + .filter("my_property > 100 AND my_other_property = 'bar'") + .addFixedFeeQuantityTransition( + SubscriptionPriceIntervalsParams.Add.FixedFeeQuantityTransition + .builder() + .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .quantity(5L) + .build() + ) + .maximumAmount(0.0) + .minimumAmount(0.0) + .price( + SubscriptionPriceIntervalsParams.Add.Price.NewFloatingUnitPrice + .builder() + .cadence( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .Cadence + .ANNUAL + ) + .currency("currency") + .itemId("item_id") + .modelType( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .ModelType + .UNIT + ) + .name("Annual fee") + .unitConfig( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .UnitConfig + .builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + SubscriptionPriceIntervalsParams.Add.Price + .NewFloatingUnitPrice + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .priceId("h74gfhdjvn7ujokd") + .addUsageCustomerId("string") + .build() + ) + .addAddAdjustment( + SubscriptionPriceIntervalsParams.AddAdjustment.builder() + .adjustment( + SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment + .NewPercentageDiscount + .builder() + .adjustmentType( + SubscriptionPriceIntervalsParams.AddAdjustment.Adjustment + .NewPercentageDiscount + .AdjustmentType + .PERCENTAGE_DISCOUNT + ) + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .percentageDiscount(0.0) + .isInvoiceLevel(true) + .build() + ) + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .allowInvoiceCreditOrVoid(true) + .addEdit( + SubscriptionPriceIntervalsParams.Edit.builder() + .priceIntervalId("sdfs6wdjvn7ujokd") + .billingCycleDay(0L) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("my_property > 100 AND my_other_property = 'bar'") + .addFixedFeeQuantityTransition( + SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition + .builder() + .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .quantity(5L) + .build() + ) + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") + .build() + ) + .addEditAdjustment( + SubscriptionPriceIntervalsParams.EditAdjustment.builder() + .adjustmentIntervalId("sdfs6wdjvn7ujokd") + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun schedulePlanChange() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.schedulePlanChange( + SubscriptionSchedulePlanChangeParams.builder() + .subscriptionId("subscription_id") + .changeOption(SubscriptionSchedulePlanChangeParams.ChangeOption.REQUESTED_DATE) + .addAddAdjustment( + SubscriptionSchedulePlanChangeParams.AddAdjustment.builder() + .adjustment( + SubscriptionSchedulePlanChangeParams.AddAdjustment.Adjustment + .NewPercentageDiscount + .builder() + .adjustmentType( + SubscriptionSchedulePlanChangeParams.AddAdjustment + .Adjustment + .NewPercentageDiscount + .AdjustmentType + .PERCENTAGE_DISCOUNT + ) + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .percentageDiscount(0.0) + .isInvoiceLevel(true) + .build() + ) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .planPhaseOrder(0L) + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .addAddPrice( + SubscriptionSchedulePlanChangeParams.AddPrice.builder() + .allocationPrice( + SubscriptionSchedulePlanChangeParams.AddPrice.AllocationPrice + .builder() + .amount("10.00") + .cadence( + SubscriptionSchedulePlanChangeParams.AddPrice + .AllocationPrice + .Cadence + .ONE_TIME + ) + .currency("USD") + .expiresAtEndOfCadence(true) + .build() + ) + .addDiscount( + SubscriptionSchedulePlanChangeParams.AddPrice.Discount.builder() + .discountType( + SubscriptionSchedulePlanChangeParams.AddPrice.Discount + .DiscountType + .PERCENTAGE + ) + .amountDiscount("amount_discount") + .percentageDiscount(0.15) + .usageDiscount(0.0) + .build() + ) + .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .externalPriceId("external_price_id") + .maximumAmount("1.23") + .minimumAmount("1.23") + .planPhaseOrder(0L) + .price( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .builder() + .cadence( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .Cadence + .ANNUAL + ) + .itemId("item_id") + .modelType( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .ModelType + .UNIT + ) + .name("Annual fee") + .unitConfig( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .UnitConfig + .builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .currency("currency") + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + SubscriptionSchedulePlanChangeParams.AddPrice.Price + .NewSubscriptionUnitPrice + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") + .build() + ) + .priceId("h74gfhdjvn7ujokd") + .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .alignBillingWithPlanChangeDate(true) + .autoCollection(true) + .billingCycleAlignment( + SubscriptionSchedulePlanChangeParams.BillingCycleAlignment.UNCHANGED + ) + .billingCycleAnchorConfiguration( + SubscriptionSchedulePlanChangeParams.BillingCycleAnchorConfiguration + .builder() + .day(1L) + .month(1L) + .year(0L) + .build() + ) + .changeDate(OffsetDateTime.parse("2017-07-21T17:32:28Z")) + .couponRedemptionCode("coupon_redemption_code") + .creditsOverageRate(0.0) + .defaultInvoiceMemo("default_invoice_memo") + .externalPlanId("ZMwNQefe7J3ecf7W") + .filter("my_property > 100 AND my_other_property = 'bar'") + .initialPhaseOrder(2L) + .invoicingThreshold("10.00") + .netTerms(0L) + .perCreditOverageAmount(0.0) + .planId("ZMwNQefe7J3ecf7W") + .planVersionNumber(0L) + .addPriceOverride(JsonValue.from(mapOf())) + .addRemoveAdjustment( + SubscriptionSchedulePlanChangeParams.RemoveAdjustment.builder() + .adjustmentId("h74gfhdjvn7ujokd") + .build() + ) + .addRemovePrice( + SubscriptionSchedulePlanChangeParams.RemovePrice.builder() + .externalPriceId("external_price_id") + .priceId("h74gfhdjvn7ujokd") + .build() + ) + .addReplaceAdjustment( + SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.builder() + .adjustment( + SubscriptionSchedulePlanChangeParams.ReplaceAdjustment.Adjustment + .NewPercentageDiscount + .builder() + .adjustmentType( + SubscriptionSchedulePlanChangeParams.ReplaceAdjustment + .Adjustment + .NewPercentageDiscount + .AdjustmentType + .PERCENTAGE_DISCOUNT + ) + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .percentageDiscount(0.0) + .isInvoiceLevel(true) + .build() + ) + .replacesAdjustmentId("replaces_adjustment_id") + .build() + ) + .addReplacePrice( + SubscriptionSchedulePlanChangeParams.ReplacePrice.builder() + .replacesPriceId("replaces_price_id") + .allocationPrice( + SubscriptionSchedulePlanChangeParams.ReplacePrice.AllocationPrice + .builder() + .amount("10.00") + .cadence( + SubscriptionSchedulePlanChangeParams.ReplacePrice + .AllocationPrice + .Cadence + .ONE_TIME + ) + .currency("USD") + .expiresAtEndOfCadence(true) + .build() + ) + .addDiscount( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Discount.builder() + .discountType( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Discount + .DiscountType + .PERCENTAGE + ) + .amountDiscount("amount_discount") + .percentageDiscount(0.15) + .usageDiscount(0.0) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(2.0) + .maximumAmount("1.23") + .minimumAmount("1.23") + .price( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .builder() + .cadence( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .Cadence + .ANNUAL + ) + .itemId("item_id") + .modelType( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .ModelType + .UNIT + ) + .name("Annual fee") + .unitConfig( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .UnitConfig + .builder() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionSchedulePlanChangeParams.ReplacePrice + .Price + .NewSubscriptionUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .currency("currency") + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + SubscriptionSchedulePlanChangeParams.ReplacePrice + .Price + .NewSubscriptionUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + SubscriptionSchedulePlanChangeParams.ReplacePrice.Price + .NewSubscriptionUnitPrice + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") + .build() + ) + .priceId("h74gfhdjvn7ujokd") + .build() + ) + .trialDurationDays(999999L) + .addUsageCustomerId("string") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun triggerPhase() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.triggerPhase( + SubscriptionTriggerPhaseParams.builder() + .subscriptionId("subscription_id") + .allowInvoiceCreditOrVoid(true) + .effectiveDate(LocalDate.parse("2019-12-27")) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun unscheduleCancellation() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.unscheduleCancellation( + SubscriptionUnscheduleCancellationParams.builder() + .subscriptionId("subscription_id") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun unscheduleFixedFeeQuantityUpdates() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.unscheduleFixedFeeQuantityUpdates( + SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.builder() + .subscriptionId("subscription_id") + .priceId("price_id") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun unschedulePendingPlanChanges() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.unschedulePendingPlanChanges( + SubscriptionUnschedulePendingPlanChangesParams.builder() + .subscriptionId("subscription_id") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun updateFixedFeeQuantity() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.updateFixedFeeQuantity( + SubscriptionUpdateFixedFeeQuantityParams.builder() + .subscriptionId("subscription_id") + .priceId("price_id") + .quantity(0.0) + .allowInvoiceCreditOrVoid(true) + .changeOption(SubscriptionUpdateFixedFeeQuantityParams.ChangeOption.IMMEDIATE) + .effectiveDate(LocalDate.parse("2022-12-21")) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun updateTrial() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.subscriptions() + + val responseFuture = + subscriptionServiceAsync.updateTrial( + SubscriptionUpdateTrialParams.builder() + .subscriptionId("subscription_id") + .trialEndDate(OffsetDateTime.parse("2017-07-21T17:32:28Z")) + .shift(true) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncTest.kt new file mode 100644 index 00000000..85ebf208 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncTest.kt @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class TopLevelServiceAsyncTest { + + @Test + fun ping() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topLevelServiceAsync = client.topLevel() + + val responseFuture = topLevelServiceAsync.ping() + + val response = responseFuture.get() + response.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt new file mode 100644 index 00000000..f2729e96 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/coupons/SubscriptionServiceAsyncTest.kt @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.coupons + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CouponSubscriptionListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class SubscriptionServiceAsyncTest { + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subscriptionServiceAsync = client.coupons().subscriptions() + + val pageFuture = + subscriptionServiceAsync.list( + CouponSubscriptionListParams.builder().couponId("coupon_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt new file mode 100644 index 00000000..93371c65 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/BalanceTransactionServiceAsyncTest.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.customers + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CustomerBalanceTransactionCreateParams +import com.withorb.api.models.CustomerBalanceTransactionListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class BalanceTransactionServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val balanceTransactionServiceAsync = client.customers().balanceTransactions() + + val balanceTransactionFuture = + balanceTransactionServiceAsync.create( + CustomerBalanceTransactionCreateParams.builder() + .customerId("customer_id") + .amount("amount") + .type(CustomerBalanceTransactionCreateParams.Type.INCREMENT) + .description("description") + .build() + ) + + val balanceTransaction = balanceTransactionFuture.get() + balanceTransaction.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val balanceTransactionServiceAsync = client.customers().balanceTransactions() + + val pageFuture = + balanceTransactionServiceAsync.list( + CustomerBalanceTransactionListParams.builder().customerId("customer_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt new file mode 100644 index 00000000..5d9de169 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CostServiceAsyncTest.kt @@ -0,0 +1,63 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.customers + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CustomerCostListByExternalIdParams +import com.withorb.api.models.CustomerCostListParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CostServiceAsyncTest { + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val costServiceAsync = client.customers().costs() + + val costFuture = + costServiceAsync.list( + CustomerCostListParams.builder() + .customerId("customer_id") + .currency("currency") + .timeframeEnd(OffsetDateTime.parse("2022-03-01T05:00:00Z")) + .timeframeStart(OffsetDateTime.parse("2022-02-01T05:00:00Z")) + .viewMode(CustomerCostListParams.ViewMode.PERIODIC) + .build() + ) + + val cost = costFuture.get() + cost.validate() + } + + @Test + fun listByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val costServiceAsync = client.customers().costs() + + val responseFuture = + costServiceAsync.listByExternalId( + CustomerCostListByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .currency("currency") + .timeframeEnd(OffsetDateTime.parse("2022-03-01T05:00:00Z")) + .timeframeStart(OffsetDateTime.parse("2022-02-01T05:00:00Z")) + .viewMode(CustomerCostListByExternalIdParams.ViewMode.PERIODIC) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt new file mode 100644 index 00000000..47bbc3e1 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/CreditServiceAsyncTest.kt @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.customers + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CustomerCreditListByExternalIdParams +import com.withorb.api.models.CustomerCreditListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CreditServiceAsyncTest { + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val creditServiceAsync = client.customers().credits() + + val pageFuture = + creditServiceAsync.list( + CustomerCreditListParams.builder().customerId("customer_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun listByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val creditServiceAsync = client.customers().credits() + + val pageFuture = + creditServiceAsync.listByExternalId( + CustomerCreditListByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt new file mode 100644 index 00000000..238fab16 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsyncTest.kt @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.customers.credits + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.CustomerCreditLedgerCreateEntryByExternalIdParams +import com.withorb.api.models.CustomerCreditLedgerCreateEntryParams +import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams +import com.withorb.api.models.CustomerCreditLedgerListParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class LedgerServiceAsyncTest { + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ledgerServiceAsync = client.customers().credits().ledger() + + val pageFuture = + ledgerServiceAsync.list( + CustomerCreditLedgerListParams.builder().customerId("customer_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun createEntry() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ledgerServiceAsync = client.customers().credits().ledger() + + val responseFuture = + ledgerServiceAsync.createEntry( + CustomerCreditLedgerCreateEntryParams.builder() + .customerId("customer_id") + .body( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .builder() + .amount(0.0) + .entryType( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .currency("currency") + .description("description") + .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .invoiceSettings( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .InvoiceSettings + .builder() + .autoCollection(true) + .netTerms(0L) + .memo("memo") + .requireSuccessfulPayment(true) + .build() + ) + .metadata( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .perUnitCostBasis("per_unit_cost_basis") + .build() + ) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun createEntryByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ledgerServiceAsync = client.customers().credits().ledger() + + val responseFuture = + ledgerServiceAsync.createEntryByExternalId( + CustomerCreditLedgerCreateEntryByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .body( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .builder() + .amount(0.0) + .entryType( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .currency("currency") + .description("description") + .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .invoiceSettings( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .InvoiceSettings + .builder() + .autoCollection(true) + .netTerms(0L) + .memo("memo") + .requireSuccessfulPayment(true) + .build() + ) + .metadata( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .Metadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .perUnitCostBasis("per_unit_cost_basis") + .build() + ) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun listByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ledgerServiceAsync = client.customers().credits().ledger() + + val pageFuture = + ledgerServiceAsync.listByExternalId( + CustomerCreditLedgerListByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt new file mode 100644 index 00000000..a9693153 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/customers/credits/TopUpServiceAsyncTest.kt @@ -0,0 +1,169 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.customers.credits + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.CustomerCreditTopUpCreateByExternalIdParams +import com.withorb.api.models.CustomerCreditTopUpCreateParams +import com.withorb.api.models.CustomerCreditTopUpDeleteByExternalIdParams +import com.withorb.api.models.CustomerCreditTopUpDeleteParams +import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams +import com.withorb.api.models.CustomerCreditTopUpListParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class TopUpServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topUpServiceAsync = client.customers().credits().topUps() + + val topUpFuture = + topUpServiceAsync.create( + CustomerCreditTopUpCreateParams.builder() + .customerId("customer_id") + .amount("amount") + .currency("currency") + .invoiceSettings( + CustomerCreditTopUpCreateParams.InvoiceSettings.builder() + .autoCollection(true) + .netTerms(0L) + .memo("memo") + .requireSuccessfulPayment(true) + .build() + ) + .perUnitCostBasis("per_unit_cost_basis") + .threshold("threshold") + .activeFrom(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .expiresAfter(0L) + .expiresAfterUnit(CustomerCreditTopUpCreateParams.ExpiresAfterUnit.DAY) + .build() + ) + + val topUp = topUpFuture.get() + topUp.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topUpServiceAsync = client.customers().credits().topUps() + + val pageFuture = + topUpServiceAsync.list( + CustomerCreditTopUpListParams.builder().customerId("customer_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun delete() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topUpServiceAsync = client.customers().credits().topUps() + + val future = + topUpServiceAsync.delete( + CustomerCreditTopUpDeleteParams.builder() + .customerId("customer_id") + .topUpId("top_up_id") + .build() + ) + + val response = future.get() + } + + @Test + fun createByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topUpServiceAsync = client.customers().credits().topUps() + + val responseFuture = + topUpServiceAsync.createByExternalId( + CustomerCreditTopUpCreateByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .amount("amount") + .currency("currency") + .invoiceSettings( + CustomerCreditTopUpCreateByExternalIdParams.InvoiceSettings.builder() + .autoCollection(true) + .netTerms(0L) + .memo("memo") + .requireSuccessfulPayment(true) + .build() + ) + .perUnitCostBasis("per_unit_cost_basis") + .threshold("threshold") + .activeFrom(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .expiresAfter(0L) + .expiresAfterUnit( + CustomerCreditTopUpCreateByExternalIdParams.ExpiresAfterUnit.DAY + ) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun deleteByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topUpServiceAsync = client.customers().credits().topUps() + + val future = + topUpServiceAsync.deleteByExternalId( + CustomerCreditTopUpDeleteByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .topUpId("top_up_id") + .build() + ) + + val response = future.get() + } + + @Test + fun listByExternalId() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val topUpServiceAsync = client.customers().credits().topUps() + + val pageFuture = + topUpServiceAsync.listByExternalId( + CustomerCreditTopUpListByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt new file mode 100644 index 00000000..51af7568 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceAsyncTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.dimensionalPriceGroups + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ExternalDimensionalPriceGroupIdServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val externalDimensionalPriceGroupIdServiceAsync = + client.dimensionalPriceGroups().externalDimensionalPriceGroupId() + + val dimensionalPriceGroupFuture = + externalDimensionalPriceGroupIdServiceAsync.retrieve( + DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.builder() + .externalDimensionalPriceGroupId("external_dimensional_price_group_id") + .build() + ) + + val dimensionalPriceGroup = dimensionalPriceGroupFuture.get() + dimensionalPriceGroup.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt new file mode 100644 index 00000000..b5b37b15 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/BackfillServiceAsyncTest.kt @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.events + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.EventBackfillCloseParams +import com.withorb.api.models.EventBackfillCreateParams +import com.withorb.api.models.EventBackfillFetchParams +import com.withorb.api.models.EventBackfillRevertParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class BackfillServiceAsyncTest { + + @Test + fun create() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backfillServiceAsync = client.events().backfills() + + val backfillFuture = + backfillServiceAsync.create( + EventBackfillCreateParams.builder() + .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .closeTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .customerId("customer_id") + .deprecationFilter("my_numeric_property > 100 AND my_other_property = 'bar'") + .externalCustomerId("external_customer_id") + .replaceExistingEvents(true) + .build() + ) + + val backfill = backfillFuture.get() + backfill.validate() + } + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backfillServiceAsync = client.events().backfills() + + val pageFuture = backfillServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun close() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backfillServiceAsync = client.events().backfills() + + val responseFuture = + backfillServiceAsync.close( + EventBackfillCloseParams.builder().backfillId("backfill_id").build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backfillServiceAsync = client.events().backfills() + + val responseFuture = + backfillServiceAsync.fetch( + EventBackfillFetchParams.builder().backfillId("backfill_id").build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun revert() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backfillServiceAsync = client.events().backfills() + + val responseFuture = + backfillServiceAsync.revert( + EventBackfillRevertParams.builder().backfillId("backfill_id").build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncTest.kt new file mode 100644 index 00000000..867aa8c6 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.events + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.models.EventVolumeListParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class VolumeServiceAsyncTest { + + @Test + fun list() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val volumeServiceAsync = client.events().volume() + + val eventVolumesFuture = + volumeServiceAsync.list( + EventVolumeListParams.builder() + .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .cursor("cursor") + .limit(1L) + .timeframeEnd(OffsetDateTime.parse("2024-10-11T06:00:00Z")) + .build() + ) + + val eventVolumes = eventVolumesFuture.get() + eventVolumes.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt new file mode 100644 index 00000000..a0fc75b8 --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/plans/ExternalPlanIdServiceAsyncTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.plans + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.PlanExternalPlanIdFetchParams +import com.withorb.api.models.PlanExternalPlanIdUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ExternalPlanIdServiceAsyncTest { + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val externalPlanIdServiceAsync = client.plans().externalPlanId() + + val planFuture = + externalPlanIdServiceAsync.update( + PlanExternalPlanIdUpdateParams.builder() + .otherExternalPlanId("external_plan_id") + .externalPlanId("external_plan_id") + .metadata( + PlanExternalPlanIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val plan = planFuture.get() + plan.validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val externalPlanIdServiceAsync = client.plans().externalPlanId() + + val planFuture = + externalPlanIdServiceAsync.fetch( + PlanExternalPlanIdFetchParams.builder().externalPlanId("external_plan_id").build() + ) + + val plan = planFuture.get() + plan.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt new file mode 100644 index 00000000..4e342dfa --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/prices/ExternalPriceIdServiceAsyncTest.kt @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.services.async.prices + +import com.withorb.api.TestServerExtension +import com.withorb.api.client.okhttp.OrbOkHttpClientAsync +import com.withorb.api.core.JsonValue +import com.withorb.api.models.PriceExternalPriceIdFetchParams +import com.withorb.api.models.PriceExternalPriceIdUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ExternalPriceIdServiceAsyncTest { + + @Test + fun update() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val externalPriceIdServiceAsync = client.prices().externalPriceId() + + val priceFuture = + externalPriceIdServiceAsync.update( + PriceExternalPriceIdUpdateParams.builder() + .externalPriceId("external_price_id") + .metadata( + PriceExternalPriceIdUpdateParams.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + + val price = priceFuture.get() + price.validate() + } + + @Test + fun fetch() { + val client = + OrbOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val externalPriceIdServiceAsync = client.prices().externalPriceId() + + val priceFuture = + externalPriceIdServiceAsync.fetch( + PriceExternalPriceIdFetchParams.builder() + .externalPriceId("external_price_id") + .build() + ) + + val price = priceFuture.get() + price.validate() + } +} diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt index 858d5265..f3188cb5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt @@ -19,26 +19,28 @@ import org.junit.jupiter.api.extension.ExtendWith class AlertServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.retrieve(AlertRetrieveParams.builder().alertId("alert_id").build()) - println(alert) + alert.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.update( AlertUpdateParams.builder() @@ -46,32 +48,34 @@ class AlertServiceTest { .addThreshold(AlertUpdateParams.Threshold.builder().value(0.0).build()) .build() ) - println(alert) + alert.validate() } @Disabled("plan_version=0 breaks Prism") @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() - val alerts = alertService.list() - println(alerts) - alerts.data().forEach { it.validate() } + + val page = alertService.list() + + page.response().validate() } @Test - fun callCreateForCustomer() { + fun createForCustomer() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.createForCustomer( AlertCreateForCustomerParams.builder() @@ -83,18 +87,19 @@ class AlertServiceTest { ) .build() ) - println(alert) + alert.validate() } @Test - fun callCreateForExternalCustomer() { + fun createForExternalCustomer() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.createForExternalCustomer( AlertCreateForExternalCustomerParams.builder() @@ -106,18 +111,19 @@ class AlertServiceTest { ) .build() ) - println(alert) + alert.validate() } @Test - fun callCreateForSubscription() { + fun createForSubscription() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.createForSubscription( AlertCreateForSubscriptionParams.builder() @@ -129,18 +135,19 @@ class AlertServiceTest { .metricId("metric_id") .build() ) - println(alert) + alert.validate() } @Test - fun callDisable() { + fun disable() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.disable( AlertDisableParams.builder() @@ -148,18 +155,19 @@ class AlertServiceTest { .subscriptionId("subscription_id") .build() ) - println(alert) + alert.validate() } @Test - fun callEnable() { + fun enable() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val alertService = client.alerts() + val alert = alertService.enable( AlertEnableParams.builder() @@ -167,7 +175,7 @@ class AlertServiceTest { .subscriptionId("subscription_id") .build() ) - println(alert) + alert.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt index 0151fbf6..53f2ecf5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CouponServiceTest.kt @@ -14,13 +14,14 @@ import org.junit.jupiter.api.extension.ExtendWith class CouponServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val couponService = client.coupons() + val coupon = couponService.create( CouponCreateParams.builder() @@ -30,47 +31,50 @@ class CouponServiceTest { .maxRedemptions(1L) .build() ) - println(coupon) + coupon.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val couponService = client.coupons() - val coupons = couponService.list() - println(coupons) - coupons.data().forEach { it.validate() } + + val page = couponService.list() + + page.response().validate() } @Test - fun callArchive() { + fun archive() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val couponService = client.coupons() + val coupon = couponService.archive(CouponArchiveParams.builder().couponId("coupon_id").build()) - println(coupon) + coupon.validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val couponService = client.coupons() + val coupon = couponService.fetch(CouponFetchParams.builder().couponId("coupon_id").build()) - println(coupon) + coupon.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt index 1e350294..0dac463d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt @@ -13,13 +13,14 @@ import org.junit.jupiter.api.extension.ExtendWith class CreditNoteServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val creditNoteService = client.creditNotes() + val creditNote = creditNoteService.create( CreditNoteCreateParams.builder() @@ -33,36 +34,38 @@ class CreditNoteServiceTest { .reason(CreditNoteCreateParams.Reason.DUPLICATE) .build() ) - println(creditNote) + creditNote.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val creditNoteService = client.creditNotes() - val creditNotes = creditNoteService.list() - println(creditNotes) - creditNotes.data().forEach { it.validate() } + + val page = creditNoteService.list() + + page.response().validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val creditNoteService = client.creditNotes() + val creditNote = creditNoteService.fetch( CreditNoteFetchParams.builder().creditNoteId("credit_note_id").build() ) - println(creditNote) + creditNote.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt index 674d326e..7d48b5f2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt @@ -20,13 +20,14 @@ import org.junit.jupiter.api.extension.ExtendWith class CustomerServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + val customer = customerService.create( CustomerCreateParams.builder() @@ -106,18 +107,19 @@ class CustomerServiceTest { .timezone("timezone") .build() ) - println(customer) + customer.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + val customer = customerService.update( CustomerUpdateParams.builder() @@ -197,74 +199,79 @@ class CustomerServiceTest { ) .build() ) - println(customer) + customer.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() - val customers = customerService.list() - println(customers) - customers.data().forEach { it.validate() } + + val page = customerService.list() + + page.response().validate() } @Test - fun callDelete() { + fun delete() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + customerService.delete(CustomerDeleteParams.builder().customerId("customer_id").build()) } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + val customer = customerService.fetch(CustomerFetchParams.builder().customerId("customer_id").build()) - println(customer) + customer.validate() } @Test - fun callFetchByExternalId() { + fun fetchByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + val customer = customerService.fetchByExternalId( CustomerFetchByExternalIdParams.builder() .externalCustomerId("external_customer_id") .build() ) - println(customer) + customer.validate() } @Test - fun callSyncPaymentMethodsFromGateway() { + fun syncPaymentMethodsFromGateway() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + customerService.syncPaymentMethodsFromGateway( CustomerSyncPaymentMethodsFromGatewayParams.builder() .externalCustomerId("external_customer_id") @@ -273,13 +280,14 @@ class CustomerServiceTest { } @Test - fun callSyncPaymentMethodsFromGatewayByExternalCustomerId() { + fun syncPaymentMethodsFromGatewayByExternalCustomerId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + customerService.syncPaymentMethodsFromGatewayByExternalCustomerId( CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() .customerId("customer_id") @@ -288,13 +296,14 @@ class CustomerServiceTest { } @Test - fun callUpdateByExternalId() { + fun updateByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val customerService = client.customers() + val customer = customerService.updateByExternalId( CustomerUpdateByExternalIdParams.builder() @@ -379,7 +388,7 @@ class CustomerServiceTest { ) .build() ) - println(customer) + customer.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt index bb536ee9..bbd7ea61 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/DimensionalPriceGroupServiceTest.kt @@ -14,13 +14,14 @@ import org.junit.jupiter.api.extension.ExtendWith class DimensionalPriceGroupServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val dimensionalPriceGroupService = client.dimensionalPriceGroups() + val dimensionalPriceGroup = dimensionalPriceGroupService.create( DimensionalPriceGroupCreateParams.builder() @@ -36,38 +37,40 @@ class DimensionalPriceGroupServiceTest { ) .build() ) - println(dimensionalPriceGroup) + dimensionalPriceGroup.validate() } @Test - fun callRetrieve() { + fun retrieve() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val dimensionalPriceGroupService = client.dimensionalPriceGroups() + val dimensionalPriceGroup = dimensionalPriceGroupService.retrieve( DimensionalPriceGroupRetrieveParams.builder() .dimensionalPriceGroupId("dimensional_price_group_id") .build() ) - println(dimensionalPriceGroup) + dimensionalPriceGroup.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val dimensionalPriceGroupService = client.dimensionalPriceGroups() - val dimensionalPriceGroups = dimensionalPriceGroupService.list() - println(dimensionalPriceGroups) - dimensionalPriceGroups.data().forEach { it.validate() } + + val page = dimensionalPriceGroupService.list() + + page.response().validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt index a6808468..112c55ef 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/EventServiceTest.kt @@ -17,14 +17,15 @@ import org.junit.jupiter.api.extension.ExtendWith class EventServiceTest { @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val eventService = client.events() - val eventUpdateResponse = + + val event = eventService.update( EventUpdateParams.builder() .eventId("event_id") @@ -35,33 +36,35 @@ class EventServiceTest { .externalCustomerId("external_customer_id") .build() ) - println(eventUpdateResponse) - eventUpdateResponse.validate() + + event.validate() } @Test - fun callDeprecate() { + fun deprecate() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val eventService = client.events() - val eventDeprecateResponse = + + val response = eventService.deprecate(EventDeprecateParams.builder().eventId("event_id").build()) - println(eventDeprecateResponse) - eventDeprecateResponse.validate() + + response.validate() } @Test - fun callIngest() { + fun ingest() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val eventService = client.events() - val eventIngestResponse = + + val response = eventService.ingest( EventIngestParams.builder() .backfillId("backfill_id") @@ -78,19 +81,20 @@ class EventServiceTest { ) .build() ) - println(eventIngestResponse) - eventIngestResponse.validate() + + response.validate() } @Test - fun callSearch() { + fun search() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val eventService = client.events() - val eventSearchResponse = + + val response = eventService.search( EventSearchParams.builder() .addEventId("string") @@ -98,7 +102,7 @@ class EventServiceTest { .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - println(eventSearchResponse) - eventSearchResponse.validate() + + response.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceTest.kt index a4b36b6e..64b708c8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class InvoiceLineItemServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceLineItemService = client.invoiceLineItems() - val invoiceLineItemCreateResponse = + + val invoiceLineItem = invoiceLineItemService.create( InvoiceLineItemCreateParams.builder() .amount("12.00") @@ -31,7 +32,7 @@ class InvoiceLineItemServiceTest { .startDate(LocalDate.parse("2023-09-22")) .build() ) - println(invoiceLineItemCreateResponse) - invoiceLineItemCreateResponse.validate() + + invoiceLineItem.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt index a80c2e7e..3b10a43b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/InvoiceServiceTest.kt @@ -23,13 +23,14 @@ import org.junit.jupiter.api.extension.ExtendWith class InvoiceServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.create( InvoiceCreateParams.builder() @@ -71,18 +72,19 @@ class InvoiceServiceTest { .willAutoIssue(false) .build() ) - println(invoice) + invoice.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.update( InvoiceUpdateParams.builder() @@ -94,77 +96,82 @@ class InvoiceServiceTest { ) .build() ) - println(invoice) + invoice.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() - val invoices = invoiceService.list() - println(invoices) - invoices.data().forEach { it.validate() } + + val page = invoiceService.list() + + page.response().validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.fetch(InvoiceFetchParams.builder().invoiceId("invoice_id").build()) - println(invoice) + invoice.validate() } @Test - fun callFetchUpcoming() { + fun fetchUpcoming() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() - val invoiceFetchUpcomingResponse = + + val response = invoiceService.fetchUpcoming( InvoiceFetchUpcomingParams.builder().subscriptionId("subscription_id").build() ) - println(invoiceFetchUpcomingResponse) - invoiceFetchUpcomingResponse.validate() + + response.validate() } @Test - fun callIssue() { + fun issue() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.issue( InvoiceIssueParams.builder().invoiceId("invoice_id").synchronous(true).build() ) - println(invoice) + invoice.validate() } @Test - fun callMarkPaid() { + fun markPaid() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.markPaid( InvoiceMarkPaidParams.builder() @@ -174,36 +181,38 @@ class InvoiceServiceTest { .notes("notes") .build() ) - println(invoice) + invoice.validate() } @Test - fun callPay() { + fun pay() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.pay(InvoicePayParams.builder().invoiceId("invoice_id").build()) - println(invoice) + invoice.validate() } @Test - fun callVoidInvoice() { + fun voidInvoice() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val invoiceService = client.invoices() + val invoice = invoiceService.voidInvoice( InvoiceVoidInvoiceParams.builder().invoiceId("invoice_id").build() ) - println(invoice) + invoice.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt index deb3f629..3fa73e7c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/ItemServiceTest.kt @@ -14,26 +14,28 @@ import org.junit.jupiter.api.extension.ExtendWith class ItemServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val itemService = client.items() + val item = itemService.create(ItemCreateParams.builder().name("API requests").build()) - println(item) + item.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val itemService = client.items() + val item = itemService.update( ItemUpdateParams.builder() @@ -49,33 +51,35 @@ class ItemServiceTest { .name("name") .build() ) - println(item) + item.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val itemService = client.items() - val items = itemService.list() - println(items) - items.data().forEach { it.validate() } + + val page = itemService.list() + + page.response().validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val itemService = client.items() + val item = itemService.fetch(ItemFetchParams.builder().itemId("item_id").build()) - println(item) + item.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt index 5a06a034..d8c00329 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/MetricServiceTest.kt @@ -15,13 +15,14 @@ import org.junit.jupiter.api.extension.ExtendWith class MetricServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val metricService = client.metrics() + val billableMetric = metricService.create( MetricCreateParams.builder() @@ -36,18 +37,19 @@ class MetricServiceTest { ) .build() ) - println(billableMetric) + billableMetric.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val metricService = client.metrics() + val billableMetric = metricService.update( MetricUpdateParams.builder() @@ -59,34 +61,36 @@ class MetricServiceTest { ) .build() ) - println(billableMetric) + billableMetric.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val metricService = client.metrics() - val billableMetrics = metricService.list() - println(billableMetrics) - billableMetrics.data().forEach { it.validate() } + + val page = metricService.list() + + page.response().validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val metricService = client.metrics() + val billableMetric = metricService.fetch(MetricFetchParams.builder().metricId("metric_id").build()) - println(billableMetric) + billableMetric.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt index c4e8176f..bcf1edd8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt @@ -15,13 +15,14 @@ import org.junit.jupiter.api.extension.ExtendWith class PlanServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val planService = client.plans() + val plan = planService.create( PlanCreateParams.builder() @@ -87,18 +88,19 @@ class PlanServiceTest { .status(PlanCreateParams.Status.ACTIVE) .build() ) - println(plan) + plan.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val planService = client.plans() + val plan = planService.update( PlanUpdateParams.builder() @@ -111,33 +113,35 @@ class PlanServiceTest { ) .build() ) - println(plan) + plan.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val planService = client.plans() - val plans = planService.list() - println(plans) - plans.data().forEach { it.validate() } + + val page = planService.list() + + page.response().validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val planService = client.plans() + val plan = planService.fetch(PlanFetchParams.builder().planId("plan_id").build()) - println(plan) + plan.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt index 66c2f30c..b427e23f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt @@ -17,13 +17,14 @@ import org.junit.jupiter.api.extension.ExtendWith class PriceServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val priceService = client.prices() + val price = priceService.create( PriceCreateParams.builder() @@ -80,17 +81,19 @@ class PriceServiceTest { ) .build() ) - println(price) + + price.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val priceService = client.prices() + val price = priceService.update( PriceUpdateParams.builder() @@ -102,31 +105,34 @@ class PriceServiceTest { ) .build() ) - println(price) + + price.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val priceService = client.prices() - val prices = priceService.list() - println(prices) - prices.data().forEach { it.validate() } + + val page = priceService.list() + + page.response().validate() } @Test - fun callEvaluate() { + fun evaluate() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val priceService = client.prices() - val priceEvaluateResponse = + + val response = priceService.evaluate( PriceEvaluateParams.builder() .priceId("price_id") @@ -138,19 +144,21 @@ class PriceServiceTest { .addGroupingKey("case when my_event_type = 'foo' then true else false end") .build() ) - println(priceEvaluateResponse) - priceEvaluateResponse.validate() + + response.validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val priceService = client.prices() + val price = priceService.fetch(PriceFetchParams.builder().priceId("price_id").build()) - println(price) + + price.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt index 675d5231..e92fdc67 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionServiceTest.kt @@ -30,14 +30,15 @@ import org.junit.jupiter.api.extension.ExtendWith class SubscriptionServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionCreateResponse = + + val subscription = subscriptionService.create( SubscriptionCreateParams.builder() .addAddAdjustment( @@ -344,18 +345,19 @@ class SubscriptionServiceTest { .addUsageCustomerId("string") .build() ) - println(subscriptionCreateResponse) - subscriptionCreateResponse.validate() + + subscription.validate() } @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() + val subscription = subscriptionService.update( SubscriptionUpdateParams.builder() @@ -371,32 +373,34 @@ class SubscriptionServiceTest { .netTerms(0L) .build() ) - println(subscription) + subscription.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptions = subscriptionService.list() - println(subscriptions) - subscriptions.data().forEach { it.validate() } + + val page = subscriptionService.list() + + page.response().validate() } @Test - fun callCancel() { + fun cancel() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionCancelResponse = + + val response = subscriptionService.cancel( SubscriptionCancelParams.builder() .subscriptionId("subscription_id") @@ -405,35 +409,37 @@ class SubscriptionServiceTest { .cancellationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - println(subscriptionCancelResponse) - subscriptionCancelResponse.validate() + + response.validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() + val subscription = subscriptionService.fetch( SubscriptionFetchParams.builder().subscriptionId("subscription_id").build() ) - println(subscription) + subscription.validate() } @Test - fun callFetchCosts() { + fun fetchCosts() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionFetchCostsResponse = + + val response = subscriptionService.fetchCosts( SubscriptionFetchCostsParams.builder() .subscriptionId("subscription_id") @@ -443,35 +449,37 @@ class SubscriptionServiceTest { .viewMode(SubscriptionFetchCostsParams.ViewMode.PERIODIC) .build() ) - println(subscriptionFetchCostsResponse) - subscriptionFetchCostsResponse.validate() + + response.validate() } @Test - fun callFetchSchedule() { + fun fetchSchedule() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionScheduleItems = + + val page = subscriptionService.fetchSchedule( SubscriptionFetchScheduleParams.builder().subscriptionId("subscription_id").build() ) - println(subscriptionScheduleItems) - subscriptionScheduleItems.data().forEach { it.validate() } + + page.response().validate() } @Disabled("Incorrect example breaks Prism") @Test - fun callFetchUsage() { + fun fetchUsage() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() + val subscriptionUsage = subscriptionService.fetchUsage( SubscriptionFetchUsageParams.builder() @@ -488,19 +496,21 @@ class SubscriptionServiceTest { .viewMode(SubscriptionFetchUsageParams.ViewMode.PERIODIC) .build() ) - println(subscriptionUsage) + + subscriptionUsage.validate() } @Disabled("Incorrect example breaks Prism") @Test - fun callPriceIntervals() { + fun priceIntervals() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionPriceIntervalsResponse = + + val response = subscriptionService.priceIntervals( SubscriptionPriceIntervalsParams.builder() .subscriptionId("subscription_id") @@ -521,6 +531,7 @@ class SubscriptionServiceTest { .addAmountDiscountCreationParamsDiscount(0.0) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalPriceId("external_price_id") + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Add.FixedFeeQuantityTransition .builder() @@ -603,6 +614,7 @@ class SubscriptionServiceTest { .build() ) .priceId("h74gfhdjvn7ujokd") + .addUsageCustomerId("string") .build() ) .addAddAdjustment( @@ -633,6 +645,7 @@ class SubscriptionServiceTest { .priceIntervalId("sdfs6wdjvn7ujokd") .billingCycleDay(0L) .endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .filter("my_property > 100 AND my_other_property = 'bar'") .addFixedFeeQuantityTransition( SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition .builder() @@ -641,6 +654,7 @@ class SubscriptionServiceTest { .build() ) .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addUsageCustomerId("string") .build() ) .addEditAdjustment( @@ -652,19 +666,20 @@ class SubscriptionServiceTest { ) .build() ) - println(subscriptionPriceIntervalsResponse) - subscriptionPriceIntervalsResponse.validate() + + response.validate() } @Test - fun callSchedulePlanChange() { + fun schedulePlanChange() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionSchedulePlanChangeResponse = + + val response = subscriptionService.schedulePlanChange( SubscriptionSchedulePlanChangeParams.builder() .subscriptionId("subscription_id") @@ -979,19 +994,20 @@ class SubscriptionServiceTest { .addUsageCustomerId("string") .build() ) - println(subscriptionSchedulePlanChangeResponse) - subscriptionSchedulePlanChangeResponse.validate() + + response.validate() } @Test - fun callTriggerPhase() { + fun triggerPhase() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionTriggerPhaseResponse = + + val response = subscriptionService.triggerPhase( SubscriptionTriggerPhaseParams.builder() .subscriptionId("subscription_id") @@ -999,74 +1015,78 @@ class SubscriptionServiceTest { .effectiveDate(LocalDate.parse("2019-12-27")) .build() ) - println(subscriptionTriggerPhaseResponse) - subscriptionTriggerPhaseResponse.validate() + + response.validate() } @Test - fun callUnscheduleCancellation() { + fun unscheduleCancellation() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionUnscheduleCancellationResponse = + + val response = subscriptionService.unscheduleCancellation( SubscriptionUnscheduleCancellationParams.builder() .subscriptionId("subscription_id") .build() ) - println(subscriptionUnscheduleCancellationResponse) - subscriptionUnscheduleCancellationResponse.validate() + + response.validate() } @Test - fun callUnscheduleFixedFeeQuantityUpdates() { + fun unscheduleFixedFeeQuantityUpdates() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionUnscheduleFixedFeeQuantityUpdatesResponse = + + val response = subscriptionService.unscheduleFixedFeeQuantityUpdates( SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.builder() .subscriptionId("subscription_id") .priceId("price_id") .build() ) - println(subscriptionUnscheduleFixedFeeQuantityUpdatesResponse) - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.validate() + + response.validate() } @Test - fun callUnschedulePendingPlanChanges() { + fun unschedulePendingPlanChanges() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionUnschedulePendingPlanChangesResponse = + + val response = subscriptionService.unschedulePendingPlanChanges( SubscriptionUnschedulePendingPlanChangesParams.builder() .subscriptionId("subscription_id") .build() ) - println(subscriptionUnschedulePendingPlanChangesResponse) - subscriptionUnschedulePendingPlanChangesResponse.validate() + + response.validate() } @Test - fun callUpdateFixedFeeQuantity() { + fun updateFixedFeeQuantity() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionUpdateFixedFeeQuantityResponse = + + val response = subscriptionService.updateFixedFeeQuantity( SubscriptionUpdateFixedFeeQuantityParams.builder() .subscriptionId("subscription_id") @@ -1077,19 +1097,20 @@ class SubscriptionServiceTest { .effectiveDate(LocalDate.parse("2022-12-21")) .build() ) - println(subscriptionUpdateFixedFeeQuantityResponse) - subscriptionUpdateFixedFeeQuantityResponse.validate() + + response.validate() } @Test - fun callUpdateTrial() { + fun updateTrial() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.subscriptions() - val subscriptionUpdateTrialResponse = + + val response = subscriptionService.updateTrial( SubscriptionUpdateTrialParams.builder() .subscriptionId("subscription_id") @@ -1097,7 +1118,7 @@ class SubscriptionServiceTest { .shift(true) .build() ) - println(subscriptionUpdateTrialResponse) - subscriptionUpdateTrialResponse.validate() + + response.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/TopLevelServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/TopLevelServiceTest.kt index 2ffec4b7..88901529 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/TopLevelServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/TopLevelServiceTest.kt @@ -11,15 +11,16 @@ import org.junit.jupiter.api.extension.ExtendWith class TopLevelServiceTest { @Test - fun callPing() { + fun ping() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topLevelService = client.topLevel() - val topLevelPingResponse = topLevelService.ping() - println(topLevelPingResponse) - topLevelPingResponse.validate() + + val response = topLevelService.ping() + + response.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt index aba9b282..7dc8a1d9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/coupons/SubscriptionServiceTest.kt @@ -12,18 +12,19 @@ import org.junit.jupiter.api.extension.ExtendWith class SubscriptionServiceTest { @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val subscriptionService = client.coupons().subscriptions() - val subscriptions = + + val page = subscriptionService.list( CouponSubscriptionListParams.builder().couponId("coupon_id").build() ) - println(subscriptions) - subscriptions.data().forEach { it.validate() } + + page.response().validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt index 81ef234e..370c31f5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/BalanceTransactionServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class BalanceTransactionServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val balanceTransactionService = client.customers().balanceTransactions() - val customerBalanceTransactionCreateResponse = + + val balanceTransaction = balanceTransactionService.create( CustomerBalanceTransactionCreateParams.builder() .customerId("customer_id") @@ -29,23 +30,24 @@ class BalanceTransactionServiceTest { .description("description") .build() ) - println(customerBalanceTransactionCreateResponse) - customerBalanceTransactionCreateResponse.validate() + + balanceTransaction.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val balanceTransactionService = client.customers().balanceTransactions() - val customerBalanceTransactions = + + val page = balanceTransactionService.list( CustomerBalanceTransactionListParams.builder().customerId("customer_id").build() ) - println(customerBalanceTransactions) - customerBalanceTransactions.data().forEach { it.validate() } + + page.response().validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt index 271bcfae..e37f3888 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CostServiceTest.kt @@ -14,14 +14,15 @@ import org.junit.jupiter.api.extension.ExtendWith class CostServiceTest { @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val costService = client.customers().costs() - val customerCostListResponse = + + val cost = costService.list( CustomerCostListParams.builder() .customerId("customer_id") @@ -31,19 +32,20 @@ class CostServiceTest { .viewMode(CustomerCostListParams.ViewMode.PERIODIC) .build() ) - println(customerCostListResponse) - customerCostListResponse.validate() + + cost.validate() } @Test - fun callListByExternalId() { + fun listByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val costService = client.customers().costs() - val customerCostListByExternalIdResponse = + + val response = costService.listByExternalId( CustomerCostListByExternalIdParams.builder() .externalCustomerId("external_customer_id") @@ -53,7 +55,7 @@ class CostServiceTest { .viewMode(CustomerCostListByExternalIdParams.ViewMode.PERIODIC) .build() ) - println(customerCostListByExternalIdResponse) - customerCostListByExternalIdResponse.validate() + + response.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt index e782bef8..7e842888 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/CreditServiceTest.kt @@ -13,34 +13,36 @@ import org.junit.jupiter.api.extension.ExtendWith class CreditServiceTest { @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val creditService = client.customers().credits() - val customerCreditBalances = + + val page = creditService.list(CustomerCreditListParams.builder().customerId("customer_id").build()) - println(customerCreditBalances) - customerCreditBalances.data().forEach { it.validate() } + + page.response().validate() } @Test - fun callListByExternalId() { + fun listByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val creditService = client.customers().credits() - val customerCreditBalances = + + val page = creditService.listByExternalId( CustomerCreditListByExternalIdParams.builder() .externalCustomerId("external_customer_id") .build() ) - println(customerCreditBalances) - customerCreditBalances.data().forEach { it.validate() } + + page.response().validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt index 8d8e6f3d..f080078e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerServiceTest.kt @@ -17,30 +17,32 @@ import org.junit.jupiter.api.extension.ExtendWith class LedgerServiceTest { @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val ledgerService = client.customers().credits().ledger() - val creditLedgerEntries = + + val page = ledgerService.list( CustomerCreditLedgerListParams.builder().customerId("customer_id").build() ) - println(creditLedgerEntries) - creditLedgerEntries.data().forEach { it.validate() } + + page.response().validate() } @Test - fun callCreateEntry() { + fun createEntry() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val ledgerService = client.customers().credits().ledger() - val customerCreditLedgerCreateEntryResponse = + + val response = ledgerService.createEntry( CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") @@ -83,18 +85,20 @@ class LedgerServiceTest { ) .build() ) - println(customerCreditLedgerCreateEntryResponse) + + response.validate() } @Test - fun callCreateEntryByExternalId() { + fun createEntryByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val ledgerService = client.customers().credits().ledger() - val customerCreditLedgerCreateEntryByExternalIdResponse = + + val response = ledgerService.createEntryByExternalId( CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") @@ -137,24 +141,26 @@ class LedgerServiceTest { ) .build() ) - println(customerCreditLedgerCreateEntryByExternalIdResponse) + + response.validate() } @Test - fun callListByExternalId() { + fun listByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val ledgerService = client.customers().credits().ledger() - val creditLedgerEntries = + + val page = ledgerService.listByExternalId( CustomerCreditLedgerListByExternalIdParams.builder() .externalCustomerId("external_customer_id") .build() ) - println(creditLedgerEntries) - creditLedgerEntries.data().forEach { it.validate() } + + page.response().validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt index 03e27239..4d8b5f8a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/customers/credits/TopUpServiceTest.kt @@ -18,14 +18,15 @@ import org.junit.jupiter.api.extension.ExtendWith class TopUpServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topUpService = client.customers().credits().topUps() - val customerCreditTopUpCreateResponse = + + val topUp = topUpService.create( CustomerCreditTopUpCreateParams.builder() .customerId("customer_id") @@ -46,34 +47,36 @@ class TopUpServiceTest { .expiresAfterUnit(CustomerCreditTopUpCreateParams.ExpiresAfterUnit.DAY) .build() ) - println(customerCreditTopUpCreateResponse) - customerCreditTopUpCreateResponse.validate() + + topUp.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topUpService = client.customers().credits().topUps() - val topUps = + + val page = topUpService.list( CustomerCreditTopUpListParams.builder().customerId("customer_id").build() ) - println(topUps) - topUps.data().forEach { it.validate() } + + page.response().validate() } @Test - fun callDelete() { + fun delete() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topUpService = client.customers().credits().topUps() + topUpService.delete( CustomerCreditTopUpDeleteParams.builder() .customerId("customer_id") @@ -83,14 +86,15 @@ class TopUpServiceTest { } @Test - fun callCreateByExternalId() { + fun createByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topUpService = client.customers().credits().topUps() - val customerCreditTopUpCreateByExternalIdResponse = + + val response = topUpService.createByExternalId( CustomerCreditTopUpCreateByExternalIdParams.builder() .externalCustomerId("external_customer_id") @@ -113,18 +117,19 @@ class TopUpServiceTest { ) .build() ) - println(customerCreditTopUpCreateByExternalIdResponse) - customerCreditTopUpCreateByExternalIdResponse.validate() + + response.validate() } @Test - fun callDeleteByExternalId() { + fun deleteByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topUpService = client.customers().credits().topUps() + topUpService.deleteByExternalId( CustomerCreditTopUpDeleteByExternalIdParams.builder() .externalCustomerId("external_customer_id") @@ -134,20 +139,21 @@ class TopUpServiceTest { } @Test - fun callListByExternalId() { + fun listByExternalId() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val topUpService = client.customers().credits().topUps() - val topUps = + + val page = topUpService.listByExternalId( CustomerCreditTopUpListByExternalIdParams.builder() .externalCustomerId("external_customer_id") .build() ) - println(topUps) - topUps.data().forEach { it.validate() } + + page.response().validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt index 98bc816c..07c512bb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/dimensionalPriceGroups/ExternalDimensionalPriceGroupIdServiceTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith class ExternalDimensionalPriceGroupIdServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) @@ -20,13 +20,14 @@ class ExternalDimensionalPriceGroupIdServiceTest { .build() val externalDimensionalPriceGroupIdService = client.dimensionalPriceGroups().externalDimensionalPriceGroupId() + val dimensionalPriceGroup = externalDimensionalPriceGroupIdService.retrieve( DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams.builder() .externalDimensionalPriceGroupId("external_dimensional_price_group_id") .build() ) - println(dimensionalPriceGroup) + dimensionalPriceGroup.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt index c8aae5d0..89c6695c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/BackfillServiceTest.kt @@ -16,14 +16,15 @@ import org.junit.jupiter.api.extension.ExtendWith class BackfillServiceTest { @Test - fun callCreate() { + fun create() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val backfillService = client.events().backfills() - val eventBackfillCreateResponse = + + val backfill = backfillService.create( EventBackfillCreateParams.builder() .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -35,68 +36,72 @@ class BackfillServiceTest { .replaceExistingEvents(true) .build() ) - println(eventBackfillCreateResponse) - eventBackfillCreateResponse.validate() + + backfill.validate() } @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val backfillService = client.events().backfills() - val backfills = backfillService.list() - println(backfills) - backfills.data().forEach { it.validate() } + + val page = backfillService.list() + + page.response().validate() } @Test - fun callClose() { + fun close() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val backfillService = client.events().backfills() - val eventBackfillCloseResponse = + + val response = backfillService.close( EventBackfillCloseParams.builder().backfillId("backfill_id").build() ) - println(eventBackfillCloseResponse) - eventBackfillCloseResponse.validate() + + response.validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val backfillService = client.events().backfills() - val eventBackfillFetchResponse = + + val response = backfillService.fetch( EventBackfillFetchParams.builder().backfillId("backfill_id").build() ) - println(eventBackfillFetchResponse) - eventBackfillFetchResponse.validate() + + response.validate() } @Test - fun callRevert() { + fun revert() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val backfillService = client.events().backfills() - val eventBackfillRevertResponse = + + val response = backfillService.revert( EventBackfillRevertParams.builder().backfillId("backfill_id").build() ) - println(eventBackfillRevertResponse) - eventBackfillRevertResponse.validate() + + response.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/VolumeServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/VolumeServiceTest.kt index dc76297a..acfe0c20 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/VolumeServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/events/VolumeServiceTest.kt @@ -13,13 +13,14 @@ import org.junit.jupiter.api.extension.ExtendWith class VolumeServiceTest { @Test - fun callList() { + fun list() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val volumeService = client.events().volume() + val eventVolumes = volumeService.list( EventVolumeListParams.builder() @@ -29,7 +30,7 @@ class VolumeServiceTest { .timeframeEnd(OffsetDateTime.parse("2024-10-11T06:00:00Z")) .build() ) - println(eventVolumes) + eventVolumes.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt index e61b5770..af4affdd 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/plans/ExternalPlanIdServiceTest.kt @@ -14,13 +14,14 @@ import org.junit.jupiter.api.extension.ExtendWith class ExternalPlanIdServiceTest { @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val externalPlanIdService = client.plans().externalPlanId() + val plan = externalPlanIdService.update( PlanExternalPlanIdUpdateParams.builder() @@ -33,23 +34,24 @@ class ExternalPlanIdServiceTest { ) .build() ) - println(plan) + plan.validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val externalPlanIdService = client.plans().externalPlanId() + val plan = externalPlanIdService.fetch( PlanExternalPlanIdFetchParams.builder().externalPlanId("external_plan_id").build() ) - println(plan) + plan.validate() } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt index fdf3a480..19947009 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/prices/ExternalPriceIdServiceTest.kt @@ -14,13 +14,14 @@ import org.junit.jupiter.api.extension.ExtendWith class ExternalPriceIdServiceTest { @Test - fun callUpdate() { + fun update() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val externalPriceIdService = client.prices().externalPriceId() + val price = externalPriceIdService.update( PriceExternalPriceIdUpdateParams.builder() @@ -32,23 +33,26 @@ class ExternalPriceIdServiceTest { ) .build() ) - println(price) + + price.validate() } @Test - fun callFetch() { + fun fetch() { val client = OrbOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() val externalPriceIdService = client.prices().externalPriceId() + val price = externalPriceIdService.fetch( PriceExternalPriceIdFetchParams.builder() .externalPriceId("external_price_id") .build() ) - println(price) + + price.validate() } }