diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93f2c0fea..51177e063 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/orb-java' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eb4e0dba7..caf148712 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.11.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 666bff36b..a6cf36af7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 126 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c131de17773b450eb1ec03ca001f94d3777e35347234869a7efee083003e1513.yml -openapi_spec_hash: 5d2d4a3a9ada1c381efb318b6897994d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-931771ff4ab183044ee50ce43ea794ac0a15bfafbaf7df61ac0344af3ff08944.yml +openapi_spec_hash: 71371804e373f662585284bf5d93cc62 config_hash: bcf82bddb691f6be773ac6cae8c03b9a diff --git a/CHANGELOG.md b/CHANGELOG.md index 2985ce5a0..453a18b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 1.11.0 (2026-02-06) + +Full Changelog: [v1.10.0...v1.11.0](https://github.com/orbcorp/orb-java/compare/v1.10.0...v1.11.0) + +### Features + +* **api:** api update ([49d56e2](https://github.com/orbcorp/orb-java/commit/49d56e2d1ef966ebf6ad4508c81b43a19e7cf9c5)) +* **api:** api update ([1e5f897](https://github.com/orbcorp/orb-java/commit/1e5f8972d4dd8c4c955e8980b0c83901a2594bd6)) +* **api:** api update ([eaca79d](https://github.com/orbcorp/orb-java/commit/eaca79da23a8cad0430abcb0319c8a37a5bbfc2a)) +* **client:** send `X-Stainless-Kotlin-Version` header ([10357a9](https://github.com/orbcorp/orb-java/commit/10357a946d98ffd0cb26409f81af477b4c4638b2)) + + +### Bug Fixes + +* **client:** preserve time zone in lenient date-time parsing ([928bfae](https://github.com/orbcorp/orb-java/commit/928bfae14d9e8353f052404bf80873f1bd60d167)) + + +### Chores + +* **ci:** upgrade `actions/github-script` ([7850067](https://github.com/orbcorp/orb-java/commit/7850067ac12719de79ff00ada02962f035782791)) +* **internal:** allow passing args to `./scripts/test` ([ffbc747](https://github.com/orbcorp/orb-java/commit/ffbc7473823b4ea0ccd27b9cfb85f8a5c165bb47)) +* **internal:** codegen related update ([b8b2251](https://github.com/orbcorp/orb-java/commit/b8b2251ef940a4d3a5276a9287bfc628fcc7fa2b)) +* **internal:** codegen related update ([46abca4](https://github.com/orbcorp/orb-java/commit/46abca478b99884a07ac874f56f5ab7f615d9162)) +* **internal:** correct cache invalidation for `SKIP_MOCK_TESTS` ([4a49c05](https://github.com/orbcorp/orb-java/commit/4a49c05fd112adb44adebff7481d4076ede46058)) +* **internal:** update maven repo doc to include authentication ([9aa3e27](https://github.com/orbcorp/orb-java/commit/9aa3e2745cf3794784ee229af579142c6d560182)) +* **internal:** upgrade AssertJ ([719f036](https://github.com/orbcorp/orb-java/commit/719f036e81d72bf5c80a3e53de1e6fcdee49f15e)) + + +### Documentation + +* add comment for arbitrary value fields ([e2f42d1](https://github.com/orbcorp/orb-java/commit/e2f42d1f5d5b951c50798e943a64e14ff134b4f2)) + ## 1.10.0 (2026-01-17) Full Changelog: [v1.9.0...v1.10.0](https://github.com/orbcorp/orb-java/compare/v1.9.0...v1.10.0) diff --git a/README.md b/README.md index be99484ce..441159b99 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/1.10.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/1.11.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:1.10.0") +implementation("com.withorb.api:orb-java:1.11.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:1.10.0") com.withorb.api orb-java - 1.10.0 + 1.11.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 8e1585b2b..81989492b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ allprojects { group = "com.withorb.api" - version = "1.10.0" // x-release-please-version + version = "1.11.0" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts index b908b3bed..78bb0bbc3 100644 --- a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts @@ -33,6 +33,9 @@ kotlin { tasks.withType().configureEach { systemProperty("junit.jupiter.execution.parallel.enabled", true) systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") + + // `SKIP_MOCK_TESTS` affects which tests run so it must be added as input for proper cache invalidation. + inputs.property("skipMockTests", System.getenv("SKIP_MOCK_TESTS")).optional(true) } val ktfmt by configurations.creating diff --git a/examples/.keep b/examples/.keep deleted file mode 100644 index d8c73e937..000000000 --- a/examples/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store example files demonstrating usage of this SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/orb-java-client-okhttp/build.gradle.kts b/orb-java-client-okhttp/build.gradle.kts index 856cade40..e2241172b 100644 --- a/orb-java-client-okhttp/build.gradle.kts +++ b/orb-java-client-okhttp/build.gradle.kts @@ -10,6 +10,6 @@ dependencies { implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") testImplementation(kotlin("test")) - testImplementation("org.assertj:assertj-core:3.25.3") + testImplementation("org.assertj:assertj-core:3.27.7") testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.2") } diff --git a/orb-java-core/build.gradle.kts b/orb-java-core/build.gradle.kts index 086a58f55..3ab9a87a7 100644 --- a/orb-java-core/build.gradle.kts +++ b/orb-java-core/build.gradle.kts @@ -33,7 +33,7 @@ dependencies { testImplementation(kotlin("test")) testImplementation(project(":orb-java-client-okhttp")) testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.2") - testImplementation("org.assertj:assertj-core:3.25.3") + testImplementation("org.assertj:assertj-core:3.27.7") testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3") testImplementation("org.junit-pioneer:junit-pioneer:1.9.1") diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt index cd66b87cb..1de772314 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt @@ -463,6 +463,7 @@ private constructor( headers.put("X-Stainless-Package-Version", getPackageVersion()) headers.put("X-Stainless-Runtime", "JRE") headers.put("X-Stainless-Runtime-Version", getJavaVersion()) + headers.put("X-Stainless-Kotlin-Version", KotlinVersion.CURRENT.toString()) apiKey.let { if (!it.isEmpty()) { headers.put("Authorization", "Bearer $it") diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt index 1373ca6ce..575d791e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt @@ -25,7 +25,7 @@ import java.time.DateTimeException import java.time.LocalDate import java.time.LocalDateTime import java.time.OffsetDateTime -import java.time.ZonedDateTime +import java.time.ZoneId import java.time.format.DateTimeFormatter import java.time.temporal.ChronoField @@ -157,14 +157,15 @@ private class LenientOffsetDateTimeDeserializer : val temporal = formatter.parse(p.text) return when { - !temporal.isSupported(ChronoField.HOUR_OF_DAY) -> - LocalDate.from(temporal).atStartOfDay() - !temporal.isSupported(ChronoField.OFFSET_SECONDS) -> - LocalDateTime.from(temporal) - else -> ZonedDateTime.from(temporal).toLocalDateTime() - } - .atZone(context.timeZone.toZoneId()) - .toOffsetDateTime() + !temporal.isSupported(ChronoField.HOUR_OF_DAY) -> + LocalDate.from(temporal) + .atStartOfDay() + .atZone(ZoneId.of("UTC")) + .toOffsetDateTime() + !temporal.isSupported(ChronoField.OFFSET_SECONDS) -> + LocalDateTime.from(temporal).atZone(ZoneId.of("UTC")).toOffsetDateTime() + else -> OffsetDateTime.from(temporal) + } } catch (e: DateTimeException) { exceptions.add(e) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt index f35084b4a..040e2d06a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt @@ -41,6 +41,7 @@ private constructor( private val thresholds: JsonField>, private val type: JsonField, private val balanceAlertStatus: JsonField>, + private val licenseType: JsonField, private val additionalProperties: MutableMap, ) { @@ -67,6 +68,9 @@ private constructor( @JsonProperty("balance_alert_status") @ExcludeMissing balanceAlertStatus: JsonField> = JsonMissing.of(), + @JsonProperty("license_type") + @ExcludeMissing + licenseType: JsonField = JsonMissing.of(), ) : this( id, createdAt, @@ -79,6 +83,7 @@ private constructor( thresholds, type, balanceAlertStatus, + licenseType, mutableMapOf(), ) @@ -171,6 +176,14 @@ private constructor( fun balanceAlertStatus(): Optional> = balanceAlertStatus.getOptional("balance_alert_status") + /** + * Minified license type for alert serialization. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun licenseType(): Optional = licenseType.getOptional("license_type") + /** * Returns the raw JSON value of [id]. * @@ -259,6 +272,15 @@ private constructor( @ExcludeMissing fun _balanceAlertStatus(): JsonField> = balanceAlertStatus + /** + * Returns the raw JSON value of [licenseType]. + * + * Unlike [licenseType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("license_type") + @ExcludeMissing + fun _licenseType(): JsonField = licenseType + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -307,6 +329,7 @@ private constructor( private var thresholds: JsonField>? = null private var type: JsonField? = null private var balanceAlertStatus: JsonField>? = null + private var licenseType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -322,6 +345,7 @@ private constructor( thresholds = alert.thresholds.map { it.toMutableList() } type = alert.type balanceAlertStatus = alert.balanceAlertStatus.map { it.toMutableList() } + licenseType = alert.licenseType additionalProperties = alert.additionalProperties.toMutableMap() } @@ -510,6 +534,23 @@ private constructor( } } + /** Minified license type for alert serialization. */ + fun licenseType(licenseType: LicenseType?) = licenseType(JsonField.ofNullable(licenseType)) + + /** Alias for calling [Builder.licenseType] with `licenseType.orElse(null)`. */ + fun licenseType(licenseType: Optional) = licenseType(licenseType.getOrNull()) + + /** + * Sets [Builder.licenseType] to an arbitrary JSON value. + * + * You should usually call [Builder.licenseType] with a well-typed [LicenseType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun licenseType(licenseType: JsonField) = apply { + this.licenseType = licenseType + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -563,6 +604,7 @@ private constructor( checkRequired("thresholds", thresholds).map { it.toImmutable() }, checkRequired("type", type), (balanceAlertStatus ?: JsonMissing.of()).map { it.toImmutable() }, + licenseType, additionalProperties.toMutableMap(), ) } @@ -585,6 +627,7 @@ private constructor( thresholds().ifPresent { it.forEach { it.validate() } } type().validate() balanceAlertStatus().ifPresent { it.forEach { it.validate() } } + licenseType().ifPresent { it.validate() } validated = true } @@ -613,7 +656,8 @@ private constructor( (subscription.asKnown().getOrNull()?.validity() ?: 0) + (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + - (balanceAlertStatus.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (balanceAlertStatus.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (licenseType.asKnown().getOrNull()?.validity() ?: 0) /** The metric the alert applies to. */ class Metric @@ -1089,6 +1133,9 @@ private constructor( @JvmField val COST_EXCEEDED = of("cost_exceeded") + @JvmField + val LICENSE_BALANCE_THRESHOLD_REACHED = of("license_balance_threshold_reached") + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -1099,6 +1146,7 @@ private constructor( CREDIT_BALANCE_RECOVERED, USAGE_EXCEEDED, COST_EXCEEDED, + LICENSE_BALANCE_THRESHOLD_REACHED, } /** @@ -1116,6 +1164,7 @@ private constructor( CREDIT_BALANCE_RECOVERED, USAGE_EXCEEDED, COST_EXCEEDED, + LICENSE_BALANCE_THRESHOLD_REACHED, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1134,6 +1183,7 @@ private constructor( CREDIT_BALANCE_RECOVERED -> Value.CREDIT_BALANCE_RECOVERED USAGE_EXCEEDED -> Value.USAGE_EXCEEDED COST_EXCEEDED -> Value.COST_EXCEEDED + LICENSE_BALANCE_THRESHOLD_REACHED -> Value.LICENSE_BALANCE_THRESHOLD_REACHED else -> Value._UNKNOWN } @@ -1152,6 +1202,7 @@ private constructor( CREDIT_BALANCE_RECOVERED -> Known.CREDIT_BALANCE_RECOVERED USAGE_EXCEEDED -> Known.USAGE_EXCEEDED COST_EXCEEDED -> Known.COST_EXCEEDED + LICENSE_BALANCE_THRESHOLD_REACHED -> Known.LICENSE_BALANCE_THRESHOLD_REACHED else -> throw OrbInvalidDataException("Unknown Type: $value") } @@ -1418,6 +1469,159 @@ private constructor( "BalanceAlertStatus{inAlert=$inAlert, thresholdValue=$thresholdValue, additionalProperties=$additionalProperties}" } + /** Minified license type for alert serialization. */ + class LicenseType + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of() + ) : this(id, mutableMapOf()) + + /** + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [LicenseType]. + * + * The following fields are required: + * ```java + * .id() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [LicenseType]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(licenseType: LicenseType) = apply { + id = licenseType.id + additionalProperties = licenseType.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [LicenseType]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): LicenseType = + LicenseType(checkRequired("id", id), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): LicenseType = apply { + if (validated) { + return@apply + } + + id() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LicenseType && + id == other.id && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "LicenseType{id=$id, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1435,6 +1639,7 @@ private constructor( thresholds == other.thresholds && type == other.type && balanceAlertStatus == other.balanceAlertStatus && + licenseType == other.licenseType && additionalProperties == other.additionalProperties } @@ -1451,6 +1656,7 @@ private constructor( thresholds, type, balanceAlertStatus, + licenseType, additionalProperties, ) } @@ -1458,5 +1664,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Alert{id=$id, createdAt=$createdAt, currency=$currency, customer=$customer, enabled=$enabled, metric=$metric, plan=$plan, subscription=$subscription, thresholds=$thresholds, type=$type, balanceAlertStatus=$balanceAlertStatus, additionalProperties=$additionalProperties}" + "Alert{id=$id, createdAt=$createdAt, currency=$currency, customer=$customer, enabled=$enabled, metric=$metric, plan=$plan, subscription=$subscription, thresholds=$thresholds, type=$type, balanceAlertStatus=$balanceAlertStatus, licenseType=$licenseType, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ChangedSubscriptionResources.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ChangedSubscriptionResources.kt index 6e3c85721..3f6180241 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ChangedSubscriptionResources.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ChangedSubscriptionResources.kt @@ -742,6 +742,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -790,6 +791,11 @@ private constructor( * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the * first discount in the list will be returned. If the list is empty, `None` will be * returned. + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = createdInvoice.discount().convert(MyClass.class); + * ``` */ @Deprecated("deprecated") @JsonProperty("discount") @@ -1840,6 +1846,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt index 856fcb04e..f502ea5b9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt @@ -408,6 +408,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1248,6 +1249,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt index 702f26ece..45e7624f3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt @@ -308,6 +308,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1167,6 +1168,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1752,6 +1754,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -2686,6 +2689,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt index f60e9739a..ffcbecf5d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt @@ -38,10 +38,8 @@ import kotlin.jvm.optionals.getOrNull * * As usage for a customer is reported into Orb, credits may be deducted according to the customer's * plan configuration. An automated deduction of this type will result in a ledger entry, also with - * a starting and ending balance. In order to provide better tracing capabilities for automatic - * deductions, Orb always associates each automatic deduction with the `event_id` at the time of - * ingestion, used to pinpoint _why_ credit deduction took place and to ensure that credits are - * never deducted without an associated usage event. + * a starting and ending balance. Each day's usage for a particular price, invoice, and block will + * be grouped into a single entry. * * By default, Orb uses an algorithm that automatically deducts from the *soonest expiring credit * block* first in order to ensure that all credits are utilized appropriately. As an example, if diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt index b6a021be9..b3cf8fcaf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt @@ -38,10 +38,8 @@ import kotlin.jvm.optionals.getOrNull * * As usage for a customer is reported into Orb, credits may be deducted according to the customer's * plan configuration. An automated deduction of this type will result in a ledger entry, also with - * a starting and ending balance. In order to provide better tracing capabilities for automatic - * deductions, Orb always associates each automatic deduction with the `event_id` at the time of - * ingestion, used to pinpoint _why_ credit deduction took place and to ensure that credits are - * never deducted without an associated usage event. + * a starting and ending balance. Each day's usage for a particular price, invoice, and block will + * be grouped into a single entry. * * By default, Orb uses an algorithm that automatically deducts from the *soonest expiring credit * block* first in order to ensure that all credits are utilized appropriately. As an example, if diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerTaxId.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerTaxId.kt index 09bcbb95c..fd2504cf5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerTaxId.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerTaxId.kt @@ -123,6 +123,7 @@ import kotlin.jvm.optionals.getOrNull * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1328,6 +1329,8 @@ private constructor( @JvmField val PH_TIN = of("ph_tin") + @JvmField val PL_NIP = of("pl_nip") + @JvmField val RO_TIN = of("ro_tin") @JvmField val RS_PIB = of("rs_pib") @@ -1470,6 +1473,7 @@ private constructor( OM_VAT, PE_RUC, PH_TIN, + PL_NIP, RO_TIN, RS_PIB, RU_INN, @@ -1592,6 +1596,7 @@ private constructor( OM_VAT, PE_RUC, PH_TIN, + PL_NIP, RO_TIN, RS_PIB, RU_INN, @@ -1715,6 +1720,7 @@ private constructor( OM_VAT -> Value.OM_VAT PE_RUC -> Value.PE_RUC PH_TIN -> Value.PH_TIN + PL_NIP -> Value.PL_NIP RO_TIN -> Value.RO_TIN RS_PIB -> Value.RS_PIB RU_INN -> Value.RU_INN @@ -1838,6 +1844,7 @@ private constructor( OM_VAT -> Known.OM_VAT PE_RUC -> Known.PE_RUC PH_TIN -> Known.PH_TIN + PL_NIP -> Known.PL_NIP RO_TIN -> Known.RO_TIN RS_PIB -> Known.RS_PIB RU_INN -> Known.RU_INN diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt index dec9f8ada..3949814b8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt @@ -307,6 +307,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1162,6 +1163,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1728,6 +1730,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -2642,6 +2645,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt index 971b2f8ad..218ffa321 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt @@ -308,6 +308,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1158,6 +1159,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1724,6 +1726,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -2638,6 +2641,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt index c1f6102c2..75786b486 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt @@ -403,6 +403,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -450,6 +451,11 @@ private constructor( /** * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the * first discount in the list will be returned. If the list is empty, `None` will be returned. + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = invoice.discount().convert(MyClass.class); + * ``` */ @Deprecated("deprecated") @JsonProperty("discount") @@ -1446,6 +1452,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt index c57bd6e61..80db7641e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt @@ -396,6 +396,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -443,6 +444,11 @@ private constructor( /** * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the * first discount in the list will be returned. If the list is empty, `None` will be returned. + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = invoiceFetchUpcomingResponse.discount().convert(MyClass.class); + * ``` */ @Deprecated("deprecated") @JsonProperty("discount") @@ -1440,6 +1446,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryParams.kt index 753d43e92..21a28c86c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryParams.kt @@ -8,6 +8,7 @@ import com.withorb.api.core.JsonField import com.withorb.api.core.Params import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams +import com.withorb.api.core.toImmutable import com.withorb.api.errors.OrbInvalidDataException import java.time.LocalDate import java.time.OffsetDateTime @@ -52,7 +53,7 @@ private constructor( private val invoiceDateLte: OffsetDateTime?, private val isRecurring: Boolean?, private val limit: Long?, - private val status: Status?, + private val status: List?, private val subscriptionId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -102,7 +103,7 @@ private constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) - fun status(): Optional = Optional.ofNullable(status) + fun status(): Optional> = Optional.ofNullable(status) fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) @@ -142,7 +143,7 @@ private constructor( private var invoiceDateLte: OffsetDateTime? = null private var isRecurring: Boolean? = null private var limit: Long? = null - private var status: Status? = null + private var status: MutableList? = null private var subscriptionId: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -166,7 +167,7 @@ private constructor( invoiceDateLte = invoiceListSummaryParams.invoiceDateLte isRecurring = invoiceListSummaryParams.isRecurring limit = invoiceListSummaryParams.limit - status = invoiceListSummaryParams.status + status = invoiceListSummaryParams.status?.toMutableList() subscriptionId = invoiceListSummaryParams.subscriptionId additionalHeaders = invoiceListSummaryParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceListSummaryParams.additionalQueryParams.toBuilder() @@ -299,10 +300,19 @@ private constructor( /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) - fun status(status: Status?) = apply { this.status = status } + fun status(status: List?) = apply { this.status = status?.toMutableList() } /** Alias for calling [Builder.status] with `status.orElse(null)`. */ - fun status(status: Optional) = status(status.getOrNull()) + fun status(status: Optional>) = status(status.getOrNull()) + + /** + * Adds a single [Status] to [Builder.status]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addStatus(status: Status) = apply { + this.status = (this.status ?: mutableListOf()).apply { add(status) } + } fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId } @@ -432,7 +442,7 @@ private constructor( invoiceDateLte, isRecurring, limit, - status, + status?.toImmutable(), subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), @@ -469,7 +479,7 @@ private constructor( } isRecurring?.let { put("is_recurring", it.toString()) } limit?.let { put("limit", it.toString()) } - status?.let { put("status", it.toString()) } + status?.forEach { put("status[]", it.toString()) } subscriptionId?.let { put("subscription_id", it) } putAll(additionalQueryParams) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryResponse.kt index 64ec70dca..f791ced25 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListSummaryResponse.kt @@ -355,6 +355,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | @@ -1262,6 +1263,7 @@ private constructor( * |Peru |`pe_ruc` |Peruvian RUC Number | * |Philippines |`ph_tin` |Philippines Tax Identification Number | * |Poland |`eu_vat` |European VAT Number | + * |Poland |`pl_nip` |Polish Tax ID Number | * |Portugal |`eu_vat` |European VAT Number | * |Romania |`eu_vat` |European VAT Number | * |Romania |`ro_tin` |Romanian Tax ID Number | diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt index bee830085..0c224f7f3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt @@ -54,10 +54,8 @@ interface LedgerServiceAsync { * * As usage for a customer is reported into Orb, credits may be deducted according to the * customer's plan configuration. An automated deduction of this type will result in a ledger - * entry, also with a starting and ending balance. In order to provide better tracing - * capabilities for automatic deductions, Orb always associates each automatic deduction with - * the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place - * and to ensure that credits are never deducted without an associated usage event. + * entry, also with a starting and ending balance. Each day's usage for a particular price, + * invoice, and block will be grouped into a single entry. * * By default, Orb uses an algorithm that automatically deducts from the *soonest expiring * credit block* first in order to ensure that all credits are utilized appropriately. As an @@ -415,10 +413,8 @@ interface LedgerServiceAsync { * * As usage for a customer is reported into Orb, credits may be deducted according to the * customer's plan configuration. An automated deduction of this type will result in a ledger - * entry, also with a starting and ending balance. In order to provide better tracing - * capabilities for automatic deductions, Orb always associates each automatic deduction with - * the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place - * and to ensure that credits are never deducted without an associated usage event. + * entry, also with a starting and ending balance. Each day's usage for a particular price, + * invoice, and block will be grouped into a single entry. * * By default, Orb uses an algorithm that automatically deducts from the *soonest expiring * credit block* first in order to ensure that all credits are utilized appropriately. As an diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt index c72bb7243..652b8c32e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt @@ -54,10 +54,8 @@ interface LedgerService { * * As usage for a customer is reported into Orb, credits may be deducted according to the * customer's plan configuration. An automated deduction of this type will result in a ledger - * entry, also with a starting and ending balance. In order to provide better tracing - * capabilities for automatic deductions, Orb always associates each automatic deduction with - * the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place - * and to ensure that credits are never deducted without an associated usage event. + * entry, also with a starting and ending balance. Each day's usage for a particular price, + * invoice, and block will be grouped into a single entry. * * By default, Orb uses an algorithm that automatically deducts from the *soonest expiring * credit block* first in order to ensure that all credits are utilized appropriately. As an @@ -409,10 +407,8 @@ interface LedgerService { * * As usage for a customer is reported into Orb, credits may be deducted according to the * customer's plan configuration. An automated deduction of this type will result in a ledger - * entry, also with a starting and ending balance. In order to provide better tracing - * capabilities for automatic deductions, Orb always associates each automatic deduction with - * the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place - * and to ensure that credits are never deducted without an associated usage event. + * entry, also with a starting and ending balance. Each day's usage for a particular price, + * invoice, and block will be grouped into a single entry. * * By default, Orb uses an algorithm that automatically deducts from the *soonest expiring * credit block* first in order to ensure that all credits are utilized appropriately. As an diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt index a8bc18d22..0538190b8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/ObjectMappersTest.kt @@ -3,12 +3,14 @@ package com.withorb.api.core import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.exc.MismatchedInputException import com.fasterxml.jackson.module.kotlin.readValue +import java.time.LocalDate +import java.time.LocalTime import java.time.OffsetDateTime +import java.time.ZoneOffset import kotlin.reflect.KClass import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.catchThrowable import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.EnumSource import org.junitpioneer.jupiter.cartesian.CartesianTest @@ -72,11 +74,34 @@ internal class ObjectMappersTest { } } - enum class LenientOffsetDateTimeTestCase(val string: String) { - DATE("1998-04-21"), - DATE_TIME("1998-04-21T04:00:00"), - ZONED_DATE_TIME_1("1998-04-21T04:00:00+03:00"), - ZONED_DATE_TIME_2("1998-04-21T04:00:00Z"), + enum class LenientOffsetDateTimeTestCase( + val string: String, + val expectedOffsetDateTime: OffsetDateTime, + ) { + DATE( + "1998-04-21", + expectedOffsetDateTime = + OffsetDateTime.of(LocalDate.of(1998, 4, 21), LocalTime.of(0, 0), ZoneOffset.UTC), + ), + DATE_TIME( + "1998-04-21T04:00:00", + expectedOffsetDateTime = + OffsetDateTime.of(LocalDate.of(1998, 4, 21), LocalTime.of(4, 0), ZoneOffset.UTC), + ), + ZONED_DATE_TIME_1( + "1998-04-21T04:00:00+03:00", + expectedOffsetDateTime = + OffsetDateTime.of( + LocalDate.of(1998, 4, 21), + LocalTime.of(4, 0), + ZoneOffset.ofHours(3), + ), + ), + ZONED_DATE_TIME_2( + "1998-04-21T04:00:00Z", + expectedOffsetDateTime = + OffsetDateTime.of(LocalDate.of(1998, 4, 21), LocalTime.of(4, 0), ZoneOffset.UTC), + ), } @ParameterizedTest @@ -85,6 +110,8 @@ internal class ObjectMappersTest { val jsonMapper = jsonMapper() val json = jsonMapper.writeValueAsString(testCase.string) - assertDoesNotThrow { jsonMapper().readValue(json) } + val offsetDateTime = jsonMapper().readValue(json) + + assertThat(offsetDateTime).isEqualTo(testCase.expectedOffsetDateTime) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertListPageResponseTest.kt index 8221015e9..39344d63e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertListPageResponseTest.kt @@ -44,6 +44,7 @@ internal class AlertListPageResponseTest { .thresholdValue(0.0) .build() ) + .licenseType(Alert.LicenseType.builder().id("id").build()) .build() ) .paginationMetadata( @@ -79,6 +80,7 @@ internal class AlertListPageResponseTest { .addBalanceAlertStatus( Alert.BalanceAlertStatus.builder().inAlert(true).thresholdValue(0.0).build() ) + .licenseType(Alert.LicenseType.builder().id("id").build()) .build() ) assertThat(alertListPageResponse.paginationMetadata()) @@ -120,6 +122,7 @@ internal class AlertListPageResponseTest { .thresholdValue(0.0) .build() ) + .licenseType(Alert.LicenseType.builder().id("id").build()) .build() ) .paginationMetadata( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt index 8a8fc960b..74f495bbb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt @@ -40,6 +40,7 @@ internal class AlertTest { .addBalanceAlertStatus( Alert.BalanceAlertStatus.builder().inAlert(true).thresholdValue(0.0).build() ) + .licenseType(Alert.LicenseType.builder().id("id").build()) .build() assertThat(alert.id()).isEqualTo("XuxCbt7x9L82yyeF") @@ -72,6 +73,7 @@ internal class AlertTest { .containsExactly( Alert.BalanceAlertStatus.builder().inAlert(true).thresholdValue(0.0).build() ) + assertThat(alert.licenseType()).contains(Alert.LicenseType.builder().id("id").build()) } @Test @@ -104,6 +106,7 @@ internal class AlertTest { .addBalanceAlertStatus( Alert.BalanceAlertStatus.builder().inAlert(true).thresholdValue(0.0).build() ) + .licenseType(Alert.LicenseType.builder().id("id").build()) .build() val roundtrippedAlert = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListSummaryParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListSummaryParamsTest.kt index 39891c11d..3c43002f9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListSummaryParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListSummaryParamsTest.kt @@ -30,7 +30,7 @@ internal class InvoiceListSummaryParamsTest { .invoiceDateLte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .isRecurring(true) .limit(1L) - .status(InvoiceListSummaryParams.Status.DRAFT) + .addStatus(InvoiceListSummaryParams.Status.DRAFT) .subscriptionId("subscription_id") .build() } @@ -56,7 +56,7 @@ internal class InvoiceListSummaryParamsTest { .invoiceDateLte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .isRecurring(true) .limit(1L) - .status(InvoiceListSummaryParams.Status.DRAFT) + .addStatus(InvoiceListSummaryParams.Status.DRAFT) .subscriptionId("subscription_id") .build() @@ -82,7 +82,7 @@ internal class InvoiceListSummaryParamsTest { .put("invoice_date[lte]", "2019-12-27T18:11:19.117Z") .put("is_recurring", "true") .put("limit", "1") - .put("status", "draft") + .put("status[]", "draft") .put("subscription_id", "subscription_id") .build() ) diff --git a/orb-java-example/build.gradle.kts b/orb-java-example/build.gradle.kts index 3e7cb2236..818cd7587 100644 --- a/orb-java-example/build.gradle.kts +++ b/orb-java-example/build.gradle.kts @@ -8,7 +8,8 @@ repositories { } dependencies { - implementation(project(":orb-java")) + implementation(project(":orb-java-core")) + implementation(project(":orb-java-client-okhttp")) } tasks.withType().configureEach { diff --git a/orb-java-proguard-test/build.gradle.kts b/orb-java-proguard-test/build.gradle.kts index a738f0f3e..e68c59a0b 100644 --- a/orb-java-proguard-test/build.gradle.kts +++ b/orb-java-proguard-test/build.gradle.kts @@ -18,7 +18,7 @@ dependencies { testImplementation(project(":orb-java")) testImplementation(kotlin("test")) testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") - testImplementation("org.assertj:assertj-core:3.25.3") + testImplementation("org.assertj:assertj-core:3.27.7") testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0") } diff --git a/scripts/build b/scripts/build index f40634826..16a2b00db 100755 --- a/scripts/build +++ b/scripts/build @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Building classes" -./gradlew build testClasses -x test +./gradlew build testClasses "$@" -x test diff --git a/scripts/upload-artifacts b/scripts/upload-artifacts index 548d15272..10f3c7055 100755 --- a/scripts/upload-artifacts +++ b/scripts/upload-artifacts @@ -96,8 +96,52 @@ generate_instructions() {

