diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 6b7b74c5..da59f99e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.0"
+ ".": "0.4.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index a0aad226..31dad448 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 115
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome/metronome-f12f505faf40d5f25d74c0b5a417e2b36c7f3f9621a0e23acd3d6ec4c615443e.yml
-openapi_spec_hash: 5c1f13896608a69feebd8855703b76df
-config_hash: 6bd82f310398d5d47bcfeb8d7ed150b3
+configured_endpoints: 116
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome/metronome-52a719b7812239e8efa99324ecfd233d2c211759de37967748b72e8f090e9ed6.yml
+openapi_spec_hash: 0052973e6013937f6fe75cad02c056d2
+config_hash: 82cceaeee1ce998c3e1aa0e082a4629e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index db36ccd4..bb057967 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,35 @@
# Changelog
+## 0.4.0 (2026-06-23)
+
+Full Changelog: [v0.3.0...v0.4.0](https://github.com/Metronome-Industries/metronome-java/compare/v0.3.0...v0.4.0)
+
+### Features
+
+* [🪿] Remove `allow-subscriptions-custom-billing-anchor` feature flag ([397ef78](https://github.com/Metronome-Industries/metronome-java/commit/397ef78e3dabd3606699d9cff3d182aa543c1159))
+* Add alert specifiers to for `low_remaining_contract_credit_and_commit_balance_reached` threshold notification creation payload ([39cbc8b](https://github.com/Metronome-Industries/metronome-java/commit/39cbc8b5794429e286a361a639681e6e40c3390b))
+* Add any_commit_and_credit_ids to override specifier fields ([46e9238](https://github.com/Metronome-Industries/metronome-java/commit/46e923808fc09864121bd3d81bbc45fd9bc67aad))
+* add getSubscriptionSeatsHistory to Node SDK ([0abdb68](https://github.com/Metronome-Industries/metronome-java/commit/0abdb689b432de9ad25b410f9ef590ef513b67a8))
+* Add notification_metadata to four API endpoints (Anthropic-only) ([9d6f8cc](https://github.com/Metronome-Industries/metronome-java/commit/9d6f8cc2505b368e02391165a8be7f364d806182))
+* added created by to commits ([c930b59](https://github.com/Metronome-Industries/metronome-java/commit/c930b592310e556dbf3b24dafc054390e2b237d2))
+* createdBy description specifies excluding system created commits ([f5ca585](https://github.com/Metronome-Industries/metronome-java/commit/f5ca585c93854409cc2c2ea9fcb96399ecfec82a))
+* daily recurrence frequency for recurring commits ([a59d59b](https://github.com/Metronome-Industries/metronome-java/commit/a59d59b8948dcf884b7e61362674aba565f53e56))
+* Docs: Update v1.yml ([47fbf41](https://github.com/Metronome-Industries/metronome-java/commit/47fbf416e9dbf1a3ca4164b5dcfb84ca830cadd5))
+* Revert "[pgs] Remove `allow-subscriptions-custom-billing-anchor` and proration rounding feature flags" ([d03dec2](https://github.com/Metronome-Industries/metronome-java/commit/d03dec261d259798d7e487304ef7ea0fcf9c1c91))
+* Revert "Revert "[pgs] Remove `allow-subscriptions-custom-billing-anchor` and proration rounding feature flags"" ([f943c66](https://github.com/Metronome-Industries/metronome-java/commit/f943c6600f55b3116242045dc853debd40498cfd))
+* skip seat IDs from balances ([940923e](https://github.com/Metronome-Industries/metronome-java/commit/940923e3267160004a17410cf9ddf4fc59b7b240))
+* Update copy ([29736d9](https://github.com/Metronome-Industries/metronome-java/commit/29736d9b3ae735221ae6b9e9a42728bf48b37eb4))
+
+
+### Chores
+
+* (internal) Add description for threshold balance specifiers fields ([c62a15d](https://github.com/Metronome-Industries/metronome-java/commit/c62a15dc3f07b0bf5a930119c5b29e410476104f))
+
+
+### Documentation
+
+* add RPS limit and batch recommendation to addRate endpoint ([a1b6cdb](https://github.com/Metronome-Industries/metronome-java/commit/a1b6cdb286db1ad27be80929f228a82ac5e2c3ba))
+
## 0.3.0 (2026-05-29)
Full Changelog: [v0.2.0...v0.3.0](https://github.com/Metronome-Industries/metronome-java/compare/v0.2.0...v0.3.0)
diff --git a/README.md b/README.md
index c574abaa..bd8cfa00 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.metronome.api/metronome-java/0.3.0)
-[](https://javadoc.io/doc/com.metronome.api/metronome-java/0.3.0)
+[](https://central.sonatype.com/artifact/com.metronome.api/metronome-java/0.4.0)
+[](https://javadoc.io/doc/com.metronome.api/metronome-java/0.4.0)
@@ -20,7 +20,7 @@ Use the Metronome MCP Server to enable AI assistants to interact with this API,
-The REST API documentation can be found on [docs.metronome.com](https://docs.metronome.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.metronome.api/metronome-java/0.3.0).
+The REST API documentation can be found on [docs.metronome.com](https://docs.metronome.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.metronome.api/metronome-java/0.4.0).
@@ -31,7 +31,7 @@ The REST API documentation can be found on [docs.metronome.com](https://docs.met
### Gradle
```kotlin
-implementation("com.metronome.api:metronome-java:0.3.0")
+implementation("com.metronome.api:metronome-java:0.4.0")
```
### Maven
@@ -40,7 +40,7 @@ implementation("com.metronome.api:metronome-java:0.3.0")
com.metronome.api
metronome-java
- 0.3.0
+ 0.4.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 38cffb59..259c3d94 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.metronome.api"
- version = "0.3.0" // x-release-please-version
+ version = "0.4.0" // x-release-please-version
}
subprojects {
diff --git a/metronome-java-core/src/main/kotlin/com/metronome/api/models/Commit.kt b/metronome-java-core/src/main/kotlin/com/metronome/api/models/Commit.kt
index b636d72d..6025cb1a 100644
--- a/metronome-java-core/src/main/kotlin/com/metronome/api/models/Commit.kt
+++ b/metronome-java-core/src/main/kotlin/com/metronome/api/models/Commit.kt
@@ -47,6 +47,7 @@ private constructor(
private val archivedAt: JsonField,
private val balance: JsonField,
private val contract: JsonField,
+ private val createdBy: JsonField,
private val customFields: JsonField,
private val description: JsonField,
private val hierarchyConfiguration: JsonField,
@@ -94,6 +95,7 @@ private constructor(
archivedAt: JsonField = JsonMissing.of(),
@JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of(),
@JsonProperty("contract") @ExcludeMissing contract: JsonField = JsonMissing.of(),
+ @JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
@JsonProperty("custom_fields")
@ExcludeMissing
customFields: JsonField = JsonMissing.of(),
@@ -153,6 +155,7 @@ private constructor(
archivedAt,
balance,
contract,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -268,6 +271,15 @@ private constructor(
*/
fun contract(): Optional = contract.getOptional("contract")
+ /**
+ * The actor who created this commit. Omitted for system-generated commits such as recurring
+ * commits, rollover commits, and threshold commits.
+ *
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun createdBy(): Optional = createdBy.getOptional("created_by")
+
/**
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
*
@@ -515,6 +527,13 @@ private constructor(
*/
@JsonProperty("contract") @ExcludeMissing fun _contract(): JsonField = contract
+ /**
+ * Returns the raw JSON value of [createdBy].
+ *
+ * Unlike [createdBy], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created_by") @ExcludeMissing fun _createdBy(): JsonField = createdBy
+
/**
* Returns the raw JSON value of [customFields].
*
@@ -717,6 +736,7 @@ private constructor(
private var archivedAt: JsonField = JsonMissing.of()
private var balance: JsonField = JsonMissing.of()
private var contract: JsonField = JsonMissing.of()
+ private var createdBy: JsonField = JsonMissing.of()
private var customFields: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
private var hierarchyConfiguration: JsonField =
@@ -752,6 +772,7 @@ private constructor(
archivedAt = commit.archivedAt
balance = commit.balance
contract = commit.contract
+ createdBy = commit.createdBy
customFields = commit.customFields
description = commit.description
hierarchyConfiguration = commit.hierarchyConfiguration
@@ -972,6 +993,21 @@ private constructor(
*/
fun contract(contract: JsonField) = apply { this.contract = contract }
+ /**
+ * The actor who created this commit. Omitted for system-generated commits such as recurring
+ * commits, rollover commits, and threshold commits.
+ */
+ fun createdBy(createdBy: String) = createdBy(JsonField.of(createdBy))
+
+ /**
+ * Sets [Builder.createdBy] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdBy] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
+
/** Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */
fun customFields(customFields: CustomFields) = customFields(JsonField.of(customFields))
@@ -1446,6 +1482,7 @@ private constructor(
archivedAt,
balance,
contract,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -1495,6 +1532,7 @@ private constructor(
archivedAt()
balance()
contract().ifPresent { it.validate() }
+ createdBy()
customFields().ifPresent { it.validate() }
description()
hierarchyConfiguration().ifPresent { it.validate() }
@@ -1543,6 +1581,7 @@ private constructor(
(if (archivedAt.asKnown().isPresent) 1 else 0) +
(if (balance.asKnown().isPresent) 1 else 0) +
(contract.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (createdBy.asKnown().isPresent) 1 else 0) +
(customFields.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(hierarchyConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
@@ -10752,6 +10791,7 @@ private constructor(
archivedAt == other.archivedAt &&
balance == other.balance &&
contract == other.contract &&
+ createdBy == other.createdBy &&
customFields == other.customFields &&
description == other.description &&
hierarchyConfiguration == other.hierarchyConfiguration &&
@@ -10787,6 +10827,7 @@ private constructor(
archivedAt,
balance,
contract,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -10812,5 +10853,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Commit{id=$id, createdAt=$createdAt, product=$product, type=$type, accessSchedule=$accessSchedule, amount=$amount, applicableContractIds=$applicableContractIds, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, archivedAt=$archivedAt, balance=$balance, contract=$contract, customFields=$customFields, description=$description, hierarchyConfiguration=$hierarchyConfiguration, invoiceContract=$invoiceContract, invoiceSchedule=$invoiceSchedule, ledger=$ledger, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, priority=$priority, rateType=$rateType, recurringCommitId=$recurringCommitId, rolledOverFrom=$rolledOverFrom, rolloverFraction=$rolloverFraction, salesforceOpportunityId=$salesforceOpportunityId, specifiers=$specifiers, spendTrackerAttributes=$spendTrackerAttributes, subscriptionConfig=$subscriptionConfig, uniquenessKey=$uniquenessKey, additionalProperties=$additionalProperties}"
+ "Commit{id=$id, createdAt=$createdAt, product=$product, type=$type, accessSchedule=$accessSchedule, amount=$amount, applicableContractIds=$applicableContractIds, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, archivedAt=$archivedAt, balance=$balance, contract=$contract, createdBy=$createdBy, customFields=$customFields, description=$description, hierarchyConfiguration=$hierarchyConfiguration, invoiceContract=$invoiceContract, invoiceSchedule=$invoiceSchedule, ledger=$ledger, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, priority=$priority, rateType=$rateType, recurringCommitId=$recurringCommitId, rolledOverFrom=$rolledOverFrom, rolloverFraction=$rolloverFraction, salesforceOpportunityId=$salesforceOpportunityId, specifiers=$specifiers, spendTrackerAttributes=$spendTrackerAttributes, subscriptionConfig=$subscriptionConfig, uniquenessKey=$uniquenessKey, additionalProperties=$additionalProperties}"
}
diff --git a/metronome-java-core/src/main/kotlin/com/metronome/api/models/ContractV2.kt b/metronome-java-core/src/main/kotlin/com/metronome/api/models/ContractV2.kt
index 1a0823e2..6ceb299f 100644
--- a/metronome-java-core/src/main/kotlin/com/metronome/api/models/ContractV2.kt
+++ b/metronome-java-core/src/main/kotlin/com/metronome/api/models/ContractV2.kt
@@ -1864,6 +1864,7 @@ private constructor(
private val archivedAt: JsonField,
private val balance: JsonField,
private val contract: JsonField,
+ private val createdBy: JsonField,
private val customFields: JsonField,
private val description: JsonField,
private val hierarchyConfiguration: JsonField,
@@ -1911,6 +1912,9 @@ private constructor(
@JsonProperty("contract")
@ExcludeMissing
contract: JsonField = JsonMissing.of(),
+ @JsonProperty("created_by")
+ @ExcludeMissing
+ createdBy: JsonField = JsonMissing.of(),
@JsonProperty("custom_fields")
@ExcludeMissing
customFields: JsonField = JsonMissing.of(),
@@ -1972,6 +1976,7 @@ private constructor(
archivedAt,
balance,
contract,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -2076,6 +2081,15 @@ private constructor(
*/
fun contract(): Optional = contract.getOptional("contract")
+ /**
+ * The actor who created this commit. Omitted for system-generated commits such as recurring
+ * commits, rollover commits, and threshold commits.
+ *
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun createdBy(): Optional = createdBy.getOptional("created_by")
+
/**
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
*
@@ -2308,6 +2322,13 @@ private constructor(
*/
@JsonProperty("contract") @ExcludeMissing fun _contract(): JsonField = contract
+ /**
+ * Returns the raw JSON value of [createdBy].
+ *
+ * Unlike [createdBy], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created_by") @ExcludeMissing fun _createdBy(): JsonField = createdBy
+
/**
* Returns the raw JSON value of [customFields].
*
@@ -2507,6 +2528,7 @@ private constructor(
private var archivedAt: JsonField = JsonMissing.of()
private var balance: JsonField = JsonMissing.of()
private var contract: JsonField = JsonMissing.of()
+ private var createdBy: JsonField = JsonMissing.of()
private var customFields: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
private var hierarchyConfiguration: JsonField =
@@ -2541,6 +2563,7 @@ private constructor(
archivedAt = commit.archivedAt
balance = commit.balance
contract = commit.contract
+ createdBy = commit.createdBy
customFields = commit.customFields
description = commit.description
hierarchyConfiguration = commit.hierarchyConfiguration
@@ -2754,6 +2777,21 @@ private constructor(
*/
fun contract(contract: JsonField) = apply { this.contract = contract }
+ /**
+ * The actor who created this commit. Omitted for system-generated commits such as
+ * recurring commits, rollover commits, and threshold commits.
+ */
+ fun createdBy(createdBy: String) = createdBy(JsonField.of(createdBy))
+
+ /**
+ * Sets [Builder.createdBy] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdBy] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
+
/** Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */
fun customFields(customFields: CustomFields) = customFields(JsonField.of(customFields))
@@ -3231,6 +3269,7 @@ private constructor(
archivedAt,
balance,
contract,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -3279,6 +3318,7 @@ private constructor(
archivedAt()
balance()
contract().ifPresent { it.validate() }
+ createdBy()
customFields().ifPresent { it.validate() }
description()
hierarchyConfiguration().ifPresent { it.validate() }
@@ -3326,6 +3366,7 @@ private constructor(
(if (archivedAt.asKnown().isPresent) 1 else 0) +
(if (balance.asKnown().isPresent) 1 else 0) +
(contract.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (createdBy.asKnown().isPresent) 1 else 0) +
(customFields.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(hierarchyConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
@@ -12189,6 +12230,7 @@ private constructor(
archivedAt == other.archivedAt &&
balance == other.balance &&
contract == other.contract &&
+ createdBy == other.createdBy &&
customFields == other.customFields &&
description == other.description &&
hierarchyConfiguration == other.hierarchyConfiguration &&
@@ -12222,6 +12264,7 @@ private constructor(
archivedAt,
balance,
contract,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -12246,7 +12289,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Commit{id=$id, createdAt=$createdAt, product=$product, type=$type, accessSchedule=$accessSchedule, applicableContractIds=$applicableContractIds, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, archivedAt=$archivedAt, balance=$balance, contract=$contract, customFields=$customFields, description=$description, hierarchyConfiguration=$hierarchyConfiguration, invoiceContract=$invoiceContract, invoiceSchedule=$invoiceSchedule, ledger=$ledger, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, priority=$priority, rateType=$rateType, recurringCommitId=$recurringCommitId, rolledOverFrom=$rolledOverFrom, rolloverFraction=$rolloverFraction, salesforceOpportunityId=$salesforceOpportunityId, specifiers=$specifiers, spendTrackerAttributes=$spendTrackerAttributes, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
+ "Commit{id=$id, createdAt=$createdAt, product=$product, type=$type, accessSchedule=$accessSchedule, applicableContractIds=$applicableContractIds, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, archivedAt=$archivedAt, balance=$balance, contract=$contract, createdBy=$createdBy, customFields=$customFields, description=$description, hierarchyConfiguration=$hierarchyConfiguration, invoiceContract=$invoiceContract, invoiceSchedule=$invoiceSchedule, ledger=$ledger, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, priority=$priority, rateType=$rateType, recurringCommitId=$recurringCommitId, rolledOverFrom=$rolledOverFrom, rolloverFraction=$rolloverFraction, salesforceOpportunityId=$salesforceOpportunityId, specifiers=$specifiers, spendTrackerAttributes=$spendTrackerAttributes, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
}
class Override
@@ -12964,6 +13007,7 @@ private constructor(
class OverrideSpecifier
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
+ private val anyCommitOrCreditIds: JsonField>,
private val billingFrequency: JsonField,
private val commitIds: JsonField>,
private val presentationGroupValues: JsonField,
@@ -12976,6 +13020,9 @@ private constructor(
@JsonCreator
private constructor(
+ @JsonProperty("any_commit_or_credit_ids")
+ @ExcludeMissing
+ anyCommitOrCreditIds: JsonField> = JsonMissing.of(),
@JsonProperty("billing_frequency")
@ExcludeMissing
billingFrequency: JsonField = JsonMissing.of(),
@@ -12998,6 +13045,7 @@ private constructor(
@ExcludeMissing
recurringCommitIds: JsonField> = JsonMissing.of(),
) : this(
+ anyCommitOrCreditIds,
billingFrequency,
commitIds,
presentationGroupValues,
@@ -13008,6 +13056,13 @@ private constructor(
mutableMapOf(),
)
+ /**
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun anyCommitOrCreditIds(): Optional> =
+ anyCommitOrCreditIds.getOptional("any_commit_or_credit_ids")
+
/**
* @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
@@ -13054,6 +13109,16 @@ private constructor(
fun recurringCommitIds(): Optional> =
recurringCommitIds.getOptional("recurring_commit_ids")
+ /**
+ * Returns the raw JSON value of [anyCommitOrCreditIds].
+ *
+ * Unlike [anyCommitOrCreditIds], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("any_commit_or_credit_ids")
+ @ExcludeMissing
+ fun _anyCommitOrCreditIds(): JsonField> = anyCommitOrCreditIds
+
/**
* Returns the raw JSON value of [billingFrequency].
*
@@ -13148,6 +13213,7 @@ private constructor(
/** A builder for [OverrideSpecifier]. */
class Builder internal constructor() {
+ private var anyCommitOrCreditIds: JsonField>? = null
private var billingFrequency: JsonField = JsonMissing.of()
private var commitIds: JsonField>? = null
private var presentationGroupValues: JsonField =
@@ -13160,6 +13226,8 @@ private constructor(
@JvmSynthetic
internal fun from(overrideSpecifier: OverrideSpecifier) = apply {
+ anyCommitOrCreditIds =
+ overrideSpecifier.anyCommitOrCreditIds.map { it.toMutableList() }
billingFrequency = overrideSpecifier.billingFrequency
commitIds = overrideSpecifier.commitIds.map { it.toMutableList() }
presentationGroupValues = overrideSpecifier.presentationGroupValues
@@ -13171,6 +13239,32 @@ private constructor(
additionalProperties = overrideSpecifier.additionalProperties.toMutableMap()
}
+ fun anyCommitOrCreditIds(anyCommitOrCreditIds: List) =
+ anyCommitOrCreditIds(JsonField.of(anyCommitOrCreditIds))
+
+ /**
+ * Sets [Builder.anyCommitOrCreditIds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.anyCommitOrCreditIds] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun anyCommitOrCreditIds(anyCommitOrCreditIds: JsonField>) = apply {
+ this.anyCommitOrCreditIds = anyCommitOrCreditIds.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [anyCommitOrCreditIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAnyCommitOrCreditId(anyCommitOrCreditId: String) = apply {
+ anyCommitOrCreditIds =
+ (anyCommitOrCreditIds ?: JsonField.of(mutableListOf())).also {
+ checkKnown("anyCommitOrCreditIds", it).add(anyCommitOrCreditId)
+ }
+ }
+
fun billingFrequency(billingFrequency: BillingFrequency) =
billingFrequency(JsonField.of(billingFrequency))
@@ -13329,6 +13423,7 @@ private constructor(
*/
fun build(): OverrideSpecifier =
OverrideSpecifier(
+ (anyCommitOrCreditIds ?: JsonMissing.of()).map { it.toImmutable() },
billingFrequency,
(commitIds ?: JsonMissing.of()).map { it.toImmutable() },
presentationGroupValues,
@@ -13357,6 +13452,7 @@ private constructor(
return@apply
}
+ anyCommitOrCreditIds()
billingFrequency().ifPresent { it.validate() }
commitIds()
presentationGroupValues().ifPresent { it.validate() }
@@ -13383,7 +13479,8 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
- (billingFrequency.asKnown().getOrNull()?.validity() ?: 0) +
+ (anyCommitOrCreditIds.asKnown().getOrNull()?.size ?: 0) +
+ (billingFrequency.asKnown().getOrNull()?.validity() ?: 0) +
(commitIds.asKnown().getOrNull()?.size ?: 0) +
(presentationGroupValues.asKnown().getOrNull()?.validity() ?: 0) +
(pricingGroupValues.asKnown().getOrNull()?.validity() ?: 0) +
@@ -13796,6 +13893,7 @@ private constructor(
}
return other is OverrideSpecifier &&
+ anyCommitOrCreditIds == other.anyCommitOrCreditIds &&
billingFrequency == other.billingFrequency &&
commitIds == other.commitIds &&
presentationGroupValues == other.presentationGroupValues &&
@@ -13808,6 +13906,7 @@ private constructor(
private val hashCode: Int by lazy {
Objects.hash(
+ anyCommitOrCreditIds,
billingFrequency,
commitIds,
presentationGroupValues,
@@ -13822,7 +13921,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "OverrideSpecifier{billingFrequency=$billingFrequency, commitIds=$commitIds, presentationGroupValues=$presentationGroupValues, pricingGroupValues=$pricingGroupValues, productId=$productId, productTags=$productTags, recurringCommitIds=$recurringCommitIds, additionalProperties=$additionalProperties}"
+ "OverrideSpecifier{anyCommitOrCreditIds=$anyCommitOrCreditIds, billingFrequency=$billingFrequency, commitIds=$commitIds, presentationGroupValues=$presentationGroupValues, pricingGroupValues=$pricingGroupValues, productId=$productId, productTags=$productTags, recurringCommitIds=$recurringCommitIds, additionalProperties=$additionalProperties}"
}
class OverwriteRate
@@ -16403,6 +16502,7 @@ private constructor(
private val balance: JsonField,
private val contract: JsonField,
private val createdAt: JsonField,
+ private val createdBy: JsonField,
private val customFields: JsonField,
private val description: JsonField,
private val hierarchyConfiguration: JsonField,
@@ -16445,6 +16545,9 @@ private constructor(
@JsonProperty("created_at")
@ExcludeMissing
createdAt: JsonField = JsonMissing.of(),
+ @JsonProperty("created_by")
+ @ExcludeMissing
+ createdBy: JsonField = JsonMissing.of(),
@JsonProperty("custom_fields")
@ExcludeMissing
customFields: JsonField = JsonMissing.of(),
@@ -16491,6 +16594,7 @@ private constructor(
balance,
contract,
createdAt,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -16589,6 +16693,15 @@ private constructor(
*/
fun createdAt(): Optional = createdAt.getOptional("created_at")
+ /**
+ * The actor who created this credit. Omitted for system-generated credits such as recurring
+ * credits.
+ *
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun createdBy(): Optional = createdBy.getOptional("created_by")
+
/**
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
*
@@ -16782,6 +16895,13 @@ private constructor(
@ExcludeMissing
fun _createdAt(): JsonField = createdAt
+ /**
+ * Returns the raw JSON value of [createdBy].
+ *
+ * Unlike [createdBy], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created_by") @ExcludeMissing fun _createdBy(): JsonField = createdBy
+
/**
* Returns the raw JSON value of [customFields].
*
@@ -16933,6 +17053,7 @@ private constructor(
private var balance: JsonField = JsonMissing.of()
private var contract: JsonField = JsonMissing.of()
private var createdAt: JsonField = JsonMissing.of()
+ private var createdBy: JsonField = JsonMissing.of()
private var customFields: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
private var hierarchyConfiguration: JsonField =
@@ -16962,6 +17083,7 @@ private constructor(
balance = credit.balance
contract = credit.contract
createdAt = credit.createdAt
+ createdBy = credit.createdBy
customFields = credit.customFields
description = credit.description
hierarchyConfiguration = credit.hierarchyConfiguration
@@ -17166,6 +17288,21 @@ private constructor(
this.createdAt = createdAt
}
+ /**
+ * The actor who created this credit. Omitted for system-generated credits such as
+ * recurring credits.
+ */
+ fun createdBy(createdBy: String) = createdBy(JsonField.of(createdBy))
+
+ /**
+ * Sets [Builder.createdBy] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdBy] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
+
/** Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */
fun customFields(customFields: CustomFields) = customFields(JsonField.of(customFields))
@@ -17482,6 +17619,7 @@ private constructor(
balance,
contract,
createdAt,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -17525,6 +17663,7 @@ private constructor(
balance()
contract().ifPresent { it.validate() }
createdAt()
+ createdBy()
customFields().ifPresent { it.validate() }
description()
hierarchyConfiguration().ifPresent { it.validate() }
@@ -17567,6 +17706,7 @@ private constructor(
(if (balance.asKnown().isPresent) 1 else 0) +
(contract.asKnown().getOrNull()?.validity() ?: 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (createdBy.asKnown().isPresent) 1 else 0) +
(customFields.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(hierarchyConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
@@ -22778,6 +22918,7 @@ private constructor(
balance == other.balance &&
contract == other.contract &&
createdAt == other.createdAt &&
+ createdBy == other.createdBy &&
customFields == other.customFields &&
description == other.description &&
hierarchyConfiguration == other.hierarchyConfiguration &&
@@ -22806,6 +22947,7 @@ private constructor(
balance,
contract,
createdAt,
+ createdBy,
customFields,
description,
hierarchyConfiguration,
@@ -22825,7 +22967,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Credit{id=$id, product=$product, type=$type, accessSchedule=$accessSchedule, applicableContractIds=$applicableContractIds, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, archivedAt=$archivedAt, balance=$balance, contract=$contract, createdAt=$createdAt, customFields=$customFields, description=$description, hierarchyConfiguration=$hierarchyConfiguration, ledger=$ledger, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, priority=$priority, recurringCreditId=$recurringCreditId, rolledOverFrom=$rolledOverFrom, salesforceOpportunityId=$salesforceOpportunityId, specifiers=$specifiers, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
+ "Credit{id=$id, product=$product, type=$type, accessSchedule=$accessSchedule, applicableContractIds=$applicableContractIds, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, archivedAt=$archivedAt, balance=$balance, contract=$contract, createdAt=$createdAt, createdBy=$createdBy, customFields=$customFields, description=$description, hierarchyConfiguration=$hierarchyConfiguration, ledger=$ledger, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, priority=$priority, recurringCreditId=$recurringCreditId, rolledOverFrom=$rolledOverFrom, salesforceOpportunityId=$salesforceOpportunityId, specifiers=$specifiers, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
}
/** Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */
@@ -25792,6 +25934,7 @@ private constructor(
private val name: JsonField,
private val netsuiteSalesOrderId: JsonField,
private val proration: JsonField,
+ private val prorationRounding: JsonField,
private val recurrenceFrequency: JsonField,
private val rolloverFraction: JsonField,
private val specifiers: JsonField>,
@@ -25846,6 +25989,9 @@ private constructor(
@JsonProperty("proration")
@ExcludeMissing
proration: JsonField = JsonMissing.of(),
+ @JsonProperty("proration_rounding")
+ @ExcludeMissing
+ prorationRounding: JsonField = JsonMissing.of(),
@JsonProperty("recurrence_frequency")
@ExcludeMissing
recurrenceFrequency: JsonField = JsonMissing.of(),
@@ -25876,6 +26022,7 @@ private constructor(
name,
netsuiteSalesOrderId,
proration,
+ prorationRounding,
recurrenceFrequency,
rolloverFraction,
specifiers,
@@ -26018,6 +26165,15 @@ private constructor(
*/
fun proration(): Optional = proration.getOptional("proration")
+ /**
+ * Rounding configuration for prorated recurring commit amounts.
+ *
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun prorationRounding(): Optional =
+ prorationRounding.getOptional("proration_rounding")
+
/**
* The frequency at which the recurring commits will be created. If not provided: - The
* commits will be created on the usage invoice frequency. If provided: - The period defined
@@ -26208,6 +26364,16 @@ private constructor(
@ExcludeMissing
fun _proration(): JsonField = proration
+ /**
+ * Returns the raw JSON value of [prorationRounding].
+ *
+ * Unlike [prorationRounding], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("proration_rounding")
+ @ExcludeMissing
+ fun _prorationRounding(): JsonField = prorationRounding
+
/**
* Returns the raw JSON value of [recurrenceFrequency].
*
@@ -26299,6 +26465,7 @@ private constructor(
private var name: JsonField = JsonMissing.of()
private var netsuiteSalesOrderId: JsonField = JsonMissing.of()
private var proration: JsonField = JsonMissing.of()
+ private var prorationRounding: JsonField = JsonMissing.of()
private var recurrenceFrequency: JsonField = JsonMissing.of()
private var rolloverFraction: JsonField = JsonMissing.of()
private var specifiers: JsonField>? = null
@@ -26327,6 +26494,7 @@ private constructor(
name = recurringCommit.name
netsuiteSalesOrderId = recurringCommit.netsuiteSalesOrderId
proration = recurringCommit.proration
+ prorationRounding = recurringCommit.prorationRounding
recurrenceFrequency = recurringCommit.recurrenceFrequency
rolloverFraction = recurringCommit.rolloverFraction
specifiers = recurringCommit.specifiers.map { it.toMutableList() }
@@ -26589,6 +26757,27 @@ private constructor(
*/
fun proration(proration: JsonField) = apply { this.proration = proration }
+ /** Rounding configuration for prorated recurring commit amounts. */
+ fun prorationRounding(prorationRounding: ProrationRounding?) =
+ prorationRounding(JsonField.ofNullable(prorationRounding))
+
+ /**
+ * Alias for calling [Builder.prorationRounding] with `prorationRounding.orElse(null)`.
+ */
+ fun prorationRounding(prorationRounding: Optional) =
+ prorationRounding(prorationRounding.getOrNull())
+
+ /**
+ * Sets [Builder.prorationRounding] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.prorationRounding] with a well-typed
+ * [ProrationRounding] value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun prorationRounding(prorationRounding: JsonField) = apply {
+ this.prorationRounding = prorationRounding
+ }
+
/**
* The frequency at which the recurring commits will be created. If not provided: - The
* commits will be created on the usage invoice frequency. If provided: - The period
@@ -26729,6 +26918,7 @@ private constructor(
name,
netsuiteSalesOrderId,
proration,
+ prorationRounding,
recurrenceFrequency,
rolloverFraction,
(specifiers ?: JsonMissing.of()).map { it.toImmutable() },
@@ -26770,6 +26960,7 @@ private constructor(
name()
netsuiteSalesOrderId()
proration().ifPresent { it.validate() }
+ prorationRounding().ifPresent { it.validate() }
recurrenceFrequency().ifPresent { it.validate() }
rolloverFraction()
specifiers().ifPresent { it.forEach { it.validate() } }
@@ -26810,6 +27001,7 @@ private constructor(
(if (name.asKnown().isPresent) 1 else 0) +
(if (netsuiteSalesOrderId.asKnown().isPresent) 1 else 0) +
(proration.asKnown().getOrNull()?.validity() ?: 0) +
+ (prorationRounding.asKnown().getOrNull()?.validity() ?: 0) +
(recurrenceFrequency.asKnown().getOrNull()?.validity() ?: 0) +
(if (rolloverFraction.asKnown().isPresent) 1 else 0) +
(specifiers.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
@@ -28341,6 +28533,978 @@ private constructor(
override fun toString() = value.toString()
}
+ /** Rounding configuration for prorated recurring commit amounts. */
+ class ProrationRounding
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val access: JsonField,
+ private val invoice: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("access")
+ @ExcludeMissing
+ access: JsonField = JsonMissing.of(),
+ @JsonProperty("invoice")
+ @ExcludeMissing
+ invoice: JsonField = JsonMissing.of(),
+ ) : this(access, invoice, mutableMapOf())
+
+ /**
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun access(): Optional = access.getOptional("access")
+
+ /**
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun invoice(): Optional = invoice.getOptional("invoice")
+
+ /**
+ * Returns the raw JSON value of [access].
+ *
+ * Unlike [access], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("access") @ExcludeMissing fun _access(): JsonField = access
+
+ /**
+ * Returns the raw JSON value of [invoice].
+ *
+ * Unlike [invoice], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("invoice") @ExcludeMissing fun _invoice(): JsonField = invoice
+
+ @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 [ProrationRounding].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ProrationRounding]. */
+ class Builder internal constructor() {
+
+ private var access: JsonField = JsonMissing.of()
+ private var invoice: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(prorationRounding: ProrationRounding) = apply {
+ access = prorationRounding.access
+ invoice = prorationRounding.invoice
+ additionalProperties = prorationRounding.additionalProperties.toMutableMap()
+ }
+
+ fun access(access: Access) = access(JsonField.of(access))
+
+ /**
+ * Sets [Builder.access] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.access] with a well-typed [Access] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun access(access: JsonField) = apply { this.access = access }
+
+ fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice))
+
+ /**
+ * Sets [Builder.invoice] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.invoice] with a well-typed [Invoice] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun invoice(invoice: JsonField) = apply { this.invoice = invoice }
+
+ 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 [ProrationRounding].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): ProrationRounding =
+ ProrationRounding(access, invoice, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): ProrationRounding = apply {
+ if (validated) {
+ return@apply
+ }
+
+ access().ifPresent { it.validate() }
+ invoice().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 =
+ (access.asKnown().getOrNull()?.validity() ?: 0) +
+ (invoice.asKnown().getOrNull()?.validity() ?: 0)
+
+ class Access
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val decimalPlaces: JsonField,
+ private val roundingMethod: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("decimal_places")
+ @ExcludeMissing
+ decimalPlaces: JsonField = JsonMissing.of(),
+ @JsonProperty("rounding_method")
+ @ExcludeMissing
+ roundingMethod: JsonField = JsonMissing.of(),
+ ) : this(decimalPlaces, roundingMethod, mutableMapOf())
+
+ /**
+ * Number of decimal places to round to. Applied directly to the stored monetary
+ * representation. Negative values round to powers of 10 (e.g., -2 rounds to nearest
+ * 100 in the stored unit).
+ *
+ * @throws MetronomeInvalidDataException 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 decimalPlaces(): Double = decimalPlaces.getRequired("decimal_places")
+
+ /**
+ * @throws MetronomeInvalidDataException 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 roundingMethod(): RoundingMethod = roundingMethod.getRequired("rounding_method")
+
+ /**
+ * Returns the raw JSON value of [decimalPlaces].
+ *
+ * Unlike [decimalPlaces], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("decimal_places")
+ @ExcludeMissing
+ fun _decimalPlaces(): JsonField = decimalPlaces
+
+ /**
+ * Returns the raw JSON value of [roundingMethod].
+ *
+ * Unlike [roundingMethod], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("rounding_method")
+ @ExcludeMissing
+ fun _roundingMethod(): JsonField = roundingMethod
+
+ @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 [Access].
+ *
+ * The following fields are required:
+ * ```java
+ * .decimalPlaces()
+ * .roundingMethod()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Access]. */
+ class Builder internal constructor() {
+
+ private var decimalPlaces: JsonField? = null
+ private var roundingMethod: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(access: Access) = apply {
+ decimalPlaces = access.decimalPlaces
+ roundingMethod = access.roundingMethod
+ additionalProperties = access.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Number of decimal places to round to. Applied directly to the stored monetary
+ * representation. Negative values round to powers of 10 (e.g., -2 rounds to
+ * nearest 100 in the stored unit).
+ */
+ fun decimalPlaces(decimalPlaces: Double) =
+ decimalPlaces(JsonField.of(decimalPlaces))
+
+ /**
+ * Sets [Builder.decimalPlaces] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.decimalPlaces] with a well-typed [Double]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun decimalPlaces(decimalPlaces: JsonField) = apply {
+ this.decimalPlaces = decimalPlaces
+ }
+
+ fun roundingMethod(roundingMethod: RoundingMethod) =
+ roundingMethod(JsonField.of(roundingMethod))
+
+ /**
+ * Sets [Builder.roundingMethod] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.roundingMethod] with a well-typed
+ * [RoundingMethod] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun roundingMethod(roundingMethod: JsonField) = apply {
+ this.roundingMethod = roundingMethod
+ }
+
+ 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 [Access].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .decimalPlaces()
+ * .roundingMethod()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Access =
+ Access(
+ checkRequired("decimalPlaces", decimalPlaces),
+ checkRequired("roundingMethod", roundingMethod),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Access = apply {
+ if (validated) {
+ return@apply
+ }
+
+ decimalPlaces()
+ roundingMethod().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 (decimalPlaces.asKnown().isPresent) 1 else 0) +
+ (roundingMethod.asKnown().getOrNull()?.validity() ?: 0)
+
+ class RoundingMethod
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue
+ fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val HALF_UP = of("HALF_UP")
+
+ @JvmField val FLOOR = of("FLOOR")
+
+ @JvmField val CEILING = of("CEILING")
+
+ @JvmStatic fun of(value: String) = RoundingMethod(JsonField.of(value))
+ }
+
+ /** An enum containing [RoundingMethod]'s known values. */
+ enum class Known {
+ HALF_UP,
+ FLOOR,
+ CEILING,
+ }
+
+ /**
+ * An enum containing [RoundingMethod]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [RoundingMethod] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For
+ * example, if the SDK is on an older version than the API, then the API may
+ * respond with new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ HALF_UP,
+ FLOOR,
+ CEILING,
+ /**
+ * An enum member indicating that [RoundingMethod] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or
+ * if you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ HALF_UP -> Value.HALF_UP
+ FLOOR -> Value.FLOOR
+ CEILING -> Value.CEILING
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known
+ * and don't want to throw for the unknown case.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value is a not
+ * a known member.
+ */
+ fun known(): Known =
+ when (this) {
+ HALF_UP -> Known.HALF_UP
+ FLOOR -> Known.FLOOR
+ CEILING -> Known.CEILING
+ else ->
+ throw MetronomeInvalidDataException(
+ "Unknown RoundingMethod: $value"
+ )
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ MetronomeInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
+ fun validate(): RoundingMethod = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RoundingMethod && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Access &&
+ decimalPlaces == other.decimalPlaces &&
+ roundingMethod == other.roundingMethod &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(decimalPlaces, roundingMethod, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Access{decimalPlaces=$decimalPlaces, roundingMethod=$roundingMethod, additionalProperties=$additionalProperties}"
+ }
+
+ class Invoice
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val decimalPlaces: JsonField,
+ private val roundingMethod: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("decimal_places")
+ @ExcludeMissing
+ decimalPlaces: JsonField = JsonMissing.of(),
+ @JsonProperty("rounding_method")
+ @ExcludeMissing
+ roundingMethod: JsonField = JsonMissing.of(),
+ ) : this(decimalPlaces, roundingMethod, mutableMapOf())
+
+ /**
+ * Number of decimal places to round to. Applied directly to the stored monetary
+ * representation. Negative values round to powers of 10 (e.g., -2 rounds to nearest
+ * 100 in the stored unit).
+ *
+ * @throws MetronomeInvalidDataException 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 decimalPlaces(): Double = decimalPlaces.getRequired("decimal_places")
+
+ /**
+ * @throws MetronomeInvalidDataException 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 roundingMethod(): RoundingMethod = roundingMethod.getRequired("rounding_method")
+
+ /**
+ * Returns the raw JSON value of [decimalPlaces].
+ *
+ * Unlike [decimalPlaces], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("decimal_places")
+ @ExcludeMissing
+ fun _decimalPlaces(): JsonField = decimalPlaces
+
+ /**
+ * Returns the raw JSON value of [roundingMethod].
+ *
+ * Unlike [roundingMethod], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("rounding_method")
+ @ExcludeMissing
+ fun _roundingMethod(): JsonField = roundingMethod
+
+ @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 [Invoice].
+ *
+ * The following fields are required:
+ * ```java
+ * .decimalPlaces()
+ * .roundingMethod()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Invoice]. */
+ class Builder internal constructor() {
+
+ private var decimalPlaces: JsonField? = null
+ private var roundingMethod: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(invoice: Invoice) = apply {
+ decimalPlaces = invoice.decimalPlaces
+ roundingMethod = invoice.roundingMethod
+ additionalProperties = invoice.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Number of decimal places to round to. Applied directly to the stored monetary
+ * representation. Negative values round to powers of 10 (e.g., -2 rounds to
+ * nearest 100 in the stored unit).
+ */
+ fun decimalPlaces(decimalPlaces: Double) =
+ decimalPlaces(JsonField.of(decimalPlaces))
+
+ /**
+ * Sets [Builder.decimalPlaces] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.decimalPlaces] with a well-typed [Double]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun decimalPlaces(decimalPlaces: JsonField) = apply {
+ this.decimalPlaces = decimalPlaces
+ }
+
+ fun roundingMethod(roundingMethod: RoundingMethod) =
+ roundingMethod(JsonField.of(roundingMethod))
+
+ /**
+ * Sets [Builder.roundingMethod] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.roundingMethod] with a well-typed
+ * [RoundingMethod] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun roundingMethod(roundingMethod: JsonField) = apply {
+ this.roundingMethod = roundingMethod
+ }
+
+ 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 [Invoice].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .decimalPlaces()
+ * .roundingMethod()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Invoice =
+ Invoice(
+ checkRequired("decimalPlaces", decimalPlaces),
+ checkRequired("roundingMethod", roundingMethod),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Invoice = apply {
+ if (validated) {
+ return@apply
+ }
+
+ decimalPlaces()
+ roundingMethod().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 (decimalPlaces.asKnown().isPresent) 1 else 0) +
+ (roundingMethod.asKnown().getOrNull()?.validity() ?: 0)
+
+ class RoundingMethod
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue
+ fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val HALF_UP = of("HALF_UP")
+
+ @JvmField val FLOOR = of("FLOOR")
+
+ @JvmField val CEILING = of("CEILING")
+
+ @JvmStatic fun of(value: String) = RoundingMethod(JsonField.of(value))
+ }
+
+ /** An enum containing [RoundingMethod]'s known values. */
+ enum class Known {
+ HALF_UP,
+ FLOOR,
+ CEILING,
+ }
+
+ /**
+ * An enum containing [RoundingMethod]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [RoundingMethod] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For
+ * example, if the SDK is on an older version than the API, then the API may
+ * respond with new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ HALF_UP,
+ FLOOR,
+ CEILING,
+ /**
+ * An enum member indicating that [RoundingMethod] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or
+ * if you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ HALF_UP -> Value.HALF_UP
+ FLOOR -> Value.FLOOR
+ CEILING -> Value.CEILING
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known
+ * and don't want to throw for the unknown case.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value is a not
+ * a known member.
+ */
+ fun known(): Known =
+ when (this) {
+ HALF_UP -> Known.HALF_UP
+ FLOOR -> Known.FLOOR
+ CEILING -> Known.CEILING
+ else ->
+ throw MetronomeInvalidDataException(
+ "Unknown RoundingMethod: $value"
+ )
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ MetronomeInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
+ fun validate(): RoundingMethod = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RoundingMethod && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Invoice &&
+ decimalPlaces == other.decimalPlaces &&
+ roundingMethod == other.roundingMethod &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(decimalPlaces, roundingMethod, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Invoice{decimalPlaces=$decimalPlaces, roundingMethod=$roundingMethod, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ProrationRounding &&
+ access == other.access &&
+ invoice == other.invoice &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(access, invoice, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ProrationRounding{access=$access, invoice=$invoice, additionalProperties=$additionalProperties}"
+ }
+
/**
* The frequency at which the recurring commits will be created. If not provided: - The
* commits will be created on the usage invoice frequency. If provided: - The period defined
@@ -28371,6 +29535,8 @@ private constructor(
@JvmField val WEEKLY = of("WEEKLY")
+ @JvmField val DAILY = of("DAILY")
+
@JvmStatic fun of(value: String) = RecurrenceFrequency(JsonField.of(value))
}
@@ -28380,6 +29546,7 @@ private constructor(
QUARTERLY,
ANNUAL,
WEEKLY,
+ DAILY,
}
/**
@@ -28398,6 +29565,7 @@ private constructor(
QUARTERLY,
ANNUAL,
WEEKLY,
+ DAILY,
/**
* An enum member indicating that [RecurrenceFrequency] was instantiated with an
* unknown value.
@@ -28418,6 +29586,7 @@ private constructor(
QUARTERLY -> Value.QUARTERLY
ANNUAL -> Value.ANNUAL
WEEKLY -> Value.WEEKLY
+ DAILY -> Value.DAILY
else -> Value._UNKNOWN
}
@@ -28436,6 +29605,7 @@ private constructor(
QUARTERLY -> Known.QUARTERLY
ANNUAL -> Known.ANNUAL
WEEKLY -> Known.WEEKLY
+ DAILY -> Known.DAILY
else ->
throw MetronomeInvalidDataException("Unknown RecurrenceFrequency: $value")
}
@@ -28527,6 +29697,7 @@ private constructor(
name == other.name &&
netsuiteSalesOrderId == other.netsuiteSalesOrderId &&
proration == other.proration &&
+ prorationRounding == other.prorationRounding &&
recurrenceFrequency == other.recurrenceFrequency &&
rolloverFraction == other.rolloverFraction &&
specifiers == other.specifiers &&
@@ -28553,6 +29724,7 @@ private constructor(
name,
netsuiteSalesOrderId,
proration,
+ prorationRounding,
recurrenceFrequency,
rolloverFraction,
specifiers,
@@ -28564,7 +29736,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "RecurringCommit{id=$id, accessAmount=$accessAmount, commitDuration=$commitDuration, priority=$priority, product=$product, rateType=$rateType, startingAt=$startingAt, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, contract=$contract, description=$description, endingBefore=$endingBefore, hierarchyConfiguration=$hierarchyConfiguration, invoiceAmount=$invoiceAmount, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, proration=$proration, recurrenceFrequency=$recurrenceFrequency, rolloverFraction=$rolloverFraction, specifiers=$specifiers, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
+ "RecurringCommit{id=$id, accessAmount=$accessAmount, commitDuration=$commitDuration, priority=$priority, product=$product, rateType=$rateType, startingAt=$startingAt, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, contract=$contract, description=$description, endingBefore=$endingBefore, hierarchyConfiguration=$hierarchyConfiguration, invoiceAmount=$invoiceAmount, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, proration=$proration, prorationRounding=$prorationRounding, recurrenceFrequency=$recurrenceFrequency, rolloverFraction=$rolloverFraction, specifiers=$specifiers, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
}
class RecurringCredit
@@ -28586,6 +29758,7 @@ private constructor(
private val name: JsonField,
private val netsuiteSalesOrderId: JsonField,
private val proration: JsonField,
+ private val prorationRounding: JsonField,
private val recurrenceFrequency: JsonField,
private val rolloverFraction: JsonField,
private val specifiers: JsonField>,
@@ -28637,6 +29810,9 @@ private constructor(
@JsonProperty("proration")
@ExcludeMissing
proration: JsonField = JsonMissing.of(),
+ @JsonProperty("proration_rounding")
+ @ExcludeMissing
+ prorationRounding: JsonField = JsonMissing.of(),
@JsonProperty("recurrence_frequency")
@ExcludeMissing
recurrenceFrequency: JsonField = JsonMissing.of(),
@@ -28666,6 +29842,7 @@ private constructor(
name,
netsuiteSalesOrderId,
proration,
+ prorationRounding,
recurrenceFrequency,
rolloverFraction,
specifiers,
@@ -28800,6 +29977,15 @@ private constructor(
*/
fun proration(): Optional = proration.getOptional("proration")
+ /**
+ * Rounding configuration for prorated recurring credit amounts.
+ *
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun prorationRounding(): Optional =
+ prorationRounding.getOptional("proration_rounding")
+
/**
* The frequency at which the recurring commits will be created. If not provided: - The
* commits will be created on the usage invoice frequency. If provided: - The period defined
@@ -28980,6 +30166,16 @@ private constructor(
@ExcludeMissing
fun _proration(): JsonField = proration
+ /**
+ * Returns the raw JSON value of [prorationRounding].
+ *
+ * Unlike [prorationRounding], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("proration_rounding")
+ @ExcludeMissing
+ fun _prorationRounding(): JsonField = prorationRounding
+
/**
* Returns the raw JSON value of [recurrenceFrequency].
*
@@ -29070,6 +30266,7 @@ private constructor(
private var name: JsonField = JsonMissing.of()
private var netsuiteSalesOrderId: JsonField = JsonMissing.of()
private var proration: JsonField = JsonMissing.of()
+ private var prorationRounding: JsonField = JsonMissing.of()
private var recurrenceFrequency: JsonField = JsonMissing.of()
private var rolloverFraction: JsonField = JsonMissing.of()
private var specifiers: JsonField>? = null
@@ -29097,6 +30294,7 @@ private constructor(
name = recurringCredit.name
netsuiteSalesOrderId = recurringCredit.netsuiteSalesOrderId
proration = recurringCredit.proration
+ prorationRounding = recurringCredit.prorationRounding
recurrenceFrequency = recurringCredit.recurrenceFrequency
rolloverFraction = recurringCredit.rolloverFraction
specifiers = recurringCredit.specifiers.map { it.toMutableList() }
@@ -29344,6 +30542,27 @@ private constructor(
*/
fun proration(proration: JsonField) = apply { this.proration = proration }
+ /** Rounding configuration for prorated recurring credit amounts. */
+ fun prorationRounding(prorationRounding: ProrationRounding?) =
+ prorationRounding(JsonField.ofNullable(prorationRounding))
+
+ /**
+ * Alias for calling [Builder.prorationRounding] with `prorationRounding.orElse(null)`.
+ */
+ fun prorationRounding(prorationRounding: Optional) =
+ prorationRounding(prorationRounding.getOrNull())
+
+ /**
+ * Sets [Builder.prorationRounding] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.prorationRounding] with a well-typed
+ * [ProrationRounding] value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun prorationRounding(prorationRounding: JsonField) = apply {
+ this.prorationRounding = prorationRounding
+ }
+
/**
* The frequency at which the recurring commits will be created. If not provided: - The
* commits will be created on the usage invoice frequency. If provided: - The period
@@ -29483,6 +30702,7 @@ private constructor(
name,
netsuiteSalesOrderId,
proration,
+ prorationRounding,
recurrenceFrequency,
rolloverFraction,
(specifiers ?: JsonMissing.of()).map { it.toImmutable() },
@@ -29523,6 +30743,7 @@ private constructor(
name()
netsuiteSalesOrderId()
proration().ifPresent { it.validate() }
+ prorationRounding().ifPresent { it.validate() }
recurrenceFrequency().ifPresent { it.validate() }
rolloverFraction()
specifiers().ifPresent { it.forEach { it.validate() } }
@@ -29562,6 +30783,7 @@ private constructor(
(if (name.asKnown().isPresent) 1 else 0) +
(if (netsuiteSalesOrderId.asKnown().isPresent) 1 else 0) +
(proration.asKnown().getOrNull()?.validity() ?: 0) +
+ (prorationRounding.asKnown().getOrNull()?.validity() ?: 0) +
(recurrenceFrequency.asKnown().getOrNull()?.validity() ?: 0) +
(if (rolloverFraction.asKnown().isPresent) 1 else 0) +
(specifiers.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
@@ -30607,19 +31829,330 @@ private constructor(
}
/**
- * Returns an immutable instance of [Contract].
+ * Returns an immutable instance of [Contract].
+ *
+ * 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(): Contract =
+ Contract(checkRequired("id", id), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): Contract = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 Contract &&
+ id == other.id &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Contract{id=$id, additionalProperties=$additionalProperties}"
+ }
+
+ /**
+ * Determines whether the first and last commit will be prorated. If not provided, the
+ * default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
+ */
+ class Proration @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val NONE = of("NONE")
+
+ @JvmField val FIRST = of("FIRST")
+
+ @JvmField val LAST = of("LAST")
+
+ @JvmField val FIRST_AND_LAST = of("FIRST_AND_LAST")
+
+ @JvmStatic fun of(value: String) = Proration(JsonField.of(value))
+ }
+
+ /** An enum containing [Proration]'s known values. */
+ enum class Known {
+ NONE,
+ FIRST,
+ LAST,
+ FIRST_AND_LAST,
+ }
+
+ /**
+ * An enum containing [Proration]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Proration] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ NONE,
+ FIRST,
+ LAST,
+ FIRST_AND_LAST,
+ /**
+ * An enum member indicating that [Proration] was instantiated with an unknown
+ * value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ NONE -> Value.NONE
+ FIRST -> Value.FIRST
+ LAST -> Value.LAST
+ FIRST_AND_LAST -> Value.FIRST_AND_LAST
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ NONE -> Known.NONE
+ FIRST -> Known.FIRST
+ LAST -> Known.LAST
+ FIRST_AND_LAST -> Known.FIRST_AND_LAST
+ else -> throw MetronomeInvalidDataException("Unknown Proration: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value does not have
+ * the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ MetronomeInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): Proration = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Proration && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** Rounding configuration for prorated recurring credit amounts. */
+ class ProrationRounding
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val access: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("access") @ExcludeMissing access: JsonField = JsonMissing.of()
+ ) : this(access, mutableMapOf())
+
+ /**
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun access(): Optional = access.getOptional("access")
+
+ /**
+ * Returns the raw JSON value of [access].
+ *
+ * Unlike [access], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("access") @ExcludeMissing fun _access(): JsonField = access
+
+ @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 [ProrationRounding].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ProrationRounding]. */
+ class Builder internal constructor() {
+
+ private var access: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(prorationRounding: ProrationRounding) = apply {
+ access = prorationRounding.access
+ additionalProperties = prorationRounding.additionalProperties.toMutableMap()
+ }
+
+ fun access(access: Access) = access(JsonField.of(access))
+
+ /**
+ * Sets [Builder.access] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.access] with a well-typed [Access] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun access(access: JsonField) = apply { this.access = access }
+
+ 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 [ProrationRounding].
*
* 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(): Contract =
- Contract(checkRequired("id", id), additionalProperties.toMutableMap())
+ fun build(): ProrationRounding =
+ ProrationRounding(access, additionalProperties.toMutableMap())
}
private var validated: Boolean = false
@@ -30634,12 +32167,12 @@ private constructor(
* @throws MetronomeInvalidDataException if any value type in this object doesn't match
* its expected type.
*/
- fun validate(): Contract = apply {
+ fun validate(): ProrationRounding = apply {
if (validated) {
return@apply
}
- id()
+ access().ifPresent { it.validate() }
validated = true
}
@@ -30657,180 +32190,414 @@ private constructor(
*
* Used for best match union deserialization.
*/
- @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+ @JvmSynthetic
+ internal fun validity(): Int = (access.asKnown().getOrNull()?.validity() ?: 0)
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
+ class Access
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val decimalPlaces: JsonField,
+ private val roundingMethod: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("decimal_places")
+ @ExcludeMissing
+ decimalPlaces: JsonField = JsonMissing.of(),
+ @JsonProperty("rounding_method")
+ @ExcludeMissing
+ roundingMethod: JsonField = JsonMissing.of(),
+ ) : this(decimalPlaces, roundingMethod, mutableMapOf())
+
+ /**
+ * Number of decimal places to round to. Applied directly to the stored monetary
+ * representation. Negative values round to powers of 10 (e.g., -2 rounds to nearest
+ * 100 in the stored unit).
+ *
+ * @throws MetronomeInvalidDataException 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 decimalPlaces(): Double = decimalPlaces.getRequired("decimal_places")
+
+ /**
+ * @throws MetronomeInvalidDataException 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 roundingMethod(): RoundingMethod = roundingMethod.getRequired("rounding_method")
+
+ /**
+ * Returns the raw JSON value of [decimalPlaces].
+ *
+ * Unlike [decimalPlaces], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("decimal_places")
+ @ExcludeMissing
+ fun _decimalPlaces(): JsonField = decimalPlaces
+
+ /**
+ * Returns the raw JSON value of [roundingMethod].
+ *
+ * Unlike [roundingMethod], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("rounding_method")
+ @ExcludeMissing
+ fun _roundingMethod(): JsonField = roundingMethod
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
}
- return other is Contract &&
- id == other.id &&
- additionalProperties == other.additionalProperties
- }
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
- private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) }
+ fun toBuilder() = Builder().from(this)
- override fun hashCode(): Int = hashCode
+ companion object {
- override fun toString() = "Contract{id=$id, additionalProperties=$additionalProperties}"
- }
+ /**
+ * Returns a mutable builder for constructing an instance of [Access].
+ *
+ * The following fields are required:
+ * ```java
+ * .decimalPlaces()
+ * .roundingMethod()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
- /**
- * Determines whether the first and last commit will be prorated. If not provided, the
- * default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
- */
- class Proration @JsonCreator private constructor(private val value: JsonField) :
- Enum {
+ /** A builder for [Access]. */
+ class Builder internal constructor() {
- /**
- * Returns this class instance's raw value.
- *
- * This is usually only useful if this instance was deserialized from data that doesn't
- * match any known member, and you want to know that value. For example, if the SDK is
- * on an older version than the API, then the API may respond with new members that the
- * SDK is unaware of.
- */
- @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+ private var decimalPlaces: JsonField? = null
+ private var roundingMethod: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
- companion object {
+ @JvmSynthetic
+ internal fun from(access: Access) = apply {
+ decimalPlaces = access.decimalPlaces
+ roundingMethod = access.roundingMethod
+ additionalProperties = access.additionalProperties.toMutableMap()
+ }
- @JvmField val NONE = of("NONE")
+ /**
+ * Number of decimal places to round to. Applied directly to the stored monetary
+ * representation. Negative values round to powers of 10 (e.g., -2 rounds to
+ * nearest 100 in the stored unit).
+ */
+ fun decimalPlaces(decimalPlaces: Double) =
+ decimalPlaces(JsonField.of(decimalPlaces))
- @JvmField val FIRST = of("FIRST")
+ /**
+ * Sets [Builder.decimalPlaces] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.decimalPlaces] with a well-typed [Double]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun decimalPlaces(decimalPlaces: JsonField) = apply {
+ this.decimalPlaces = decimalPlaces
+ }
- @JvmField val LAST = of("LAST")
+ fun roundingMethod(roundingMethod: RoundingMethod) =
+ roundingMethod(JsonField.of(roundingMethod))
- @JvmField val FIRST_AND_LAST = of("FIRST_AND_LAST")
+ /**
+ * Sets [Builder.roundingMethod] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.roundingMethod] with a well-typed
+ * [RoundingMethod] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun roundingMethod(roundingMethod: JsonField) = apply {
+ this.roundingMethod = roundingMethod
+ }
- @JvmStatic fun of(value: String) = Proration(JsonField.of(value))
- }
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
- /** An enum containing [Proration]'s known values. */
- enum class Known {
- NONE,
- FIRST,
- LAST,
- FIRST_AND_LAST,
- }
+ 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 [Access].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .decimalPlaces()
+ * .roundingMethod()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Access =
+ Access(
+ checkRequired("decimalPlaces", decimalPlaces),
+ checkRequired("roundingMethod", roundingMethod),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
- /**
- * An enum containing [Proration]'s known values, as well as an [_UNKNOWN] member.
- *
- * An instance of [Proration] can contain an unknown value in a couple of cases:
- * - It was deserialized from data that doesn't match any known member. For example, if
- * the SDK is on an older version than the API, then the API may respond with new
- * members that the SDK is unaware of.
- * - It was constructed with an arbitrary value using the [of] method.
- */
- enum class Value {
- NONE,
- FIRST,
- LAST,
- FIRST_AND_LAST,
/**
- * An enum member indicating that [Proration] was instantiated with an unknown
- * value.
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object doesn't
+ * match its expected type.
*/
- _UNKNOWN,
- }
+ fun validate(): Access = apply {
+ if (validated) {
+ return@apply
+ }
- /**
- * Returns an enum member corresponding to this class instance's value, or
- * [Value._UNKNOWN] if the class was instantiated with an unknown value.
- *
- * Use the [known] method instead if you're certain the value is always known or if you
- * want to throw for the unknown case.
- */
- fun value(): Value =
- when (this) {
- NONE -> Value.NONE
- FIRST -> Value.FIRST
- LAST -> Value.LAST
- FIRST_AND_LAST -> Value.FIRST_AND_LAST
- else -> Value._UNKNOWN
+ decimalPlaces()
+ roundingMethod().validate()
+ validated = true
}
- /**
- * Returns an enum member corresponding to this class instance's value.
- *
- * Use the [value] method instead if you're uncertain the value is always known and
- * don't want to throw for the unknown case.
- *
- * @throws MetronomeInvalidDataException if this class instance's value is a not a known
- * member.
- */
- fun known(): Known =
- when (this) {
- NONE -> Known.NONE
- FIRST -> Known.FIRST
- LAST -> Known.LAST
- FIRST_AND_LAST -> Known.FIRST_AND_LAST
- else -> throw MetronomeInvalidDataException("Unknown Proration: $value")
- }
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ false
+ }
- /**
- * Returns this class instance's primitive wire representation.
- *
- * This differs from the [toString] method because that method is primarily for
- * debugging and generally doesn't throw.
- *
- * @throws MetronomeInvalidDataException if this class instance's value does not have
- * the expected primitive type.
- */
- fun asString(): String =
- _value().asString().orElseThrow {
- MetronomeInvalidDataException("Value is not a String")
- }
+ /**
+ * 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 (decimalPlaces.asKnown().isPresent) 1 else 0) +
+ (roundingMethod.asKnown().getOrNull()?.validity() ?: 0)
- private var validated: Boolean = false
+ class RoundingMethod
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
- /**
- * Validates that the types of all values in this object match their expected types
- * recursively.
- *
- * This method is _not_ forwards compatible with new types from the API for existing
- * fields.
- *
- * @throws MetronomeInvalidDataException if any value type in this object doesn't match
- * its expected type.
- */
- fun validate(): Proration = apply {
- if (validated) {
- return@apply
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue
+ fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val HALF_UP = of("HALF_UP")
+
+ @JvmField val FLOOR = of("FLOOR")
+
+ @JvmField val CEILING = of("CEILING")
+
+ @JvmStatic fun of(value: String) = RoundingMethod(JsonField.of(value))
+ }
+
+ /** An enum containing [RoundingMethod]'s known values. */
+ enum class Known {
+ HALF_UP,
+ FLOOR,
+ CEILING,
+ }
+
+ /**
+ * An enum containing [RoundingMethod]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [RoundingMethod] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For
+ * example, if the SDK is on an older version than the API, then the API may
+ * respond with new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ HALF_UP,
+ FLOOR,
+ CEILING,
+ /**
+ * An enum member indicating that [RoundingMethod] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or
+ * if you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ HALF_UP -> Value.HALF_UP
+ FLOOR -> Value.FLOOR
+ CEILING -> Value.CEILING
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known
+ * and don't want to throw for the unknown case.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value is a not
+ * a known member.
+ */
+ fun known(): Known =
+ when (this) {
+ HALF_UP -> Known.HALF_UP
+ FLOOR -> Known.FLOOR
+ CEILING -> Known.CEILING
+ else ->
+ throw MetronomeInvalidDataException(
+ "Unknown RoundingMethod: $value"
+ )
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws MetronomeInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ MetronomeInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws MetronomeInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
+ fun validate(): RoundingMethod = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: MetronomeInvalidDataException) {
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RoundingMethod && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
}
- known()
- validated = true
- }
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: MetronomeInvalidDataException) {
- false
+ return other is Access &&
+ decimalPlaces == other.decimalPlaces &&
+ roundingMethod == other.roundingMethod &&
+ additionalProperties == other.additionalProperties
}
- /**
- * 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 (value() == Value._UNKNOWN) 0 else 1
+ private val hashCode: Int by lazy {
+ Objects.hash(decimalPlaces, roundingMethod, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Access{decimalPlaces=$decimalPlaces, roundingMethod=$roundingMethod, additionalProperties=$additionalProperties}"
+ }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
- return other is Proration && value == other.value
+ return other is ProrationRounding &&
+ access == other.access &&
+ additionalProperties == other.additionalProperties
}
- override fun hashCode() = value.hashCode()
+ private val hashCode: Int by lazy { Objects.hash(access, additionalProperties) }
- override fun toString() = value.toString()
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ProrationRounding{access=$access, additionalProperties=$additionalProperties}"
}
/**
@@ -30863,6 +32630,8 @@ private constructor(
@JvmField val WEEKLY = of("WEEKLY")
+ @JvmField val DAILY = of("DAILY")
+
@JvmStatic fun of(value: String) = RecurrenceFrequency(JsonField.of(value))
}
@@ -30872,6 +32641,7 @@ private constructor(
QUARTERLY,
ANNUAL,
WEEKLY,
+ DAILY,
}
/**
@@ -30890,6 +32660,7 @@ private constructor(
QUARTERLY,
ANNUAL,
WEEKLY,
+ DAILY,
/**
* An enum member indicating that [RecurrenceFrequency] was instantiated with an
* unknown value.
@@ -30910,6 +32681,7 @@ private constructor(
QUARTERLY -> Value.QUARTERLY
ANNUAL -> Value.ANNUAL
WEEKLY -> Value.WEEKLY
+ DAILY -> Value.DAILY
else -> Value._UNKNOWN
}
@@ -30928,6 +32700,7 @@ private constructor(
QUARTERLY -> Known.QUARTERLY
ANNUAL -> Known.ANNUAL
WEEKLY -> Known.WEEKLY
+ DAILY -> Known.DAILY
else ->
throw MetronomeInvalidDataException("Unknown RecurrenceFrequency: $value")
}
@@ -31018,6 +32791,7 @@ private constructor(
name == other.name &&
netsuiteSalesOrderId == other.netsuiteSalesOrderId &&
proration == other.proration &&
+ prorationRounding == other.prorationRounding &&
recurrenceFrequency == other.recurrenceFrequency &&
rolloverFraction == other.rolloverFraction &&
specifiers == other.specifiers &&
@@ -31043,6 +32817,7 @@ private constructor(
name,
netsuiteSalesOrderId,
proration,
+ prorationRounding,
recurrenceFrequency,
rolloverFraction,
specifiers,
@@ -31054,7 +32829,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "RecurringCredit{id=$id, accessAmount=$accessAmount, commitDuration=$commitDuration, priority=$priority, product=$product, rateType=$rateType, startingAt=$startingAt, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, contract=$contract, description=$description, endingBefore=$endingBefore, hierarchyConfiguration=$hierarchyConfiguration, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, proration=$proration, recurrenceFrequency=$recurrenceFrequency, rolloverFraction=$rolloverFraction, specifiers=$specifiers, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
+ "RecurringCredit{id=$id, accessAmount=$accessAmount, commitDuration=$commitDuration, priority=$priority, product=$product, rateType=$rateType, startingAt=$startingAt, applicableProductIds=$applicableProductIds, applicableProductTags=$applicableProductTags, contract=$contract, description=$description, endingBefore=$endingBefore, hierarchyConfiguration=$hierarchyConfiguration, name=$name, netsuiteSalesOrderId=$netsuiteSalesOrderId, proration=$proration, prorationRounding=$prorationRounding, recurrenceFrequency=$recurrenceFrequency, rolloverFraction=$rolloverFraction, specifiers=$specifiers, subscriptionConfig=$subscriptionConfig, additionalProperties=$additionalProperties}"
}
class ResellerRoyalty
@@ -33949,6 +35724,7 @@ private constructor(
private val startingAt: JsonField,
private val subscriptionRate: JsonField,
private val id: JsonField,
+ private val billingCycleConfig: JsonField,
private val customFields: JsonField,
private val description: JsonField,
private val endingBefore: JsonField,
@@ -33982,6 +35758,9 @@ private constructor(
@ExcludeMissing
subscriptionRate: JsonField = JsonMissing.of(),
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("billing_cycle_config")
+ @ExcludeMissing
+ billingCycleConfig: JsonField = JsonMissing.of(),
@JsonProperty("custom_fields")
@ExcludeMissing
customFields: JsonField = JsonMissing.of(),
@@ -34007,6 +35786,7 @@ private constructor(
startingAt,
subscriptionRate,
id,
+ billingCycleConfig,
customFields,
description,
endingBefore,
@@ -34081,6 +35861,13 @@ private constructor(
*/
fun id(): Optional = id.getOptional("id")
+ /**
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun billingCycleConfig(): Optional =
+ billingCycleConfig.getOptional("billing_cycle_config")
+
/**
* Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
*
@@ -34195,6 +35982,16 @@ private constructor(
*/
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+ /**
+ * Returns the raw JSON value of [billingCycleConfig].
+ *
+ * Unlike [billingCycleConfig], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("billing_cycle_config")
+ @ExcludeMissing
+ fun _billingCycleConfig(): JsonField = billingCycleConfig
+
/**
* Returns the raw JSON value of [customFields].
*
@@ -34292,6 +36089,7 @@ private constructor(
private var startingAt: JsonField? = null
private var subscriptionRate: JsonField? = null
private var id: JsonField = JsonMissing.of()
+ private var billingCycleConfig: JsonField = JsonMissing.of()
private var customFields: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
private var endingBefore: JsonField = JsonMissing.of()
@@ -34310,6 +36108,7 @@ private constructor(
startingAt = subscription.startingAt
subscriptionRate = subscription.subscriptionRate
id = subscription.id
+ billingCycleConfig = subscription.billingCycleConfig
customFields = subscription.customFields
description = subscription.description
endingBefore = subscription.endingBefore
@@ -34452,6 +36251,20 @@ private constructor(
*/
fun id(id: JsonField) = apply { this.id = id }
+ fun billingCycleConfig(billingCycleConfig: BillingCycleConfig) =
+ billingCycleConfig(JsonField.of(billingCycleConfig))
+
+ /**
+ * Sets [Builder.billingCycleConfig] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.billingCycleConfig] with a well-typed
+ * [BillingCycleConfig] value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun billingCycleConfig(billingCycleConfig: JsonField) = apply {
+ this.billingCycleConfig = billingCycleConfig
+ }
+
/** Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */
fun customFields(customFields: CustomFields) = customFields(JsonField.of(customFields))
@@ -34578,6 +36391,7 @@ private constructor(
checkRequired("startingAt", startingAt),
checkRequired("subscriptionRate", subscriptionRate),
id,
+ billingCycleConfig,
customFields,
description,
endingBefore,
@@ -34612,6 +36426,7 @@ private constructor(
startingAt()
subscriptionRate().validate()
id()
+ billingCycleConfig().ifPresent { it.validate() }
customFields().ifPresent { it.validate() }
description()
endingBefore()
@@ -34645,6 +36460,7 @@ private constructor(
(if (startingAt.asKnown().isPresent) 1 else 0) +
(subscriptionRate.asKnown().getOrNull()?.validity() ?: 0) +
(if (id.asKnown().isPresent) 1 else 0) +
+ (billingCycleConfig.asKnown().getOrNull()?.validity() ?: 0) +
(customFields.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (endingBefore.asKnown().isPresent) 1 else 0) +
@@ -35703,6 +37519,7 @@ private constructor(
private constructor(
private val invoiceBehavior: JsonField,
private val isProrated: JsonField,
+ private val rounding: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -35714,7 +37531,10 @@ private constructor(
@JsonProperty("is_prorated")
@ExcludeMissing
isProrated: JsonField = JsonMissing.of(),
- ) : this(invoiceBehavior, isProrated, mutableMapOf())
+ @JsonProperty("rounding")
+ @ExcludeMissing
+ rounding: JsonField = JsonMissing.of(),
+ ) : this(invoiceBehavior, isProrated, rounding, mutableMapOf())
/**
* @throws MetronomeInvalidDataException if the JSON field has an unexpected type or is
@@ -35730,6 +37550,12 @@ private constructor(
*/
fun isProrated(): Boolean = isProrated.getRequired("is_prorated")
+ /**
+ * @throws MetronomeInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun rounding(): Optional = rounding.getOptional("rounding")
+
/**
* Returns the raw JSON value of [invoiceBehavior].
*
@@ -35750,6 +37576,16 @@ private constructor(
@ExcludeMissing
fun _isProrated(): JsonField