diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 838ae243..fa720fe5 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-beta.24"
+ ".": "0.1.0-beta.25"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index aca608f3..7fd83720 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 110
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stigg/stigg-afa11f1425d4cfca7c245c4c7df35052f9c2edde21f737a4d7613da9e903cee9.yml
-openapi_spec_hash: 0429615df9aa3b7912b3ca45fba05e93
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stigg/stigg-512ec51333e2e803d366c0aebea858913541a7ef0269a56f9371686feed26cd8.yml
+openapi_spec_hash: 9b6d9f90c1aff0165ef7769f2311a1bd
config_hash: 0eca08dde117ac62155a012abb0ecac7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 763b57f6..78416d0a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 0.1.0-beta.25 (2026-06-22)
+
+Full Changelog: [v0.1.0-beta.24...v0.1.0-beta.25](https://github.com/stiggio/stigg-java/compare/v0.1.0-beta.24...v0.1.0-beta.25)
+
+### Features
+
+* **api:** add credit field to usage report response ([b87667c](https://github.com/stiggio/stigg-java/commit/b87667c0f25cc0a6e65726d4709014da76296688))
+* **api:** add salesforceId parameter to subscription update ([58c0ffb](https://github.com/stiggio/stigg-java/commit/58c0ffb03807dbb21b9a665459d6aac28961e694))
+
## 0.1.0-beta.24 (2026-06-21)
Full Changelog: [v0.1.0-beta.23...v0.1.0-beta.24](https://github.com/stiggio/stigg-java/compare/v0.1.0-beta.23...v0.1.0-beta.24)
diff --git a/README.md b/README.md
index bad58098..92ccc6b6 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/io.stigg/stigg-java/0.1.0-beta.24)
-[](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.24)
+[](https://central.sonatype.com/artifact/io.stigg/stigg-java/0.1.0-beta.25)
+[](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.25)
@@ -22,7 +22,7 @@ Use the Stigg MCP Server to enable AI assistants to interact with this API, allo
-Javadocs are available on [javadoc.io](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.24).
+Javadocs are available on [javadoc.io](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.25).
@@ -33,7 +33,7 @@ Javadocs are available on [javadoc.io](https://javadoc.io/doc/io.stigg/stigg-jav
### Gradle
```kotlin
-implementation("io.stigg:stigg-java:0.1.0-beta.24")
+implementation("io.stigg:stigg-java:0.1.0-beta.25")
```
### Maven
@@ -42,7 +42,7 @@ implementation("io.stigg:stigg-java:0.1.0-beta.24")
io.stigg
stigg-java
- 0.1.0-beta.24
+ 0.1.0-beta.25
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 22de2754..c50746f9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "io.stigg"
- version = "0.1.0-beta.24" // x-release-please-version
+ version = "0.1.0-beta.25" // x-release-please-version
}
subprojects {
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParams.kt
index 92c772bb..96b2ab12 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParams.kt
@@ -148,6 +148,14 @@ private constructor(
*/
fun promotionCode(): Optional = body.promotionCode()
+ /**
+ * Salesforce ID
+ *
+ * @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun salesforceId(): Optional = body.salesforceId()
+
/**
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -264,6 +272,13 @@ private constructor(
*/
fun _promotionCode(): JsonField = body._promotionCode()
+ /**
+ * Returns the raw JSON value of [salesforceId].
+ *
+ * Unlike [salesforceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _salesforceId(): JsonField = body._salesforceId()
+
/**
* Returns the raw JSON value of [scheduleStrategy].
*
@@ -598,6 +613,23 @@ private constructor(
body.promotionCode(promotionCode)
}
+ /** Salesforce ID */
+ fun salesforceId(salesforceId: String?) = apply { body.salesforceId(salesforceId) }
+
+ /** Alias for calling [Builder.salesforceId] with `salesforceId.orElse(null)`. */
+ fun salesforceId(salesforceId: Optional) = salesforceId(salesforceId.getOrNull())
+
+ /**
+ * Sets [Builder.salesforceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.salesforceId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun salesforceId(salesforceId: JsonField) = apply {
+ body.salesforceId(salesforceId)
+ }
+
fun scheduleStrategy(scheduleStrategy: ScheduleStrategy) = apply {
body.scheduleStrategy(scheduleStrategy)
}
@@ -797,6 +829,7 @@ private constructor(
private val minimumSpend: JsonField,
private val priceOverrides: JsonField>,
private val promotionCode: JsonField,
+ private val salesforceId: JsonField,
private val scheduleStrategy: JsonField,
private val trialEndDate: JsonField,
private val additionalProperties: MutableMap,
@@ -844,6 +877,9 @@ private constructor(
@JsonProperty("promotionCode")
@ExcludeMissing
promotionCode: JsonField = JsonMissing.of(),
+ @JsonProperty("salesforceId")
+ @ExcludeMissing
+ salesforceId: JsonField = JsonMissing.of(),
@JsonProperty("scheduleStrategy")
@ExcludeMissing
scheduleStrategy: JsonField = JsonMissing.of(),
@@ -865,6 +901,7 @@ private constructor(
minimumSpend,
priceOverrides,
promotionCode,
+ salesforceId,
scheduleStrategy,
trialEndDate,
mutableMapOf(),
@@ -969,6 +1006,14 @@ private constructor(
*/
fun promotionCode(): Optional = promotionCode.getOptional("promotionCode")
+ /**
+ * Salesforce ID
+ *
+ * @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun salesforceId(): Optional = salesforceId.getOptional("salesforceId")
+
/**
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -1112,6 +1157,16 @@ private constructor(
@ExcludeMissing
fun _promotionCode(): JsonField = promotionCode
+ /**
+ * Returns the raw JSON value of [salesforceId].
+ *
+ * Unlike [salesforceId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("salesforceId")
+ @ExcludeMissing
+ fun _salesforceId(): JsonField = salesforceId
+
/**
* Returns the raw JSON value of [scheduleStrategy].
*
@@ -1167,6 +1222,7 @@ private constructor(
private var minimumSpend: JsonField = JsonMissing.of()
private var priceOverrides: JsonField>? = null
private var promotionCode: JsonField = JsonMissing.of()
+ private var salesforceId: JsonField = JsonMissing.of()
private var scheduleStrategy: JsonField = JsonMissing.of()
private var trialEndDate: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -1187,6 +1243,7 @@ private constructor(
minimumSpend = body.minimumSpend
priceOverrides = body.priceOverrides.map { it.toMutableList() }
promotionCode = body.promotionCode
+ salesforceId = body.salesforceId
scheduleStrategy = body.scheduleStrategy
trialEndDate = body.trialEndDate
additionalProperties = body.additionalProperties.toMutableMap()
@@ -1464,6 +1521,25 @@ private constructor(
this.promotionCode = promotionCode
}
+ /** Salesforce ID */
+ fun salesforceId(salesforceId: String?) =
+ salesforceId(JsonField.ofNullable(salesforceId))
+
+ /** Alias for calling [Builder.salesforceId] with `salesforceId.orElse(null)`. */
+ fun salesforceId(salesforceId: Optional) =
+ salesforceId(salesforceId.getOrNull())
+
+ /**
+ * Sets [Builder.salesforceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.salesforceId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun salesforceId(salesforceId: JsonField) = apply {
+ this.salesforceId = salesforceId
+ }
+
fun scheduleStrategy(scheduleStrategy: ScheduleStrategy) =
scheduleStrategy(JsonField.of(scheduleStrategy))
@@ -1533,6 +1609,7 @@ private constructor(
minimumSpend,
(priceOverrides ?: JsonMissing.of()).map { it.toImmutable() },
promotionCode,
+ salesforceId,
scheduleStrategy,
trialEndDate,
additionalProperties.toMutableMap(),
@@ -1569,6 +1646,7 @@ private constructor(
minimumSpend().ifPresent { it.validate() }
priceOverrides().ifPresent { it.forEach { it.validate() } }
promotionCode()
+ salesforceId()
scheduleStrategy().ifPresent { it.validate() }
trialEndDate()
validated = true
@@ -1604,6 +1682,7 @@ private constructor(
(minimumSpend.asKnown().getOrNull()?.validity() ?: 0) +
(priceOverrides.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (promotionCode.asKnown().isPresent) 1 else 0) +
+ (if (salesforceId.asKnown().isPresent) 1 else 0) +
(scheduleStrategy.asKnown().getOrNull()?.validity() ?: 0) +
(if (trialEndDate.asKnown().isPresent) 1 else 0)
@@ -1627,6 +1706,7 @@ private constructor(
minimumSpend == other.minimumSpend &&
priceOverrides == other.priceOverrides &&
promotionCode == other.promotionCode &&
+ salesforceId == other.salesforceId &&
scheduleStrategy == other.scheduleStrategy &&
trialEndDate == other.trialEndDate &&
additionalProperties == other.additionalProperties
@@ -1648,6 +1728,7 @@ private constructor(
minimumSpend,
priceOverrides,
promotionCode,
+ salesforceId,
scheduleStrategy,
trialEndDate,
additionalProperties,
@@ -1657,7 +1738,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{addons=$addons, appliedCoupon=$appliedCoupon, awaitPaymentConfirmation=$awaitPaymentConfirmation, billingCycleAnchor=$billingCycleAnchor, billingInformation=$billingInformation, billingPeriod=$billingPeriod, budget=$budget, cancellationDate=$cancellationDate, charges=$charges, entitlements=$entitlements, metadata=$metadata, minimumSpend=$minimumSpend, priceOverrides=$priceOverrides, promotionCode=$promotionCode, scheduleStrategy=$scheduleStrategy, trialEndDate=$trialEndDate, additionalProperties=$additionalProperties}"
+ "Body{addons=$addons, appliedCoupon=$appliedCoupon, awaitPaymentConfirmation=$awaitPaymentConfirmation, billingCycleAnchor=$billingCycleAnchor, billingInformation=$billingInformation, billingPeriod=$billingPeriod, budget=$budget, cancellationDate=$cancellationDate, charges=$charges, entitlements=$entitlements, metadata=$metadata, minimumSpend=$minimumSpend, priceOverrides=$priceOverrides, promotionCode=$promotionCode, salesforceId=$salesforceId, scheduleStrategy=$scheduleStrategy, trialEndDate=$trialEndDate, additionalProperties=$additionalProperties}"
}
/** Addon configuration */
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageReportResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageReportResponse.kt
index dc8ec618..64c0490f 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageReportResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageReportResponse.kt
@@ -197,6 +197,7 @@ private constructor(
private val featureId: JsonField,
private val timestamp: JsonField,
private val value: JsonField,
+ private val credit: JsonField,
private val currentUsage: JsonField,
private val nextResetDate: JsonField,
private val resourceId: JsonField,
@@ -221,6 +222,7 @@ private constructor(
@ExcludeMissing
timestamp: JsonField = JsonMissing.of(),
@JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
+ @JsonProperty("credit") @ExcludeMissing credit: JsonField = JsonMissing.of(),
@JsonProperty("currentUsage")
@ExcludeMissing
currentUsage: JsonField = JsonMissing.of(),
@@ -243,6 +245,7 @@ private constructor(
featureId,
timestamp,
value,
+ credit,
currentUsage,
nextResetDate,
resourceId,
@@ -299,6 +302,14 @@ private constructor(
*/
fun value(): Long = value.getRequired("value")
+ /**
+ * Optimistic credit balance for a credit-backed feature
+ *
+ * @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun credit(): Optional = credit.getOptional("credit")
+
/**
* The current measured usage value
*
@@ -391,6 +402,13 @@ private constructor(
*/
@JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value
+ /**
+ * Returns the raw JSON value of [credit].
+ *
+ * Unlike [credit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("credit") @ExcludeMissing fun _credit(): JsonField = credit
+
/**
* Returns the raw JSON value of [currentUsage].
*
@@ -479,6 +497,7 @@ private constructor(
private var featureId: JsonField? = null
private var timestamp: JsonField? = null
private var value: JsonField? = null
+ private var credit: JsonField = JsonMissing.of()
private var currentUsage: JsonField = JsonMissing.of()
private var nextResetDate: JsonField = JsonMissing.of()
private var resourceId: JsonField = JsonMissing.of()
@@ -494,6 +513,7 @@ private constructor(
featureId = data.featureId
timestamp = data.timestamp
value = data.value
+ credit = data.credit
currentUsage = data.currentUsage
nextResetDate = data.nextResetDate
resourceId = data.resourceId
@@ -578,6 +598,21 @@ private constructor(
*/
fun value(value: JsonField) = apply { this.value = value }
+ /** Optimistic credit balance for a credit-backed feature */
+ fun credit(credit: Credit?) = credit(JsonField.ofNullable(credit))
+
+ /** Alias for calling [Builder.credit] with `credit.orElse(null)`. */
+ fun credit(credit: Optional) = credit(credit.getOrNull())
+
+ /**
+ * Sets [Builder.credit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.credit] with a well-typed [Credit] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun credit(credit: JsonField) = apply { this.credit = credit }
+
/** The current measured usage value */
fun currentUsage(currentUsage: Double?) =
currentUsage(JsonField.ofNullable(currentUsage))
@@ -728,6 +763,7 @@ private constructor(
checkRequired("featureId", featureId),
checkRequired("timestamp", timestamp),
checkRequired("value", value),
+ credit,
currentUsage,
nextResetDate,
resourceId,
@@ -759,6 +795,7 @@ private constructor(
featureId()
timestamp()
value()
+ credit().ifPresent { it.validate() }
currentUsage()
nextResetDate()
resourceId()
@@ -789,12 +826,337 @@ private constructor(
(if (featureId.asKnown().isPresent) 1 else 0) +
(if (timestamp.asKnown().isPresent) 1 else 0) +
(if (value.asKnown().isPresent) 1 else 0) +
+ (credit.asKnown().getOrNull()?.validity() ?: 0) +
(if (currentUsage.asKnown().isPresent) 1 else 0) +
(if (nextResetDate.asKnown().isPresent) 1 else 0) +
(if (resourceId.asKnown().isPresent) 1 else 0) +
(if (usagePeriodEnd.asKnown().isPresent) 1 else 0) +
(if (usagePeriodStart.asKnown().isPresent) 1 else 0)
+ /** Optimistic credit balance for a credit-backed feature */
+ class Credit
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val currencyId: JsonField,
+ private val currentUsage: JsonField,
+ private val timestamp: JsonField,
+ private val usageLimit: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("currencyId")
+ @ExcludeMissing
+ currencyId: JsonField = JsonMissing.of(),
+ @JsonProperty("currentUsage")
+ @ExcludeMissing
+ currentUsage: JsonField = JsonMissing.of(),
+ @JsonProperty("timestamp")
+ @ExcludeMissing
+ timestamp: JsonField = JsonMissing.of(),
+ @JsonProperty("usageLimit")
+ @ExcludeMissing
+ usageLimit: JsonField = JsonMissing.of(),
+ ) : this(currencyId, currentUsage, timestamp, usageLimit, mutableMapOf())
+
+ /**
+ * The credit currency identifier
+ *
+ * @throws StiggInvalidDataException 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 currencyId(): String = currencyId.getRequired("currencyId")
+
+ /**
+ * The credits consumed (optimistic — includes not-yet-reconciled usage)
+ *
+ * @throws StiggInvalidDataException 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 currentUsage(): Double = currentUsage.getRequired("currentUsage")
+
+ /**
+ * The grant-version timestamp of this balance, used by the SDK for last-write-wins
+ * reconciliation
+ *
+ * @throws StiggInvalidDataException 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 timestamp(): OffsetDateTime = timestamp.getRequired("timestamp")
+
+ /**
+ * The total credits granted
+ *
+ * @throws StiggInvalidDataException 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 usageLimit(): Double = usageLimit.getRequired("usageLimit")
+
+ /**
+ * Returns the raw JSON value of [currencyId].
+ *
+ * Unlike [currencyId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("currencyId")
+ @ExcludeMissing
+ fun _currencyId(): JsonField = currencyId
+
+ /**
+ * Returns the raw JSON value of [currentUsage].
+ *
+ * Unlike [currentUsage], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("currentUsage")
+ @ExcludeMissing
+ fun _currentUsage(): JsonField = currentUsage
+
+ /**
+ * Returns the raw JSON value of [timestamp].
+ *
+ * Unlike [timestamp], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("timestamp")
+ @ExcludeMissing
+ fun _timestamp(): JsonField = timestamp
+
+ /**
+ * Returns the raw JSON value of [usageLimit].
+ *
+ * Unlike [usageLimit], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("usageLimit")
+ @ExcludeMissing
+ fun _usageLimit(): JsonField = usageLimit
+
+ @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 [Credit].
+ *
+ * The following fields are required:
+ * ```java
+ * .currencyId()
+ * .currentUsage()
+ * .timestamp()
+ * .usageLimit()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Credit]. */
+ class Builder internal constructor() {
+
+ private var currencyId: JsonField? = null
+ private var currentUsage: JsonField? = null
+ private var timestamp: JsonField? = null
+ private var usageLimit: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(credit: Credit) = apply {
+ currencyId = credit.currencyId
+ currentUsage = credit.currentUsage
+ timestamp = credit.timestamp
+ usageLimit = credit.usageLimit
+ additionalProperties = credit.additionalProperties.toMutableMap()
+ }
+
+ /** The credit currency identifier */
+ fun currencyId(currencyId: String) = currencyId(JsonField.of(currencyId))
+
+ /**
+ * Sets [Builder.currencyId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.currencyId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun currencyId(currencyId: JsonField) = apply {
+ this.currencyId = currencyId
+ }
+
+ /** The credits consumed (optimistic — includes not-yet-reconciled usage) */
+ fun currentUsage(currentUsage: Double) = currentUsage(JsonField.of(currentUsage))
+
+ /**
+ * Sets [Builder.currentUsage] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.currentUsage] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun currentUsage(currentUsage: JsonField) = apply {
+ this.currentUsage = currentUsage
+ }
+
+ /**
+ * The grant-version timestamp of this balance, used by the SDK for last-write-wins
+ * reconciliation
+ */
+ fun timestamp(timestamp: OffsetDateTime) = timestamp(JsonField.of(timestamp))
+
+ /**
+ * Sets [Builder.timestamp] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.timestamp] with a well-typed [OffsetDateTime]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun timestamp(timestamp: JsonField) = apply {
+ this.timestamp = timestamp
+ }
+
+ /** The total credits granted */
+ fun usageLimit(usageLimit: Double) = usageLimit(JsonField.of(usageLimit))
+
+ /**
+ * Sets [Builder.usageLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.usageLimit] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun usageLimit(usageLimit: JsonField) = apply {
+ this.usageLimit = usageLimit
+ }
+
+ 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 [Credit].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .currencyId()
+ * .currentUsage()
+ * .timestamp()
+ * .usageLimit()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Credit =
+ Credit(
+ checkRequired("currencyId", currencyId),
+ checkRequired("currentUsage", currentUsage),
+ checkRequired("timestamp", timestamp),
+ checkRequired("usageLimit", usageLimit),
+ 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 StiggInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Credit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ currencyId()
+ currentUsage()
+ timestamp()
+ usageLimit()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StiggInvalidDataException) {
+ 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 (currencyId.asKnown().isPresent) 1 else 0) +
+ (if (currentUsage.asKnown().isPresent) 1 else 0) +
+ (if (timestamp.asKnown().isPresent) 1 else 0) +
+ (if (usageLimit.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Credit &&
+ currencyId == other.currencyId &&
+ currentUsage == other.currentUsage &&
+ timestamp == other.timestamp &&
+ usageLimit == other.usageLimit &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(currencyId, currentUsage, timestamp, usageLimit, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Credit{currencyId=$currencyId, currentUsage=$currentUsage, timestamp=$timestamp, usageLimit=$usageLimit, additionalProperties=$additionalProperties}"
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -807,6 +1169,7 @@ private constructor(
featureId == other.featureId &&
timestamp == other.timestamp &&
value == other.value &&
+ credit == other.credit &&
currentUsage == other.currentUsage &&
nextResetDate == other.nextResetDate &&
resourceId == other.resourceId &&
@@ -823,6 +1186,7 @@ private constructor(
featureId,
timestamp,
value,
+ credit,
currentUsage,
nextResetDate,
resourceId,
@@ -835,7 +1199,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Data{id=$id, createdAt=$createdAt, customerId=$customerId, featureId=$featureId, timestamp=$timestamp, value=$value, currentUsage=$currentUsage, nextResetDate=$nextResetDate, resourceId=$resourceId, usagePeriodEnd=$usagePeriodEnd, usagePeriodStart=$usagePeriodStart, additionalProperties=$additionalProperties}"
+ "Data{id=$id, createdAt=$createdAt, customerId=$customerId, featureId=$featureId, timestamp=$timestamp, value=$value, credit=$credit, currentUsage=$currentUsage, nextResetDate=$nextResetDate, resourceId=$resourceId, usagePeriodEnd=$usagePeriodEnd, usagePeriodStart=$usagePeriodStart, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
diff --git a/stigg-java-core/src/test/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParamsTest.kt b/stigg-java-core/src/test/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParamsTest.kt
index b82613bb..3d278f02 100644
--- a/stigg-java-core/src/test/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParamsTest.kt
+++ b/stigg-java-core/src/test/kotlin/io/stigg/models/v1/subscriptions/SubscriptionUpdateParamsTest.kt
@@ -161,6 +161,7 @@ internal class SubscriptionUpdateParamsTest {
.build()
)
.promotionCode("promotionCode")
+ .salesforceId("salesforceId")
.scheduleStrategy(SubscriptionUpdateParams.ScheduleStrategy.END_OF_BILLING_PERIOD)
.trialEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
@@ -333,6 +334,7 @@ internal class SubscriptionUpdateParamsTest {
.build()
)
.promotionCode("promotionCode")
+ .salesforceId("salesforceId")
.scheduleStrategy(SubscriptionUpdateParams.ScheduleStrategy.END_OF_BILLING_PERIOD)
.trialEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
@@ -515,6 +517,7 @@ internal class SubscriptionUpdateParamsTest {
.build()
)
.promotionCode("promotionCode")
+ .salesforceId("salesforceId")
.scheduleStrategy(SubscriptionUpdateParams.ScheduleStrategy.END_OF_BILLING_PERIOD)
.trialEndDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
@@ -683,6 +686,7 @@ internal class SubscriptionUpdateParamsTest {
.build()
)
assertThat(body.promotionCode()).contains("promotionCode")
+ assertThat(body.salesforceId()).contains("salesforceId")
assertThat(body.scheduleStrategy())
.contains(SubscriptionUpdateParams.ScheduleStrategy.END_OF_BILLING_PERIOD)
assertThat(body.trialEndDate()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
diff --git a/stigg-java-core/src/test/kotlin/io/stigg/models/v1/usage/UsageReportResponseTest.kt b/stigg-java-core/src/test/kotlin/io/stigg/models/v1/usage/UsageReportResponseTest.kt
index c37c9eee..3a2e4396 100644
--- a/stigg-java-core/src/test/kotlin/io/stigg/models/v1/usage/UsageReportResponseTest.kt
+++ b/stigg-java-core/src/test/kotlin/io/stigg/models/v1/usage/UsageReportResponseTest.kt
@@ -22,6 +22,14 @@ internal class UsageReportResponseTest {
.featureId("featureId")
.timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.value(-9007199254740991L)
+ .credit(
+ UsageReportResponse.Data.Credit.builder()
+ .currencyId("currencyId")
+ .currentUsage(0.0)
+ .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
+ .usageLimit(0.0)
+ .build()
+ )
.currentUsage(0.0)
.nextResetDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.resourceId("resourceId")
@@ -40,6 +48,14 @@ internal class UsageReportResponseTest {
.featureId("featureId")
.timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.value(-9007199254740991L)
+ .credit(
+ UsageReportResponse.Data.Credit.builder()
+ .currencyId("currencyId")
+ .currentUsage(0.0)
+ .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
+ .usageLimit(0.0)
+ .build()
+ )
.currentUsage(0.0)
.nextResetDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.resourceId("resourceId")
@@ -62,6 +78,14 @@ internal class UsageReportResponseTest {
.featureId("featureId")
.timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.value(-9007199254740991L)
+ .credit(
+ UsageReportResponse.Data.Credit.builder()
+ .currencyId("currencyId")
+ .currentUsage(0.0)
+ .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
+ .usageLimit(0.0)
+ .build()
+ )
.currentUsage(0.0)
.nextResetDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.resourceId("resourceId")
diff --git a/stigg-java-core/src/test/kotlin/io/stigg/services/async/v1/SubscriptionServiceAsyncTest.kt b/stigg-java-core/src/test/kotlin/io/stigg/services/async/v1/SubscriptionServiceAsyncTest.kt
index d4bf10aa..fad3e8b4 100644
--- a/stigg-java-core/src/test/kotlin/io/stigg/services/async/v1/SubscriptionServiceAsyncTest.kt
+++ b/stigg-java-core/src/test/kotlin/io/stigg/services/async/v1/SubscriptionServiceAsyncTest.kt
@@ -208,6 +208,7 @@ internal class SubscriptionServiceAsyncTest {
.build()
)
.promotionCode("promotionCode")
+ .salesforceId("salesforceId")
.scheduleStrategy(
SubscriptionUpdateParams.ScheduleStrategy.END_OF_BILLING_PERIOD
)
diff --git a/stigg-java-core/src/test/kotlin/io/stigg/services/blocking/v1/SubscriptionServiceTest.kt b/stigg-java-core/src/test/kotlin/io/stigg/services/blocking/v1/SubscriptionServiceTest.kt
index ef032b28..fc297b0d 100644
--- a/stigg-java-core/src/test/kotlin/io/stigg/services/blocking/v1/SubscriptionServiceTest.kt
+++ b/stigg-java-core/src/test/kotlin/io/stigg/services/blocking/v1/SubscriptionServiceTest.kt
@@ -207,6 +207,7 @@ internal class SubscriptionServiceTest {
.build()
)
.promotionCode("promotionCode")
+ .salesforceId("salesforceId")
.scheduleStrategy(
SubscriptionUpdateParams.ScheduleStrategy.END_OF_BILLING_PERIOD
)