Stainless SDK Maven Repository

This is the Maven repository for your Stainless Java SDK build.

-

Directions

-

To use the uploaded Maven repository, add the following to your project's pom.xml:

+

Project configuration

+ +

The details depend on whether you're using Maven or Gradle as your build tool.

+ +

Maven

+ +

Add the following to your project's pom.xml:

+
<repositories>
+    <repository>
+        <id>stainless-sdk-repo</id>
+        <url>https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn</url>
+    </repository>
+</repositories>
+ +

Gradle

+

Add the following to your build.gradle file:

+
repositories {
+    maven {
+        url "https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn"
+    }
+}
+ +
+

Configuring authentication (if required)

+ +

Some accounts may require authentication to access the repository. If so, use the + following instructions, replacing YOUR_STAINLESS_API_TOKEN with your actual token.

+ +

Maven with authentication

+ +

First, ensure you have the following in your Maven settings.xml for repo authentication:

+
<servers>
+    <server>
+        <id>stainless-sdk-repo</id>
+        <configuration>
+            <httpHeaders>
+                <property>
+                    <name>Authorization</name>
+                    <value>Bearer YOUR_STAINLESS_API_TOKEN</value>
+                </property>
+            </httpHeaders>
+        </configuration>
+    </server>
+</servers>
+ +

Then, add the following to your project's pom.xml:

<repositories>
     <repository>
         <id>stainless-sdk-repo</id>
@@ -105,14 +149,24 @@ generate_instructions() {
     </repository>
 </repositories>
-

If you're using Gradle, add the following to your build.gradle file:

+

Gradle with authentication

+

Add the following to your build.gradle file:

repositories {
     maven {
-        url 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'
+        url "https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn"
+        credentials(HttpHeaderCredentials) {
+            name = "Authorization"
+            value = "Bearer YOUR_STAINLESS_API_TOKEN"
+        }
+        authentication {
+            header(HttpHeaderAuthentication)
+        }
     }
 }
+
-

Once you've added the repository, you can include dependencies from it as usual. See your +

Using the repository

+

Once you've configured the repository, you can include dependencies from it as usual. See your project README for more details.