diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index fe045cce..cae2247f 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-beta.40"
+ ".": "0.1.0-beta.41"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index b12bc4d0..d68dad1e 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/stigg/stigg-95d84a1adc011f81086082cfbec6796bae04f4cba0c226965bfd40c53a65d321.yml
-openapi_spec_hash: 1937e480aaa2d33272faa8df909df9f3
-config_hash: 3d43e5c6ff8bf447a1b4c1922a13119f
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stigg/stigg-a75c09ac63a990956e295213c537c7c7aae6f08012d817e41bf91953f9199b92.yml
+openapi_spec_hash: 742a2a900b833f5e48aa5723bc5ec953
+config_hash: 931244a505ec1f13e536ee9ed7133ebc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81631caf..90ca1d4f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.1.0-beta.41 (2026-07-26)
+
+Full Changelog: [v0.1.0-beta.40...v0.1.0-beta.41](https://github.com/stiggio/stigg-java/compare/v0.1.0-beta.40...v0.1.0-beta.41)
+
+### Features
+
+* **api:** add creditEntitlement field to addon/plan overage pricing ([fc6460e](https://github.com/stiggio/stigg-java/commit/fc6460e5a7e1efcb95c14cdb6fed1a42a2d4e4dc))
+
+
+### Chores
+
+* **internal:** regenerate SDK with no functional changes ([dd164e0](https://github.com/stiggio/stigg-java/commit/dd164e04deb902319aba95c7e6562bd258dbdd20))
+
## 0.1.0-beta.40 (2026-07-21)
Full Changelog: [v0.1.0-beta.39...v0.1.0-beta.40](https://github.com/stiggio/stigg-java/compare/v0.1.0-beta.39...v0.1.0-beta.40)
diff --git a/README.md b/README.md
index 64b58aa5..2584c66d 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/io.stigg/stigg-java/0.1.0-beta.40)
-[](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.40)
+[](https://central.sonatype.com/artifact/io.stigg/stigg-java/0.1.0-beta.41)
+[](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.41)
@@ -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.40).
+Javadocs are available on [javadoc.io](https://javadoc.io/doc/io.stigg/stigg-java/0.1.0-beta.41).
@@ -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.40")
+implementation("io.stigg:stigg-java:0.1.0-beta.41")
```
### Maven
@@ -42,7 +42,7 @@ implementation("io.stigg:stigg-java:0.1.0-beta.40")
io.stigg
stigg-java
- 0.1.0-beta.40
+ 0.1.0-beta.41
```
@@ -107,10 +107,10 @@ StiggClient client = StiggOkHttpClient.builder()
See this table for the available options:
-| Setter | System property | Environment variable | Required | Default value |
-| --------- | --------------- | -------------------- | -------- | ----------------------------- |
-| `apiKey` | `stigg.apiKey` | `STIGG_API_KEY` | true | - |
-| `baseUrl` | `stigg.baseUrl` | `STIGG_BASE_URL` | true | `"https://edge.api.stigg.io"` |
+| Setter | System property | Environment variable | Required | Default value |
+| --------- | --------------- | -------------------- | -------- | ------------------------ |
+| `apiKey` | `stigg.apiKey` | `STIGG_API_KEY` | true | - |
+| `baseUrl` | `stigg.baseUrl` | `STIGG_BASE_URL` | true | `"https://api.stigg.io"` |
System properties take precedence over environment variables.
diff --git a/build.gradle.kts b/build.gradle.kts
index b2953ef9..a183d54b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "io.stigg"
- version = "0.1.0-beta.40" // x-release-please-version
+ version = "0.1.0-beta.41" // x-release-please-version
}
subprojects {
diff --git a/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClient.kt b/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClient.kt
index 2236c294..ee3abb41 100644
--- a/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClient.kt
+++ b/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClient.kt
@@ -237,7 +237,7 @@ class StiggOkHttpClient private constructor() {
/**
* The base URL to use for every request.
*
- * Defaults to the production environment: `https://edge.api.stigg.io`.
+ * Defaults to the production environment: `https://api.stigg.io`.
*/
fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) }
diff --git a/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClientAsync.kt b/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClientAsync.kt
index 31cea541..48b96ced 100644
--- a/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClientAsync.kt
+++ b/stigg-java-client-okhttp/src/main/kotlin/io/stigg/client/okhttp/StiggOkHttpClientAsync.kt
@@ -237,7 +237,7 @@ class StiggOkHttpClientAsync private constructor() {
/**
* The base URL to use for every request.
*
- * Defaults to the production environment: `https://edge.api.stigg.io`.
+ * Defaults to the production environment: `https://api.stigg.io`.
*/
fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) }
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/core/ClientOptions.kt b/stigg-java-core/src/main/kotlin/io/stigg/core/ClientOptions.kt
index b49c917b..995e7ffc 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/core/ClientOptions.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/core/ClientOptions.kt
@@ -131,7 +131,7 @@ private constructor(
/**
* The base URL to use for every request.
*
- * Defaults to the production environment: `https://edge.api.stigg.io`.
+ * Defaults to the production environment: `https://api.stigg.io`.
*/
fun baseUrl(): String = baseUrl ?: PRODUCTION_URL
@@ -139,7 +139,7 @@ private constructor(
companion object {
- const val PRODUCTION_URL = "https://edge.api.stigg.io"
+ const val PRODUCTION_URL = "https://api.stigg.io"
/**
* Returns a mutable builder for constructing an instance of [ClientOptions].
@@ -263,7 +263,7 @@ private constructor(
/**
* The base URL to use for every request.
*
- * Defaults to the production environment: `https://edge.api.stigg.io`.
+ * Defaults to the production environment: `https://api.stigg.io`.
*/
fun baseUrl(baseUrl: String?) = apply { this.baseUrl = baseUrl }
@@ -415,10 +415,10 @@ private constructor(
*
* See this table for the available options:
*
- * |Setter |System property|Environment variable|Required|Default value |
- * |---------|---------------|--------------------|--------|-----------------------------|
- * |`apiKey` |`stigg.apiKey` |`STIGG_API_KEY` |true |- |
- * |`baseUrl`|`stigg.baseUrl`|`STIGG_BASE_URL` |true |`"https://edge.api.stigg.io"`|
+ * | Setter | System property | Environment variable | Required | Default value |
+ * |-----------|-----------------|----------------------|----------|--------------------------|
+ * | `apiKey` | `stigg.apiKey` | `STIGG_API_KEY` | true | - |
+ * | `baseUrl` | `stigg.baseUrl` | `STIGG_BASE_URL` | true | `"https://api.stigg.io"` |
*
* System properties take precedence over environment variables.
*/
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/addons/AddonUpdateParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/addons/AddonUpdateParams.kt
index ea7ca03a..76035df8 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/addons/AddonUpdateParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/addons/AddonUpdateParams.kt
@@ -3124,9 +3124,10 @@ private constructor(
private val billingModel: JsonField,
private val pricePeriods: JsonField>,
private val billingCadence: JsonField,
+ private val creditEntitlement: JsonField,
+ private val currencyId: JsonField,
private val entitlement: JsonField,
private val featureId: JsonField,
- private val topUpCustomCurrencyId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -3141,22 +3142,26 @@ private constructor(
@JsonProperty("billingCadence")
@ExcludeMissing
billingCadence: JsonField = JsonMissing.of(),
+ @JsonProperty("creditEntitlement")
+ @ExcludeMissing
+ creditEntitlement: JsonField = JsonMissing.of(),
+ @JsonProperty("currencyId")
+ @ExcludeMissing
+ currencyId: JsonField = JsonMissing.of(),
@JsonProperty("entitlement")
@ExcludeMissing
entitlement: JsonField = JsonMissing.of(),
@JsonProperty("featureId")
@ExcludeMissing
featureId: JsonField = JsonMissing.of(),
- @JsonProperty("topUpCustomCurrencyId")
- @ExcludeMissing
- topUpCustomCurrencyId: JsonField = JsonMissing.of(),
) : this(
billingModel,
pricePeriods,
billingCadence,
+ creditEntitlement,
+ currencyId,
entitlement,
featureId,
- topUpCustomCurrencyId,
mutableMapOf(),
)
@@ -3188,29 +3193,38 @@ private constructor(
billingCadence.getOptional("billingCadence")
/**
- * Entitlement configuration for the overage feature
+ * Credit entitlement to grant when a credit overage targets a currency not yet granted
+ * on the plan
*
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun entitlement(): Optional = entitlement.getOptional("entitlement")
+ fun creditEntitlement(): Optional =
+ creditEntitlement.getOptional("creditEntitlement")
/**
- * The feature ID for overage pricing
+ * The refId of the custom currency this credit overage applies to
*
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun featureId(): Optional = featureId.getOptional("featureId")
+ fun currencyId(): Optional = currencyId.getOptional("currencyId")
/**
- * Custom currency ID for overage top-up
+ * Entitlement configuration for the overage feature
*
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun topUpCustomCurrencyId(): Optional =
- topUpCustomCurrencyId.getOptional("topUpCustomCurrencyId")
+ fun entitlement(): Optional = entitlement.getOptional("entitlement")
+
+ /**
+ * The feature ID for overage pricing
+ *
+ * @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun featureId(): Optional = featureId.getOptional("featureId")
/**
* Returns the raw JSON value of [billingModel].
@@ -3242,6 +3256,26 @@ private constructor(
@ExcludeMissing
fun _billingCadence(): JsonField = billingCadence
+ /**
+ * Returns the raw JSON value of [creditEntitlement].
+ *
+ * Unlike [creditEntitlement], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("creditEntitlement")
+ @ExcludeMissing
+ fun _creditEntitlement(): JsonField = creditEntitlement
+
+ /**
+ * 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 [entitlement].
*
@@ -3262,16 +3296,6 @@ private constructor(
@ExcludeMissing
fun _featureId(): JsonField = featureId
- /**
- * Returns the raw JSON value of [topUpCustomCurrencyId].
- *
- * Unlike [topUpCustomCurrencyId], this method doesn't throw if the JSON field has an
- * unexpected type.
- */
- @JsonProperty("topUpCustomCurrencyId")
- @ExcludeMissing
- fun _topUpCustomCurrencyId(): JsonField = topUpCustomCurrencyId
-
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -3304,9 +3328,10 @@ private constructor(
private var billingModel: JsonField? = null
private var pricePeriods: JsonField>? = null
private var billingCadence: JsonField = JsonMissing.of()
+ private var creditEntitlement: JsonField = JsonMissing.of()
+ private var currencyId: JsonField = JsonMissing.of()
private var entitlement: JsonField = JsonMissing.of()
private var featureId: JsonField = JsonMissing.of()
- private var topUpCustomCurrencyId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -3314,9 +3339,10 @@ private constructor(
billingModel = overagePricingModel.billingModel
pricePeriods = overagePricingModel.pricePeriods.map { it.toMutableList() }
billingCadence = overagePricingModel.billingCadence
+ creditEntitlement = overagePricingModel.creditEntitlement
+ currencyId = overagePricingModel.currencyId
entitlement = overagePricingModel.entitlement
featureId = overagePricingModel.featureId
- topUpCustomCurrencyId = overagePricingModel.topUpCustomCurrencyId
additionalProperties = overagePricingModel.additionalProperties.toMutableMap()
}
@@ -3377,6 +3403,38 @@ private constructor(
this.billingCadence = billingCadence
}
+ /**
+ * Credit entitlement to grant when a credit overage targets a currency not yet
+ * granted on the plan
+ */
+ fun creditEntitlement(creditEntitlement: CreditEntitlement) =
+ creditEntitlement(JsonField.of(creditEntitlement))
+
+ /**
+ * Sets [Builder.creditEntitlement] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.creditEntitlement] with a well-typed
+ * [CreditEntitlement] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun creditEntitlement(creditEntitlement: JsonField) = apply {
+ this.creditEntitlement = creditEntitlement
+ }
+
+ /** The refId of the custom currency this credit overage applies to */
+ 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
+ }
+
/** Entitlement configuration for the overage feature */
fun entitlement(entitlement: Entitlement) = entitlement(JsonField.of(entitlement))
@@ -3403,21 +3461,6 @@ private constructor(
*/
fun featureId(featureId: JsonField) = apply { this.featureId = featureId }
- /** Custom currency ID for overage top-up */
- fun topUpCustomCurrencyId(topUpCustomCurrencyId: String) =
- topUpCustomCurrencyId(JsonField.of(topUpCustomCurrencyId))
-
- /**
- * Sets [Builder.topUpCustomCurrencyId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.topUpCustomCurrencyId] with a well-typed
- * [String] value instead. This method is primarily for setting the field to an
- * undocumented or not yet supported value.
- */
- fun topUpCustomCurrencyId(topUpCustomCurrencyId: JsonField) = apply {
- this.topUpCustomCurrencyId = topUpCustomCurrencyId
- }
-
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -3458,9 +3501,10 @@ private constructor(
checkRequired("billingModel", billingModel),
checkRequired("pricePeriods", pricePeriods).map { it.toImmutable() },
billingCadence,
+ creditEntitlement,
+ currencyId,
entitlement,
featureId,
- topUpCustomCurrencyId,
additionalProperties.toMutableMap(),
)
}
@@ -3485,9 +3529,10 @@ private constructor(
billingModel().validate()
pricePeriods().forEach { it.validate() }
billingCadence().ifPresent { it.validate() }
+ creditEntitlement().ifPresent { it.validate() }
+ currencyId()
entitlement().ifPresent { it.validate() }
featureId()
- topUpCustomCurrencyId()
validated = true
}
@@ -3510,9 +3555,10 @@ private constructor(
(billingModel.asKnown().getOrNull()?.validity() ?: 0) +
(pricePeriods.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(billingCadence.asKnown().getOrNull()?.validity() ?: 0) +
+ (creditEntitlement.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currencyId.asKnown().isPresent) 1 else 0) +
(entitlement.asKnown().getOrNull()?.validity() ?: 0) +
- (if (featureId.asKnown().isPresent) 1 else 0) +
- (if (topUpCustomCurrencyId.asKnown().isPresent) 1 else 0)
+ (if (featureId.asKnown().isPresent) 1 else 0)
/** The billing model for overages */
class BillingModel
@@ -8283,6 +8329,425 @@ private constructor(
override fun toString() = value.toString()
}
+ /**
+ * Credit entitlement to grant when a credit overage targets a currency not yet granted
+ * on the plan
+ */
+ class CreditEntitlement
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val amount: JsonField,
+ private val cadence: JsonField,
+ private val customCurrencyId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount")
+ @ExcludeMissing
+ amount: JsonField = JsonMissing.of(),
+ @JsonProperty("cadence")
+ @ExcludeMissing
+ cadence: JsonField = JsonMissing.of(),
+ @JsonProperty("customCurrencyId")
+ @ExcludeMissing
+ customCurrencyId: JsonField = JsonMissing.of(),
+ ) : this(amount, cadence, customCurrencyId, mutableMapOf())
+
+ /**
+ * The base credit balance granted per cadence
+ *
+ * @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 amount(): Double = amount.getRequired("amount")
+
+ /**
+ * The credit grant cadence (MONTH or YEAR)
+ *
+ * @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 cadence(): Cadence = cadence.getRequired("cadence")
+
+ /**
+ * The refId of the custom currency to grant
+ *
+ * @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 customCurrencyId(): String = customCurrencyId.getRequired("customCurrencyId")
+
+ /**
+ * Returns the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
+
+ /**
+ * Returns the raw JSON value of [cadence].
+ *
+ * Unlike [cadence], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("cadence")
+ @ExcludeMissing
+ fun _cadence(): JsonField = cadence
+
+ /**
+ * Returns the raw JSON value of [customCurrencyId].
+ *
+ * Unlike [customCurrencyId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("customCurrencyId")
+ @ExcludeMissing
+ fun _customCurrencyId(): JsonField = customCurrencyId
+
+ @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
+ * [CreditEntitlement].
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .cadence()
+ * .customCurrencyId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CreditEntitlement]. */
+ class Builder internal constructor() {
+
+ private var amount: JsonField? = null
+ private var cadence: JsonField? = null
+ private var customCurrencyId: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(creditEntitlement: CreditEntitlement) = apply {
+ amount = creditEntitlement.amount
+ cadence = creditEntitlement.cadence
+ customCurrencyId = creditEntitlement.customCurrencyId
+ additionalProperties = creditEntitlement.additionalProperties.toMutableMap()
+ }
+
+ /** The base credit balance granted per cadence */
+ fun amount(amount: Double) = amount(JsonField.of(amount))
+
+ /**
+ * Sets [Builder.amount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.amount] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun amount(amount: JsonField) = apply { this.amount = amount }
+
+ /** The credit grant cadence (MONTH or YEAR) */
+ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence))
+
+ /**
+ * Sets [Builder.cadence] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cadence] with a well-typed [Cadence] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun cadence(cadence: JsonField) = apply { this.cadence = cadence }
+
+ /** The refId of the custom currency to grant */
+ fun customCurrencyId(customCurrencyId: String) =
+ customCurrencyId(JsonField.of(customCurrencyId))
+
+ /**
+ * Sets [Builder.customCurrencyId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.customCurrencyId] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun customCurrencyId(customCurrencyId: JsonField) = apply {
+ this.customCurrencyId = customCurrencyId
+ }
+
+ 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 [CreditEntitlement].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .cadence()
+ * .customCurrencyId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CreditEntitlement =
+ CreditEntitlement(
+ checkRequired("amount", amount),
+ checkRequired("cadence", cadence),
+ checkRequired("customCurrencyId", customCurrencyId),
+ 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(): CreditEntitlement = apply {
+ if (validated) {
+ return@apply
+ }
+
+ amount()
+ cadence().validate()
+ customCurrencyId()
+ 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 (amount.asKnown().isPresent) 1 else 0) +
+ (cadence.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (customCurrencyId.asKnown().isPresent) 1 else 0)
+
+ /** The credit grant cadence (MONTH or YEAR) */
+ class Cadence
+ @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 MONTH = of("MONTH")
+
+ @JvmField val YEAR = of("YEAR")
+
+ @JvmStatic fun of(value: String) = Cadence(JsonField.of(value))
+ }
+
+ /** An enum containing [Cadence]'s known values. */
+ enum class Known {
+ MONTH,
+ YEAR,
+ }
+
+ /**
+ * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Cadence] 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 {
+ MONTH,
+ YEAR,
+ /**
+ * An enum member indicating that [Cadence] 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) {
+ MONTH -> Value.MONTH
+ YEAR -> Value.YEAR
+ 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 StiggInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ MONTH -> Known.MONTH
+ YEAR -> Known.YEAR
+ else -> throw StiggInvalidDataException("Unknown Cadence: $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 StiggInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ StiggInvalidDataException("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 StiggInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Cadence = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Cadence && 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 CreditEntitlement &&
+ amount == other.amount &&
+ cadence == other.cadence &&
+ customCurrencyId == other.customCurrencyId &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(amount, cadence, customCurrencyId, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "CreditEntitlement{amount=$amount, cadence=$cadence, customCurrencyId=$customCurrencyId, additionalProperties=$additionalProperties}"
+ }
+
/** Entitlement configuration for the overage feature */
class Entitlement
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -10044,9 +10509,10 @@ private constructor(
billingModel == other.billingModel &&
pricePeriods == other.pricePeriods &&
billingCadence == other.billingCadence &&
+ creditEntitlement == other.creditEntitlement &&
+ currencyId == other.currencyId &&
entitlement == other.entitlement &&
featureId == other.featureId &&
- topUpCustomCurrencyId == other.topUpCustomCurrencyId &&
additionalProperties == other.additionalProperties
}
@@ -10055,9 +10521,10 @@ private constructor(
billingModel,
pricePeriods,
billingCadence,
+ creditEntitlement,
+ currencyId,
entitlement,
featureId,
- topUpCustomCurrencyId,
additionalProperties,
)
}
@@ -10065,7 +10532,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "OveragePricingModel{billingModel=$billingModel, pricePeriods=$pricePeriods, billingCadence=$billingCadence, entitlement=$entitlement, featureId=$featureId, topUpCustomCurrencyId=$topUpCustomCurrencyId, additionalProperties=$additionalProperties}"
+ "OveragePricingModel{billingModel=$billingModel, pricePeriods=$pricePeriods, billingCadence=$billingCadence, creditEntitlement=$creditEntitlement, currencyId=$currencyId, entitlement=$entitlement, featureId=$featureId, additionalProperties=$additionalProperties}"
}
/** A pricing model configuration with billing details and price periods. */
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/CreditGrantResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/CreditGrantResponse.kt
index e201de9c..2b58a157 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/CreditGrantResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/CreditGrantResponse.kt
@@ -373,7 +373,7 @@ private constructor(
fun expireAt(): Optional = expireAt.getOptional("expireAt")
/**
- * The type of credit grant (PAID, PROMOTIONAL, RECURRING)
+ * The type of credit grant (PAID, PROMOTIONAL, RECURRING, OVERDRAFT)
*
* @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).
@@ -913,7 +913,7 @@ private constructor(
*/
fun expireAt(expireAt: JsonField) = apply { this.expireAt = expireAt }
- /** The type of credit grant (PAID, PROMOTIONAL, RECURRING) */
+ /** The type of credit grant (PAID, PROMOTIONAL, RECURRING, OVERDRAFT) */
fun grantType(grantType: GrantType) = grantType(JsonField.of(grantType))
/**
@@ -1487,7 +1487,7 @@ private constructor(
"Cost{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
}
- /** The type of credit grant (PAID, PROMOTIONAL, RECURRING) */
+ /** The type of credit grant (PAID, PROMOTIONAL, RECURRING, OVERDRAFT) */
class GrantType @JsonCreator private constructor(private val value: JsonField) :
Enum {
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/GrantListResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/GrantListResponse.kt
index b0d78390..5411f24a 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/GrantListResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/credits/grants/GrantListResponse.kt
@@ -222,7 +222,7 @@ private constructor(
fun expireAt(): Optional = expireAt.getOptional("expireAt")
/**
- * The type of credit grant (PAID, PROMOTIONAL, RECURRING)
+ * The type of credit grant (PAID, PROMOTIONAL, RECURRING, OVERDRAFT)
*
* @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).
@@ -736,7 +736,7 @@ private constructor(
*/
fun expireAt(expireAt: JsonField) = apply { this.expireAt = expireAt }
- /** The type of credit grant (PAID, PROMOTIONAL, RECURRING) */
+ /** The type of credit grant (PAID, PROMOTIONAL, RECURRING, OVERDRAFT) */
fun grantType(grantType: GrantType) = grantType(JsonField.of(grantType))
/**
@@ -1287,7 +1287,7 @@ private constructor(
"Cost{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
}
- /** The type of credit grant (PAID, PROMOTIONAL, RECURRING) */
+ /** The type of credit grant (PAID, PROMOTIONAL, RECURRING, OVERDRAFT) */
class GrantType @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateCostParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateParams.kt
similarity index 96%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateCostParams.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateParams.kt
index b0e4ee9c..44e6dafe 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateCostParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateParams.kt
@@ -25,7 +25,7 @@ import kotlin.jvm.optionals.getOrNull
* Estimates the credit cost of a usage event without ingesting it. Returns the estimated cost per
* credit currency, the current balance, and the balance after the estimated consumption.
*/
-class EventEstimateCostParams
+class EventEstimateParams
private constructor(
private val xAccountId: String?,
private val xEnvironmentId: String?,
@@ -111,7 +111,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [EventEstimateCostParams].
+ * Returns a mutable builder for constructing an instance of [EventEstimateParams].
*
* The following fields are required:
* ```java
@@ -122,7 +122,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [EventEstimateCostParams]. */
+ /** A builder for [EventEstimateParams]. */
class Builder internal constructor() {
private var xAccountId: String? = null
@@ -132,12 +132,12 @@ private constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
- internal fun from(eventEstimateCostParams: EventEstimateCostParams) = apply {
- xAccountId = eventEstimateCostParams.xAccountId
- xEnvironmentId = eventEstimateCostParams.xEnvironmentId
- body = eventEstimateCostParams.body.toBuilder()
- additionalHeaders = eventEstimateCostParams.additionalHeaders.toBuilder()
- additionalQueryParams = eventEstimateCostParams.additionalQueryParams.toBuilder()
+ internal fun from(eventEstimateParams: EventEstimateParams) = apply {
+ xAccountId = eventEstimateParams.xAccountId
+ xEnvironmentId = eventEstimateParams.xEnvironmentId
+ body = eventEstimateParams.body.toBuilder()
+ additionalHeaders = eventEstimateParams.additionalHeaders.toBuilder()
+ additionalQueryParams = eventEstimateParams.additionalQueryParams.toBuilder()
}
fun xAccountId(xAccountId: String?) = apply { this.xAccountId = xAccountId }
@@ -332,7 +332,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [EventEstimateCostParams].
+ * Returns an immutable instance of [EventEstimateParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -344,8 +344,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): EventEstimateCostParams =
- EventEstimateCostParams(
+ fun build(): EventEstimateParams =
+ EventEstimateParams(
xAccountId,
xEnvironmentId,
body.build(),
@@ -780,7 +780,7 @@ private constructor(
return true
}
- return other is EventEstimateCostParams &&
+ return other is EventEstimateParams &&
xAccountId == other.xAccountId &&
xEnvironmentId == other.xEnvironmentId &&
body == other.body &&
@@ -792,5 +792,5 @@ private constructor(
Objects.hash(xAccountId, xEnvironmentId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "EventEstimateCostParams{xAccountId=$xAccountId, xEnvironmentId=$xEnvironmentId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "EventEstimateParams{xAccountId=$xAccountId, xEnvironmentId=$xEnvironmentId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateCostResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateResponse.kt
similarity index 98%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateCostResponse.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateResponse.kt
index 09dd8e35..b192115d 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateCostResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/EventEstimateResponse.kt
@@ -21,7 +21,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** Response object */
-class EventEstimateCostResponse
+class EventEstimateResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField,
@@ -63,7 +63,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [EventEstimateCostResponse].
+ * Returns a mutable builder for constructing an instance of [EventEstimateResponse].
*
* The following fields are required:
* ```java
@@ -73,16 +73,16 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [EventEstimateCostResponse]. */
+ /** A builder for [EventEstimateResponse]. */
class Builder internal constructor() {
private var data: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(eventEstimateCostResponse: EventEstimateCostResponse) = apply {
- data = eventEstimateCostResponse.data
- additionalProperties = eventEstimateCostResponse.additionalProperties.toMutableMap()
+ internal fun from(eventEstimateResponse: EventEstimateResponse) = apply {
+ data = eventEstimateResponse.data
+ additionalProperties = eventEstimateResponse.additionalProperties.toMutableMap()
}
/** Estimated credit cost, current balance and balance after */
@@ -116,7 +116,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [EventEstimateCostResponse].
+ * Returns an immutable instance of [EventEstimateResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -127,11 +127,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): EventEstimateCostResponse =
- EventEstimateCostResponse(
- checkRequired("data", data),
- additionalProperties.toMutableMap(),
- )
+ fun build(): EventEstimateResponse =
+ EventEstimateResponse(checkRequired("data", data), additionalProperties.toMutableMap())
}
private var validated: Boolean = false
@@ -144,7 +141,7 @@ private constructor(
* @throws StiggInvalidDataException if any value type in this object doesn't match its expected
* type.
*/
- fun validate(): EventEstimateCostResponse = apply {
+ fun validate(): EventEstimateResponse = apply {
if (validated) {
return@apply
}
@@ -1423,7 +1420,7 @@ private constructor(
return true
}
- return other is EventEstimateCostResponse &&
+ return other is EventEstimateResponse &&
data == other.data &&
additionalProperties == other.additionalProperties
}
@@ -1433,5 +1430,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "EventEstimateCostResponse{data=$data, additionalProperties=$additionalProperties}"
+ "EventEstimateResponse{data=$data, additionalProperties=$additionalProperties}"
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1beta/customers/CustomerRetrieveGovernanceParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/beta/customers/CustomerRetrieveGovernanceParams.kt
similarity index 99%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1beta/customers/CustomerRetrieveGovernanceParams.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/beta/customers/CustomerRetrieveGovernanceParams.kt
index fba36f5f..d4396f82 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1beta/customers/CustomerRetrieveGovernanceParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/beta/customers/CustomerRetrieveGovernanceParams.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package io.stigg.models.v1beta.customers
+package io.stigg.models.v1.events.beta.customers
import com.fasterxml.jackson.annotation.JsonCreator
import io.stigg.core.Enum
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1beta/customers/CustomerRetrieveGovernanceResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/beta/customers/CustomerRetrieveGovernanceResponse.kt
similarity index 99%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1beta/customers/CustomerRetrieveGovernanceResponse.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/beta/customers/CustomerRetrieveGovernanceResponse.kt
index 1b006058..592b47c0 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1beta/customers/CustomerRetrieveGovernanceResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/beta/customers/CustomerRetrieveGovernanceResponse.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package io.stigg.models.v1beta.customers
+package io.stigg.models.v1.events.beta.customers
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateSelectionParams.kt
similarity index 94%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateParams.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateSelectionParams.kt
index 9cc0ca49..40c451ef 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateSelectionParams.kt
@@ -26,7 +26,7 @@ import kotlin.jvm.optionals.getOrNull
* Update a destination's entity selection. Pushes the new enabled_models to the provider first,
* then persists the selection. Applies on the next scheduled transfer.
*/
-class DestinationUpdateParams
+class DestinationUpdateSelectionParams
private constructor(
private val destinationId: String?,
private val xAccountId: String?,
@@ -83,7 +83,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [DestinationUpdateParams].
+ * Returns a mutable builder for constructing an instance of
+ * [DestinationUpdateSelectionParams].
*
* The following fields are required:
* ```java
@@ -94,7 +95,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [DestinationUpdateParams]. */
+ /** A builder for [DestinationUpdateSelectionParams]. */
class Builder internal constructor() {
private var destinationId: String? = null
@@ -105,14 +106,16 @@ private constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
- internal fun from(destinationUpdateParams: DestinationUpdateParams) = apply {
- destinationId = destinationUpdateParams.destinationId
- xAccountId = destinationUpdateParams.xAccountId
- xEnvironmentId = destinationUpdateParams.xEnvironmentId
- body = destinationUpdateParams.body.toBuilder()
- additionalHeaders = destinationUpdateParams.additionalHeaders.toBuilder()
- additionalQueryParams = destinationUpdateParams.additionalQueryParams.toBuilder()
- }
+ internal fun from(destinationUpdateSelectionParams: DestinationUpdateSelectionParams) =
+ apply {
+ destinationId = destinationUpdateSelectionParams.destinationId
+ xAccountId = destinationUpdateSelectionParams.xAccountId
+ xEnvironmentId = destinationUpdateSelectionParams.xEnvironmentId
+ body = destinationUpdateSelectionParams.body.toBuilder()
+ additionalHeaders = destinationUpdateSelectionParams.additionalHeaders.toBuilder()
+ additionalQueryParams =
+ destinationUpdateSelectionParams.additionalQueryParams.toBuilder()
+ }
fun destinationId(destinationId: String?) = apply { this.destinationId = destinationId }
@@ -293,7 +296,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [DestinationUpdateParams].
+ * Returns an immutable instance of [DestinationUpdateSelectionParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -305,8 +308,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): DestinationUpdateParams =
- DestinationUpdateParams(
+ fun build(): DestinationUpdateSelectionParams =
+ DestinationUpdateSelectionParams(
destinationId,
xAccountId,
xEnvironmentId,
@@ -574,7 +577,7 @@ private constructor(
return true
}
- return other is DestinationUpdateParams &&
+ return other is DestinationUpdateSelectionParams &&
destinationId == other.destinationId &&
xAccountId == other.xAccountId &&
xEnvironmentId == other.xEnvironmentId &&
@@ -594,5 +597,5 @@ private constructor(
)
override fun toString() =
- "DestinationUpdateParams{destinationId=$destinationId, xAccountId=$xAccountId, xEnvironmentId=$xEnvironmentId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "DestinationUpdateSelectionParams{destinationId=$destinationId, xAccountId=$xAccountId, xEnvironmentId=$xEnvironmentId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateSelectionResponse.kt
similarity index 98%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateResponse.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateSelectionResponse.kt
index 3c5aac41..dc1a38e0 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/events/dataexport/destinations/DestinationUpdateSelectionResponse.kt
@@ -20,7 +20,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** Response object */
-class DestinationUpdateResponse
+class DestinationUpdateSelectionResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField,
@@ -62,7 +62,8 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [DestinationUpdateResponse].
+ * Returns a mutable builder for constructing an instance of
+ * [DestinationUpdateSelectionResponse].
*
* The following fields are required:
* ```java
@@ -72,17 +73,19 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [DestinationUpdateResponse]. */
+ /** A builder for [DestinationUpdateSelectionResponse]. */
class Builder internal constructor() {
private var data: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(destinationUpdateResponse: DestinationUpdateResponse) = apply {
- data = destinationUpdateResponse.data
- additionalProperties = destinationUpdateResponse.additionalProperties.toMutableMap()
- }
+ internal fun from(destinationUpdateSelectionResponse: DestinationUpdateSelectionResponse) =
+ apply {
+ data = destinationUpdateSelectionResponse.data
+ additionalProperties =
+ destinationUpdateSelectionResponse.additionalProperties.toMutableMap()
+ }
/** Current destinations under the DATA_EXPORT integration. */
fun data(data: Data) = data(JsonField.of(data))
@@ -115,7 +118,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [DestinationUpdateResponse].
+ * Returns an immutable instance of [DestinationUpdateSelectionResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -126,8 +129,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): DestinationUpdateResponse =
- DestinationUpdateResponse(
+ fun build(): DestinationUpdateSelectionResponse =
+ DestinationUpdateSelectionResponse(
checkRequired("data", data),
additionalProperties.toMutableMap(),
)
@@ -143,7 +146,7 @@ private constructor(
* @throws StiggInvalidDataException if any value type in this object doesn't match its expected
* type.
*/
- fun validate(): DestinationUpdateResponse = apply {
+ fun validate(): DestinationUpdateSelectionResponse = apply {
if (validated) {
return@apply
}
@@ -1207,7 +1210,7 @@ private constructor(
return true
}
- return other is DestinationUpdateResponse &&
+ return other is DestinationUpdateSelectionResponse &&
data == other.data &&
additionalProperties == other.additionalProperties
}
@@ -1217,5 +1220,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "DestinationUpdateResponse{data=$data, additionalProperties=$additionalProperties}"
+ "DestinationUpdateSelectionResponse{data=$data, additionalProperties=$additionalProperties}"
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/plans/PlanUpdateParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/plans/PlanUpdateParams.kt
index 19b1b13e..1b0e52d9 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/plans/PlanUpdateParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/plans/PlanUpdateParams.kt
@@ -3150,9 +3150,10 @@ private constructor(
private val billingModel: JsonField,
private val pricePeriods: JsonField>,
private val billingCadence: JsonField,
+ private val creditEntitlement: JsonField,
+ private val currencyId: JsonField,
private val entitlement: JsonField,
private val featureId: JsonField,
- private val topUpCustomCurrencyId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -3167,22 +3168,26 @@ private constructor(
@JsonProperty("billingCadence")
@ExcludeMissing
billingCadence: JsonField = JsonMissing.of(),
+ @JsonProperty("creditEntitlement")
+ @ExcludeMissing
+ creditEntitlement: JsonField = JsonMissing.of(),
+ @JsonProperty("currencyId")
+ @ExcludeMissing
+ currencyId: JsonField = JsonMissing.of(),
@JsonProperty("entitlement")
@ExcludeMissing
entitlement: JsonField = JsonMissing.of(),
@JsonProperty("featureId")
@ExcludeMissing
featureId: JsonField = JsonMissing.of(),
- @JsonProperty("topUpCustomCurrencyId")
- @ExcludeMissing
- topUpCustomCurrencyId: JsonField = JsonMissing.of(),
) : this(
billingModel,
pricePeriods,
billingCadence,
+ creditEntitlement,
+ currencyId,
entitlement,
featureId,
- topUpCustomCurrencyId,
mutableMapOf(),
)
@@ -3214,29 +3219,38 @@ private constructor(
billingCadence.getOptional("billingCadence")
/**
- * Entitlement configuration for the overage feature
+ * Credit entitlement to grant when a credit overage targets a currency not yet granted
+ * on the plan
*
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun entitlement(): Optional = entitlement.getOptional("entitlement")
+ fun creditEntitlement(): Optional =
+ creditEntitlement.getOptional("creditEntitlement")
/**
- * The feature ID for overage pricing
+ * The refId of the custom currency this credit overage applies to
*
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun featureId(): Optional = featureId.getOptional("featureId")
+ fun currencyId(): Optional = currencyId.getOptional("currencyId")
/**
- * Custom currency ID for overage top-up
+ * Entitlement configuration for the overage feature
*
* @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
- fun topUpCustomCurrencyId(): Optional =
- topUpCustomCurrencyId.getOptional("topUpCustomCurrencyId")
+ fun entitlement(): Optional = entitlement.getOptional("entitlement")
+
+ /**
+ * The feature ID for overage pricing
+ *
+ * @throws StiggInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun featureId(): Optional = featureId.getOptional("featureId")
/**
* Returns the raw JSON value of [billingModel].
@@ -3268,6 +3282,26 @@ private constructor(
@ExcludeMissing
fun _billingCadence(): JsonField = billingCadence
+ /**
+ * Returns the raw JSON value of [creditEntitlement].
+ *
+ * Unlike [creditEntitlement], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("creditEntitlement")
+ @ExcludeMissing
+ fun _creditEntitlement(): JsonField = creditEntitlement
+
+ /**
+ * 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 [entitlement].
*
@@ -3288,16 +3322,6 @@ private constructor(
@ExcludeMissing
fun _featureId(): JsonField = featureId
- /**
- * Returns the raw JSON value of [topUpCustomCurrencyId].
- *
- * Unlike [topUpCustomCurrencyId], this method doesn't throw if the JSON field has an
- * unexpected type.
- */
- @JsonProperty("topUpCustomCurrencyId")
- @ExcludeMissing
- fun _topUpCustomCurrencyId(): JsonField = topUpCustomCurrencyId
-
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -3330,9 +3354,10 @@ private constructor(
private var billingModel: JsonField? = null
private var pricePeriods: JsonField>? = null
private var billingCadence: JsonField = JsonMissing.of()
+ private var creditEntitlement: JsonField = JsonMissing.of()
+ private var currencyId: JsonField = JsonMissing.of()
private var entitlement: JsonField = JsonMissing.of()
private var featureId: JsonField = JsonMissing.of()
- private var topUpCustomCurrencyId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -3340,9 +3365,10 @@ private constructor(
billingModel = overagePricingModel.billingModel
pricePeriods = overagePricingModel.pricePeriods.map { it.toMutableList() }
billingCadence = overagePricingModel.billingCadence
+ creditEntitlement = overagePricingModel.creditEntitlement
+ currencyId = overagePricingModel.currencyId
entitlement = overagePricingModel.entitlement
featureId = overagePricingModel.featureId
- topUpCustomCurrencyId = overagePricingModel.topUpCustomCurrencyId
additionalProperties = overagePricingModel.additionalProperties.toMutableMap()
}
@@ -3403,6 +3429,38 @@ private constructor(
this.billingCadence = billingCadence
}
+ /**
+ * Credit entitlement to grant when a credit overage targets a currency not yet
+ * granted on the plan
+ */
+ fun creditEntitlement(creditEntitlement: CreditEntitlement) =
+ creditEntitlement(JsonField.of(creditEntitlement))
+
+ /**
+ * Sets [Builder.creditEntitlement] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.creditEntitlement] with a well-typed
+ * [CreditEntitlement] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun creditEntitlement(creditEntitlement: JsonField) = apply {
+ this.creditEntitlement = creditEntitlement
+ }
+
+ /** The refId of the custom currency this credit overage applies to */
+ 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
+ }
+
/** Entitlement configuration for the overage feature */
fun entitlement(entitlement: Entitlement) = entitlement(JsonField.of(entitlement))
@@ -3429,21 +3487,6 @@ private constructor(
*/
fun featureId(featureId: JsonField) = apply { this.featureId = featureId }
- /** Custom currency ID for overage top-up */
- fun topUpCustomCurrencyId(topUpCustomCurrencyId: String) =
- topUpCustomCurrencyId(JsonField.of(topUpCustomCurrencyId))
-
- /**
- * Sets [Builder.topUpCustomCurrencyId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.topUpCustomCurrencyId] with a well-typed
- * [String] value instead. This method is primarily for setting the field to an
- * undocumented or not yet supported value.
- */
- fun topUpCustomCurrencyId(topUpCustomCurrencyId: JsonField) = apply {
- this.topUpCustomCurrencyId = topUpCustomCurrencyId
- }
-
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -3484,9 +3527,10 @@ private constructor(
checkRequired("billingModel", billingModel),
checkRequired("pricePeriods", pricePeriods).map { it.toImmutable() },
billingCadence,
+ creditEntitlement,
+ currencyId,
entitlement,
featureId,
- topUpCustomCurrencyId,
additionalProperties.toMutableMap(),
)
}
@@ -3511,9 +3555,10 @@ private constructor(
billingModel().validate()
pricePeriods().forEach { it.validate() }
billingCadence().ifPresent { it.validate() }
+ creditEntitlement().ifPresent { it.validate() }
+ currencyId()
entitlement().ifPresent { it.validate() }
featureId()
- topUpCustomCurrencyId()
validated = true
}
@@ -3536,9 +3581,10 @@ private constructor(
(billingModel.asKnown().getOrNull()?.validity() ?: 0) +
(pricePeriods.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(billingCadence.asKnown().getOrNull()?.validity() ?: 0) +
+ (creditEntitlement.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currencyId.asKnown().isPresent) 1 else 0) +
(entitlement.asKnown().getOrNull()?.validity() ?: 0) +
- (if (featureId.asKnown().isPresent) 1 else 0) +
- (if (topUpCustomCurrencyId.asKnown().isPresent) 1 else 0)
+ (if (featureId.asKnown().isPresent) 1 else 0)
/** The billing model for overages */
class BillingModel
@@ -8309,6 +8355,425 @@ private constructor(
override fun toString() = value.toString()
}
+ /**
+ * Credit entitlement to grant when a credit overage targets a currency not yet granted
+ * on the plan
+ */
+ class CreditEntitlement
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val amount: JsonField,
+ private val cadence: JsonField,
+ private val customCurrencyId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount")
+ @ExcludeMissing
+ amount: JsonField = JsonMissing.of(),
+ @JsonProperty("cadence")
+ @ExcludeMissing
+ cadence: JsonField = JsonMissing.of(),
+ @JsonProperty("customCurrencyId")
+ @ExcludeMissing
+ customCurrencyId: JsonField = JsonMissing.of(),
+ ) : this(amount, cadence, customCurrencyId, mutableMapOf())
+
+ /**
+ * The base credit balance granted per cadence
+ *
+ * @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 amount(): Double = amount.getRequired("amount")
+
+ /**
+ * The credit grant cadence (MONTH or YEAR)
+ *
+ * @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 cadence(): Cadence = cadence.getRequired("cadence")
+
+ /**
+ * The refId of the custom currency to grant
+ *
+ * @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 customCurrencyId(): String = customCurrencyId.getRequired("customCurrencyId")
+
+ /**
+ * Returns the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
+
+ /**
+ * Returns the raw JSON value of [cadence].
+ *
+ * Unlike [cadence], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("cadence")
+ @ExcludeMissing
+ fun _cadence(): JsonField = cadence
+
+ /**
+ * Returns the raw JSON value of [customCurrencyId].
+ *
+ * Unlike [customCurrencyId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("customCurrencyId")
+ @ExcludeMissing
+ fun _customCurrencyId(): JsonField = customCurrencyId
+
+ @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
+ * [CreditEntitlement].
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .cadence()
+ * .customCurrencyId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CreditEntitlement]. */
+ class Builder internal constructor() {
+
+ private var amount: JsonField? = null
+ private var cadence: JsonField? = null
+ private var customCurrencyId: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(creditEntitlement: CreditEntitlement) = apply {
+ amount = creditEntitlement.amount
+ cadence = creditEntitlement.cadence
+ customCurrencyId = creditEntitlement.customCurrencyId
+ additionalProperties = creditEntitlement.additionalProperties.toMutableMap()
+ }
+
+ /** The base credit balance granted per cadence */
+ fun amount(amount: Double) = amount(JsonField.of(amount))
+
+ /**
+ * Sets [Builder.amount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.amount] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun amount(amount: JsonField) = apply { this.amount = amount }
+
+ /** The credit grant cadence (MONTH or YEAR) */
+ fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence))
+
+ /**
+ * Sets [Builder.cadence] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cadence] with a well-typed [Cadence] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun cadence(cadence: JsonField) = apply { this.cadence = cadence }
+
+ /** The refId of the custom currency to grant */
+ fun customCurrencyId(customCurrencyId: String) =
+ customCurrencyId(JsonField.of(customCurrencyId))
+
+ /**
+ * Sets [Builder.customCurrencyId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.customCurrencyId] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun customCurrencyId(customCurrencyId: JsonField) = apply {
+ this.customCurrencyId = customCurrencyId
+ }
+
+ 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 [CreditEntitlement].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .cadence()
+ * .customCurrencyId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CreditEntitlement =
+ CreditEntitlement(
+ checkRequired("amount", amount),
+ checkRequired("cadence", cadence),
+ checkRequired("customCurrencyId", customCurrencyId),
+ 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(): CreditEntitlement = apply {
+ if (validated) {
+ return@apply
+ }
+
+ amount()
+ cadence().validate()
+ customCurrencyId()
+ 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 (amount.asKnown().isPresent) 1 else 0) +
+ (cadence.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (customCurrencyId.asKnown().isPresent) 1 else 0)
+
+ /** The credit grant cadence (MONTH or YEAR) */
+ class Cadence
+ @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 MONTH = of("MONTH")
+
+ @JvmField val YEAR = of("YEAR")
+
+ @JvmStatic fun of(value: String) = Cadence(JsonField.of(value))
+ }
+
+ /** An enum containing [Cadence]'s known values. */
+ enum class Known {
+ MONTH,
+ YEAR,
+ }
+
+ /**
+ * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Cadence] 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 {
+ MONTH,
+ YEAR,
+ /**
+ * An enum member indicating that [Cadence] 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) {
+ MONTH -> Value.MONTH
+ YEAR -> Value.YEAR
+ 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 StiggInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ MONTH -> Known.MONTH
+ YEAR -> Known.YEAR
+ else -> throw StiggInvalidDataException("Unknown Cadence: $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 StiggInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ StiggInvalidDataException("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 StiggInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Cadence = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Cadence && 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 CreditEntitlement &&
+ amount == other.amount &&
+ cadence == other.cadence &&
+ customCurrencyId == other.customCurrencyId &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(amount, cadence, customCurrencyId, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "CreditEntitlement{amount=$amount, cadence=$cadence, customCurrencyId=$customCurrencyId, additionalProperties=$additionalProperties}"
+ }
+
/** Entitlement configuration for the overage feature */
class Entitlement
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -10070,9 +10535,10 @@ private constructor(
billingModel == other.billingModel &&
pricePeriods == other.pricePeriods &&
billingCadence == other.billingCadence &&
+ creditEntitlement == other.creditEntitlement &&
+ currencyId == other.currencyId &&
entitlement == other.entitlement &&
featureId == other.featureId &&
- topUpCustomCurrencyId == other.topUpCustomCurrencyId &&
additionalProperties == other.additionalProperties
}
@@ -10081,9 +10547,10 @@ private constructor(
billingModel,
pricePeriods,
billingCadence,
+ creditEntitlement,
+ currencyId,
entitlement,
featureId,
- topUpCustomCurrencyId,
additionalProperties,
)
}
@@ -10091,7 +10558,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "OveragePricingModel{billingModel=$billingModel, pricePeriods=$pricePeriods, billingCadence=$billingCadence, entitlement=$entitlement, featureId=$featureId, topUpCustomCurrencyId=$topUpCustomCurrencyId, additionalProperties=$additionalProperties}"
+ "OveragePricingModel{billingModel=$billingModel, pricePeriods=$pricePeriods, billingCadence=$billingCadence, creditEntitlement=$creditEntitlement, currencyId=$currencyId, entitlement=$entitlement, featureId=$featureId, additionalProperties=$additionalProperties}"
}
/** A pricing model configuration with billing details and price periods. */
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateCostParams.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateParams.kt
similarity index 97%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateCostParams.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateParams.kt
index 494564fc..bec979cb 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateCostParams.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateParams.kt
@@ -26,7 +26,7 @@ import kotlin.jvm.optionals.getOrNull
* Estimates the credit cost of a usage report without recording it. Returns the estimated cost per
* credit currency, the current balance, and the balance after the estimated consumption.
*/
-class UsageEstimateCostParams
+class UsageEstimateParams
private constructor(
private val xAccountId: String?,
private val xEnvironmentId: String?,
@@ -142,7 +142,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [UsageEstimateCostParams].
+ * Returns a mutable builder for constructing an instance of [UsageEstimateParams].
*
* The following fields are required:
* ```java
@@ -154,7 +154,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [UsageEstimateCostParams]. */
+ /** A builder for [UsageEstimateParams]. */
class Builder internal constructor() {
private var xAccountId: String? = null
@@ -164,12 +164,12 @@ private constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
- internal fun from(usageEstimateCostParams: UsageEstimateCostParams) = apply {
- xAccountId = usageEstimateCostParams.xAccountId
- xEnvironmentId = usageEstimateCostParams.xEnvironmentId
- body = usageEstimateCostParams.body.toBuilder()
- additionalHeaders = usageEstimateCostParams.additionalHeaders.toBuilder()
- additionalQueryParams = usageEstimateCostParams.additionalQueryParams.toBuilder()
+ internal fun from(usageEstimateParams: UsageEstimateParams) = apply {
+ xAccountId = usageEstimateParams.xAccountId
+ xEnvironmentId = usageEstimateParams.xEnvironmentId
+ body = usageEstimateParams.body.toBuilder()
+ additionalHeaders = usageEstimateParams.additionalHeaders.toBuilder()
+ additionalQueryParams = usageEstimateParams.additionalQueryParams.toBuilder()
}
fun xAccountId(xAccountId: String?) = apply { this.xAccountId = xAccountId }
@@ -393,7 +393,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [UsageEstimateCostParams].
+ * Returns an immutable instance of [UsageEstimateParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -406,8 +406,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): UsageEstimateCostParams =
- UsageEstimateCostParams(
+ fun build(): UsageEstimateParams =
+ UsageEstimateParams(
xAccountId,
xEnvironmentId,
body.build(),
@@ -1077,7 +1077,7 @@ private constructor(
return true
}
- return other is UsageEstimateCostParams &&
+ return other is UsageEstimateParams &&
xAccountId == other.xAccountId &&
xEnvironmentId == other.xEnvironmentId &&
body == other.body &&
@@ -1089,5 +1089,5 @@ private constructor(
Objects.hash(xAccountId, xEnvironmentId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "UsageEstimateCostParams{xAccountId=$xAccountId, xEnvironmentId=$xEnvironmentId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "UsageEstimateParams{xAccountId=$xAccountId, xEnvironmentId=$xEnvironmentId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateCostResponse.kt b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateResponse.kt
similarity index 98%
rename from stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateCostResponse.kt
rename to stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateResponse.kt
index 4599c21f..7edf7237 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateCostResponse.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/models/v1/usage/UsageEstimateResponse.kt
@@ -21,7 +21,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** Response object */
-class UsageEstimateCostResponse
+class UsageEstimateResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val data: JsonField,
@@ -63,7 +63,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [UsageEstimateCostResponse].
+ * Returns a mutable builder for constructing an instance of [UsageEstimateResponse].
*
* The following fields are required:
* ```java
@@ -73,16 +73,16 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [UsageEstimateCostResponse]. */
+ /** A builder for [UsageEstimateResponse]. */
class Builder internal constructor() {
private var data: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(usageEstimateCostResponse: UsageEstimateCostResponse) = apply {
- data = usageEstimateCostResponse.data
- additionalProperties = usageEstimateCostResponse.additionalProperties.toMutableMap()
+ internal fun from(usageEstimateResponse: UsageEstimateResponse) = apply {
+ data = usageEstimateResponse.data
+ additionalProperties = usageEstimateResponse.additionalProperties.toMutableMap()
}
/** Estimated credit cost, current balance and balance after */
@@ -116,7 +116,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [UsageEstimateCostResponse].
+ * Returns an immutable instance of [UsageEstimateResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -127,11 +127,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): UsageEstimateCostResponse =
- UsageEstimateCostResponse(
- checkRequired("data", data),
- additionalProperties.toMutableMap(),
- )
+ fun build(): UsageEstimateResponse =
+ UsageEstimateResponse(checkRequired("data", data), additionalProperties.toMutableMap())
}
private var validated: Boolean = false
@@ -144,7 +141,7 @@ private constructor(
* @throws StiggInvalidDataException if any value type in this object doesn't match its expected
* type.
*/
- fun validate(): UsageEstimateCostResponse = apply {
+ fun validate(): UsageEstimateResponse = apply {
if (validated) {
return@apply
}
@@ -1423,7 +1420,7 @@ private constructor(
return true
}
- return other is UsageEstimateCostResponse &&
+ return other is UsageEstimateResponse &&
data == other.data &&
additionalProperties == other.additionalProperties
}
@@ -1433,5 +1430,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "UsageEstimateCostResponse{data=$data, additionalProperties=$additionalProperties}"
+ "UsageEstimateResponse{data=$data, additionalProperties=$additionalProperties}"
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsync.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsync.kt
index b246499d..c4d975db 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsync.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsync.kt
@@ -5,10 +5,11 @@ package io.stigg.services.async.v1
import io.stigg.core.ClientOptions
import io.stigg.core.RequestOptions
import io.stigg.core.http.HttpResponseFor
-import io.stigg.models.v1.events.EventEstimateCostParams
-import io.stigg.models.v1.events.EventEstimateCostResponse
+import io.stigg.models.v1.events.EventEstimateParams
+import io.stigg.models.v1.events.EventEstimateResponse
import io.stigg.models.v1.events.EventReportParams
import io.stigg.models.v1.events.EventReportResponse
+import io.stigg.services.async.v1.events.BetaServiceAsync
import io.stigg.services.async.v1.events.DataExportServiceAsync
import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
@@ -30,19 +31,20 @@ interface EventServiceAsync {
fun dataExport(): DataExportServiceAsync
+ fun beta(): BetaServiceAsync
+
/**
* Estimates the credit cost of a usage event without ingesting it. Returns the estimated cost
* per credit currency, the current balance, and the balance after the estimated consumption.
*/
- fun estimateCost(
- params: EventEstimateCostParams
- ): CompletableFuture = estimateCost(params, RequestOptions.none())
+ fun estimate(params: EventEstimateParams): CompletableFuture =
+ estimate(params, RequestOptions.none())
- /** @see estimateCost */
- fun estimateCost(
- params: EventEstimateCostParams,
+ /** @see estimate */
+ fun estimate(
+ params: EventEstimateParams,
requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
+ ): CompletableFuture
/**
* Reports raw usage events for event-based metering. Events are ingested asynchronously and
@@ -71,20 +73,22 @@ interface EventServiceAsync {
fun dataExport(): DataExportServiceAsync.WithRawResponse
+ fun beta(): BetaServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `post /api/v1/events/estimate`, but is otherwise the same
- * as [EventServiceAsync.estimateCost].
+ * as [EventServiceAsync.estimate].
*/
- fun estimateCost(
- params: EventEstimateCostParams
- ): CompletableFuture> =
- estimateCost(params, RequestOptions.none())
-
- /** @see estimateCost */
- fun estimateCost(
- params: EventEstimateCostParams,
+ fun estimate(
+ params: EventEstimateParams
+ ): CompletableFuture> =
+ estimate(params, RequestOptions.none())
+
+ /** @see estimate */
+ fun estimate(
+ params: EventEstimateParams,
requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
+ ): CompletableFuture>
/**
* Returns a raw HTTP response for `post /api/v1/events`, but is otherwise the same as
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsyncImpl.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsyncImpl.kt
index 076f3343..d1090bc4 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsyncImpl.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/EventServiceAsyncImpl.kt
@@ -15,10 +15,12 @@ import io.stigg.core.http.HttpResponseFor
import io.stigg.core.http.json
import io.stigg.core.http.parseable
import io.stigg.core.prepareAsync
-import io.stigg.models.v1.events.EventEstimateCostParams
-import io.stigg.models.v1.events.EventEstimateCostResponse
+import io.stigg.models.v1.events.EventEstimateParams
+import io.stigg.models.v1.events.EventEstimateResponse
import io.stigg.models.v1.events.EventReportParams
import io.stigg.models.v1.events.EventReportResponse
+import io.stigg.services.async.v1.events.BetaServiceAsync
+import io.stigg.services.async.v1.events.BetaServiceAsyncImpl
import io.stigg.services.async.v1.events.DataExportServiceAsync
import io.stigg.services.async.v1.events.DataExportServiceAsyncImpl
import java.util.concurrent.CompletableFuture
@@ -36,6 +38,8 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
DataExportServiceAsyncImpl(clientOptions)
}
+ private val beta: BetaServiceAsync by lazy { BetaServiceAsyncImpl(clientOptions) }
+
override fun withRawResponse(): EventServiceAsync.WithRawResponse = withRawResponse
override fun withOptions(modifier: Consumer): EventServiceAsync =
@@ -43,12 +47,14 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun dataExport(): DataExportServiceAsync = dataExport
- override fun estimateCost(
- params: EventEstimateCostParams,
+ override fun beta(): BetaServiceAsync = beta
+
+ override fun estimate(
+ params: EventEstimateParams,
requestOptions: RequestOptions,
- ): CompletableFuture =
+ ): CompletableFuture =
// post /api/v1/events/estimate
- withRawResponse().estimateCost(params, requestOptions).thenApply { it.parse() }
+ withRawResponse().estimate(params, requestOptions).thenApply { it.parse() }
override fun report(
params: EventReportParams,
@@ -67,6 +73,10 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
DataExportServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val beta: BetaServiceAsync.WithRawResponse by lazy {
+ BetaServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: Consumer
): EventServiceAsync.WithRawResponse =
@@ -76,13 +86,15 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun dataExport(): DataExportServiceAsync.WithRawResponse = dataExport
- private val estimateCostHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
+ override fun beta(): BetaServiceAsync.WithRawResponse = beta
+
+ private val estimateHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
- override fun estimateCost(
- params: EventEstimateCostParams,
+ override fun estimate(
+ params: EventEstimateParams,
requestOptions: RequestOptions,
- ): CompletableFuture> {
+ ): CompletableFuture> {
val request =
HttpRequest.builder()
.method(HttpMethod.POST)
@@ -97,7 +109,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
.thenApply { response ->
errorHandler.handle(response).parseable {
response
- .use { estimateCostHandler.handle(it) }
+ .use { estimateHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsync.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsync.kt
index b095a013..a201e5b2 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsync.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsync.kt
@@ -5,8 +5,8 @@ package io.stigg.services.async.v1
import io.stigg.core.ClientOptions
import io.stigg.core.RequestOptions
import io.stigg.core.http.HttpResponseFor
-import io.stigg.models.v1.usage.UsageEstimateCostParams
-import io.stigg.models.v1.usage.UsageEstimateCostResponse
+import io.stigg.models.v1.usage.UsageEstimateParams
+import io.stigg.models.v1.usage.UsageEstimateResponse
import io.stigg.models.v1.usage.UsageHistoryParams
import io.stigg.models.v1.usage.UsageHistoryResponse
import io.stigg.models.v1.usage.UsageReportParams
@@ -33,15 +33,14 @@ interface UsageServiceAsync {
* Estimates the credit cost of a usage report without recording it. Returns the estimated cost
* per credit currency, the current balance, and the balance after the estimated consumption.
*/
- fun estimateCost(
- params: UsageEstimateCostParams
- ): CompletableFuture = estimateCost(params, RequestOptions.none())
+ fun estimate(params: UsageEstimateParams): CompletableFuture =
+ estimate(params, RequestOptions.none())
- /** @see estimateCost */
- fun estimateCost(
- params: UsageEstimateCostParams,
+ /** @see estimate */
+ fun estimate(
+ params: UsageEstimateParams,
requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
+ ): CompletableFuture
/** Retrieves historical usage data for a customer's metered feature over time. */
fun history(
@@ -94,18 +93,18 @@ interface UsageServiceAsync {
/**
* Returns a raw HTTP response for `post /api/v1/usage/estimate`, but is otherwise the same
- * as [UsageServiceAsync.estimateCost].
+ * as [UsageServiceAsync.estimate].
*/
- fun estimateCost(
- params: UsageEstimateCostParams
- ): CompletableFuture> =
- estimateCost(params, RequestOptions.none())
-
- /** @see estimateCost */
- fun estimateCost(
- params: UsageEstimateCostParams,
+ fun estimate(
+ params: UsageEstimateParams
+ ): CompletableFuture> =
+ estimate(params, RequestOptions.none())
+
+ /** @see estimate */
+ fun estimate(
+ params: UsageEstimateParams,
requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
+ ): CompletableFuture>
/**
* Returns a raw HTTP response for `get /api/v1/usage/{customerId}/history/{featureId}`, but
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsyncImpl.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsyncImpl.kt
index 55a1487c..bb4ee9fa 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsyncImpl.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/UsageServiceAsyncImpl.kt
@@ -16,8 +16,8 @@ import io.stigg.core.http.HttpResponseFor
import io.stigg.core.http.json
import io.stigg.core.http.parseable
import io.stigg.core.prepareAsync
-import io.stigg.models.v1.usage.UsageEstimateCostParams
-import io.stigg.models.v1.usage.UsageEstimateCostResponse
+import io.stigg.models.v1.usage.UsageEstimateParams
+import io.stigg.models.v1.usage.UsageEstimateResponse
import io.stigg.models.v1.usage.UsageHistoryParams
import io.stigg.models.v1.usage.UsageHistoryResponse
import io.stigg.models.v1.usage.UsageReportParams
@@ -39,12 +39,12 @@ class UsageServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun withOptions(modifier: Consumer): UsageServiceAsync =
UsageServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
- override fun estimateCost(
- params: UsageEstimateCostParams,
+ override fun estimate(
+ params: UsageEstimateParams,
requestOptions: RequestOptions,
- ): CompletableFuture =
+ ): CompletableFuture =
// post /api/v1/usage/estimate
- withRawResponse().estimateCost(params, requestOptions).thenApply { it.parse() }
+ withRawResponse().estimate(params, requestOptions).thenApply { it.parse() }
override fun history(
params: UsageHistoryParams,
@@ -73,13 +73,13 @@ class UsageServiceAsyncImpl internal constructor(private val clientOptions: Clie
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val estimateCostHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
+ private val estimateHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
- override fun estimateCost(
- params: UsageEstimateCostParams,
+ override fun estimate(
+ params: UsageEstimateParams,
requestOptions: RequestOptions,
- ): CompletableFuture> {
+ ): CompletableFuture> {
val request =
HttpRequest.builder()
.method(HttpMethod.POST)
@@ -94,7 +94,7 @@ class UsageServiceAsyncImpl internal constructor(private val clientOptions: Clie
.thenApply { response ->
errorHandler.handle(response).parseable {
response
- .use { estimateCostHandler.handle(it) }
+ .use { estimateHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/BetaServiceAsync.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/BetaServiceAsync.kt
new file mode 100644
index 00000000..15c1b40f
--- /dev/null
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/BetaServiceAsync.kt
@@ -0,0 +1,37 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.stigg.services.async.v1.events
+
+import io.stigg.core.ClientOptions
+import io.stigg.services.async.v1.events.beta.CustomerServiceAsync
+import java.util.function.Consumer
+
+interface BetaServiceAsync {
+
+ /**
+ * Returns a view of this service that provides access to raw HTTP responses for each method.
+ */
+ fun withRawResponse(): WithRawResponse
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): BetaServiceAsync
+
+ fun customers(): CustomerServiceAsync
+
+ /** A view of [BetaServiceAsync] that provides access to raw HTTP responses for each method. */
+ interface WithRawResponse {
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): BetaServiceAsync.WithRawResponse
+
+ fun customers(): CustomerServiceAsync.WithRawResponse
+ }
+}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/BetaServiceAsyncImpl.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/BetaServiceAsyncImpl.kt
new file mode 100644
index 00000000..e964b922
--- /dev/null
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/BetaServiceAsyncImpl.kt
@@ -0,0 +1,42 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.stigg.services.async.v1.events
+
+import io.stigg.core.ClientOptions
+import io.stigg.services.async.v1.events.beta.CustomerServiceAsync
+import io.stigg.services.async.v1.events.beta.CustomerServiceAsyncImpl
+import java.util.function.Consumer
+
+class BetaServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
+ BetaServiceAsync {
+
+ private val withRawResponse: BetaServiceAsync.WithRawResponse by lazy {
+ WithRawResponseImpl(clientOptions)
+ }
+
+ private val customers: CustomerServiceAsync by lazy { CustomerServiceAsyncImpl(clientOptions) }
+
+ override fun withRawResponse(): BetaServiceAsync.WithRawResponse = withRawResponse
+
+ override fun withOptions(modifier: Consumer): BetaServiceAsync =
+ BetaServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
+ override fun customers(): CustomerServiceAsync = customers
+
+ class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
+ BetaServiceAsync.WithRawResponse {
+
+ private val customers: CustomerServiceAsync.WithRawResponse by lazy {
+ CustomerServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
+ override fun withOptions(
+ modifier: Consumer
+ ): BetaServiceAsync.WithRawResponse =
+ BetaServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
+ override fun customers(): CustomerServiceAsync.WithRawResponse = customers
+ }
+}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/beta/CustomerServiceAsync.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/beta/CustomerServiceAsync.kt
new file mode 100644
index 00000000..866a44e7
--- /dev/null
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/beta/CustomerServiceAsync.kt
@@ -0,0 +1,127 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.stigg.services.async.v1.events.beta
+
+import io.stigg.core.ClientOptions
+import io.stigg.core.RequestOptions
+import io.stigg.core.http.HttpResponseFor
+import io.stigg.models.v1.events.beta.customers.CustomerRetrieveGovernanceParams
+import io.stigg.models.v1.events.beta.customers.CustomerRetrieveGovernanceResponse
+import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+
+interface CustomerServiceAsync {
+
+ /**
+ * Returns a view of this service that provides access to raw HTTP responses for each method.
+ */
+ fun withRawResponse(): WithRawResponse
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): CustomerServiceAsync
+
+ /**
+ * Queries the customer's governance hierarchy tree, returning a cursor-paginated list of nodes
+ * with their usage configuration (limit, cadence, scope) and current usage, sortable and
+ * filterable by usage. Each node carries `parentId` so the tree can be rebuilt client-side.
+ * Usage is read from a periodically-refreshed read model and never gates access.
+ */
+ fun retrieveGovernance(id: String): CompletableFuture =
+ retrieveGovernance(id, CustomerRetrieveGovernanceParams.none())
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ id: String,
+ params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture =
+ retrieveGovernance(params.toBuilder().id(id).build(), requestOptions)
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ id: String,
+ params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
+ ): CompletableFuture =
+ retrieveGovernance(id, params, RequestOptions.none())
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ params: CustomerRetrieveGovernanceParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ params: CustomerRetrieveGovernanceParams
+ ): CompletableFuture =
+ retrieveGovernance(params, RequestOptions.none())
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ id: String,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ retrieveGovernance(id, CustomerRetrieveGovernanceParams.none(), requestOptions)
+
+ /**
+ * A view of [CustomerServiceAsync] that provides access to raw HTTP responses for each method.
+ */
+ interface WithRawResponse {
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): CustomerServiceAsync.WithRawResponse
+
+ /**
+ * Returns a raw HTTP response for `get /api/v1-beta/customers/{id}/governance`, but is
+ * otherwise the same as [CustomerServiceAsync.retrieveGovernance].
+ */
+ fun retrieveGovernance(
+ id: String
+ ): CompletableFuture> =
+ retrieveGovernance(id, CustomerRetrieveGovernanceParams.none())
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ id: String,
+ params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture> =
+ retrieveGovernance(params.toBuilder().id(id).build(), requestOptions)
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ id: String,
+ params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
+ ): CompletableFuture> =
+ retrieveGovernance(id, params, RequestOptions.none())
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ params: CustomerRetrieveGovernanceParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture>
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ params: CustomerRetrieveGovernanceParams
+ ): CompletableFuture> =
+ retrieveGovernance(params, RequestOptions.none())
+
+ /** @see retrieveGovernance */
+ fun retrieveGovernance(
+ id: String,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> =
+ retrieveGovernance(id, CustomerRetrieveGovernanceParams.none(), requestOptions)
+ }
+}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/beta/CustomerServiceAsyncImpl.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/beta/CustomerServiceAsyncImpl.kt
new file mode 100644
index 00000000..50ef86aa
--- /dev/null
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/beta/CustomerServiceAsyncImpl.kt
@@ -0,0 +1,95 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.stigg.services.async.v1.events.beta
+
+import io.stigg.core.ClientOptions
+import io.stigg.core.RequestOptions
+import io.stigg.core.checkRequired
+import io.stigg.core.handlers.errorBodyHandler
+import io.stigg.core.handlers.errorHandler
+import io.stigg.core.handlers.jsonHandler
+import io.stigg.core.http.HttpMethod
+import io.stigg.core.http.HttpRequest
+import io.stigg.core.http.HttpResponse
+import io.stigg.core.http.HttpResponse.Handler
+import io.stigg.core.http.HttpResponseFor
+import io.stigg.core.http.parseable
+import io.stigg.core.prepareAsync
+import io.stigg.models.v1.events.beta.customers.CustomerRetrieveGovernanceParams
+import io.stigg.models.v1.events.beta.customers.CustomerRetrieveGovernanceResponse
+import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import kotlin.jvm.optionals.getOrNull
+
+class CustomerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
+ CustomerServiceAsync {
+
+ private val withRawResponse: CustomerServiceAsync.WithRawResponse by lazy {
+ WithRawResponseImpl(clientOptions)
+ }
+
+ override fun withRawResponse(): CustomerServiceAsync.WithRawResponse = withRawResponse
+
+ override fun withOptions(modifier: Consumer): CustomerServiceAsync =
+ CustomerServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
+ override fun retrieveGovernance(
+ params: CustomerRetrieveGovernanceParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ // get /api/v1-beta/customers/{id}/governance
+ withRawResponse().retrieveGovernance(params, requestOptions).thenApply { it.parse() }
+
+ class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
+ CustomerServiceAsync.WithRawResponse {
+
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
+
+ override fun withOptions(
+ modifier: Consumer
+ ): CustomerServiceAsync.WithRawResponse =
+ CustomerServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
+ private val retrieveGovernanceHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun retrieveGovernance(
+ params: CustomerRetrieveGovernanceParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("id", params.id().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments(
+ "api",
+ "v1-beta",
+ "customers",
+ params._pathParam(0),
+ "governance",
+ )
+ .build()
+ .prepareAsync(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ return request
+ .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
+ .thenApply { response ->
+ errorHandler.handle(response).parseable {
+ response
+ .use { retrieveGovernanceHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsync.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsync.kt
index 9e44c15a..e24d552b 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsync.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsync.kt
@@ -9,8 +9,8 @@ import io.stigg.models.v1.events.dataexport.destinations.DestinationCreateParams
import io.stigg.models.v1.events.dataexport.destinations.DestinationCreateResponse
import io.stigg.models.v1.events.dataexport.destinations.DestinationDeleteParams
import io.stigg.models.v1.events.dataexport.destinations.DestinationDeleteResponse
-import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateParams
-import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateResponse
+import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateSelectionParams
+import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateSelectionResponse
import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
@@ -41,34 +41,6 @@ interface DestinationServiceAsync {
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture
- /**
- * Update a destination's entity selection. Pushes the new enabled_models to the provider first,
- * then persists the selection. Applies on the next scheduled transfer.
- */
- fun update(
- destinationId: String,
- params: DestinationUpdateParams,
- ): CompletableFuture =
- update(destinationId, params, RequestOptions.none())
-
- /** @see update */
- fun update(
- destinationId: String,
- params: DestinationUpdateParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture =
- update(params.toBuilder().destinationId(destinationId).build(), requestOptions)
-
- /** @see update */
- fun update(params: DestinationUpdateParams): CompletableFuture =
- update(params, RequestOptions.none())
-
- /** @see update */
- fun update(
- params: DestinationUpdateParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
-
/**
* Disconnect a destination: stops the provider sync (deletes the provider destination) and
* removes it from the DATA_EXPORT integration. Non-destructive — the warehouse table is left
@@ -109,6 +81,36 @@ interface DestinationServiceAsync {
): CompletableFuture =
delete(destinationId, DestinationDeleteParams.none(), requestOptions)
+ /**
+ * Update a destination's entity selection. Pushes the new enabled_models to the provider first,
+ * then persists the selection. Applies on the next scheduled transfer.
+ */
+ fun updateSelection(
+ destinationId: String,
+ params: DestinationUpdateSelectionParams,
+ ): CompletableFuture =
+ updateSelection(destinationId, params, RequestOptions.none())
+
+ /** @see updateSelection */
+ fun updateSelection(
+ destinationId: String,
+ params: DestinationUpdateSelectionParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture =
+ updateSelection(params.toBuilder().destinationId(destinationId).build(), requestOptions)
+
+ /** @see updateSelection */
+ fun updateSelection(
+ params: DestinationUpdateSelectionParams
+ ): CompletableFuture =
+ updateSelection(params, RequestOptions.none())
+
+ /** @see updateSelection */
+ fun updateSelection(
+ params: DestinationUpdateSelectionParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture
+
/**
* A view of [DestinationServiceAsync] that provides access to raw HTTP responses for each
* method.
@@ -139,36 +141,6 @@ interface DestinationServiceAsync {
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
- /**
- * Returns a raw HTTP response for `patch /api/v1/data-export/destinations/{destinationId}`,
- * but is otherwise the same as [DestinationServiceAsync.update].
- */
- fun update(
- destinationId: String,
- params: DestinationUpdateParams,
- ): CompletableFuture> =
- update(destinationId, params, RequestOptions.none())
-
- /** @see update */
- fun update(
- destinationId: String,
- params: DestinationUpdateParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture> =
- update(params.toBuilder().destinationId(destinationId).build(), requestOptions)
-
- /** @see update */
- fun update(
- params: DestinationUpdateParams
- ): CompletableFuture> =
- update(params, RequestOptions.none())
-
- /** @see update */
- fun update(
- params: DestinationUpdateParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
-
/**
* Returns a raw HTTP response for `delete
* /api/v1/data-export/destinations/{destinationId}`, but is otherwise the same as
@@ -212,5 +184,35 @@ interface DestinationServiceAsync {
requestOptions: RequestOptions,
): CompletableFuture> =
delete(destinationId, DestinationDeleteParams.none(), requestOptions)
+
+ /**
+ * Returns a raw HTTP response for `patch /api/v1/data-export/destinations/{destinationId}`,
+ * but is otherwise the same as [DestinationServiceAsync.updateSelection].
+ */
+ fun updateSelection(
+ destinationId: String,
+ params: DestinationUpdateSelectionParams,
+ ): CompletableFuture> =
+ updateSelection(destinationId, params, RequestOptions.none())
+
+ /** @see updateSelection */
+ fun updateSelection(
+ destinationId: String,
+ params: DestinationUpdateSelectionParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture> =
+ updateSelection(params.toBuilder().destinationId(destinationId).build(), requestOptions)
+
+ /** @see updateSelection */
+ fun updateSelection(
+ params: DestinationUpdateSelectionParams
+ ): CompletableFuture> =
+ updateSelection(params, RequestOptions.none())
+
+ /** @see updateSelection */
+ fun updateSelection(
+ params: DestinationUpdateSelectionParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture>
}
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsyncImpl.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsyncImpl.kt
index 318a0ee1..ac1f6f06 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsyncImpl.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1/events/dataexport/DestinationServiceAsyncImpl.kt
@@ -20,8 +20,8 @@ import io.stigg.models.v1.events.dataexport.destinations.DestinationCreateParams
import io.stigg.models.v1.events.dataexport.destinations.DestinationCreateResponse
import io.stigg.models.v1.events.dataexport.destinations.DestinationDeleteParams
import io.stigg.models.v1.events.dataexport.destinations.DestinationDeleteResponse
-import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateParams
-import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateResponse
+import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateSelectionParams
+import io.stigg.models.v1.events.dataexport.destinations.DestinationUpdateSelectionResponse
import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
@@ -45,13 +45,6 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
// post /api/v1/data-export/destinations
withRawResponse().create(params, requestOptions).thenApply { it.parse() }
- override fun update(
- params: DestinationUpdateParams,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- // patch /api/v1/data-export/destinations/{destinationId}
- withRawResponse().update(params, requestOptions).thenApply { it.parse() }
-
override fun delete(
params: DestinationDeleteParams,
requestOptions: RequestOptions,
@@ -59,6 +52,13 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
// delete /api/v1/data-export/destinations/{destinationId}
withRawResponse().delete(params, requestOptions).thenApply { it.parse() }
+ override fun updateSelection(
+ params: DestinationUpdateSelectionParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ // patch /api/v1/data-export/destinations/{destinationId}
+ withRawResponse().updateSelection(params, requestOptions).thenApply { it.parse() }
+
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
DestinationServiceAsync.WithRawResponse {
@@ -103,19 +103,19 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
+ private val deleteHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
- override fun update(
- params: DestinationUpdateParams,
+ override fun delete(
+ params: DestinationDeleteParams,
requestOptions: RequestOptions,
- ): CompletableFuture> {
+ ): CompletableFuture> {
// We check here instead of in the params builder because this can be specified
// positionally or in the params class.
checkRequired("destinationId", params.destinationId().getOrNull())
val request =
HttpRequest.builder()
- .method(HttpMethod.PATCH)
+ .method(HttpMethod.DELETE)
.baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
@@ -124,7 +124,7 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
"destinations",
params._pathParam(0),
)
- .body(json(clientOptions.jsonMapper, params._body()))
+ .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } }
.build()
.prepareAsync(clientOptions, params)
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
@@ -133,7 +133,7 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
.thenApply { response ->
errorHandler.handle(response).parseable {
response
- .use { updateHandler.handle(it) }
+ .use { deleteHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
@@ -143,19 +143,19 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
}
}
- private val deleteHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
+ private val updateSelectionHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
- override fun delete(
- params: DestinationDeleteParams,
+ override fun updateSelection(
+ params: DestinationUpdateSelectionParams,
requestOptions: RequestOptions,
- ): CompletableFuture> {
+ ): CompletableFuture> {
// We check here instead of in the params builder because this can be specified
// positionally or in the params class.
checkRequired("destinationId", params.destinationId().getOrNull())
val request =
HttpRequest.builder()
- .method(HttpMethod.DELETE)
+ .method(HttpMethod.PATCH)
.baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
@@ -164,7 +164,7 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
"destinations",
params._pathParam(0),
)
- .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } }
+ .body(json(clientOptions.jsonMapper, params._body()))
.build()
.prepareAsync(clientOptions, params)
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
@@ -173,7 +173,7 @@ class DestinationServiceAsyncImpl internal constructor(private val clientOptions
.thenApply { response ->
errorHandler.handle(response).parseable {
response
- .use { deleteHandler.handle(it) }
+ .use { updateSelectionHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsync.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsync.kt
index 5acd1f4b..cc76106d 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsync.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsync.kt
@@ -3,14 +3,9 @@
package io.stigg.services.async.v1beta
import io.stigg.core.ClientOptions
-import io.stigg.core.RequestOptions
-import io.stigg.core.http.HttpResponseFor
-import io.stigg.models.v1beta.customers.CustomerRetrieveGovernanceParams
-import io.stigg.models.v1beta.customers.CustomerRetrieveGovernanceResponse
import io.stigg.services.async.v1beta.customers.AssignmentServiceAsync
import io.stigg.services.async.v1beta.customers.EntitlementServiceAsync
import io.stigg.services.async.v1beta.customers.EntityServiceAsync
-import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
interface CustomerServiceAsync {
@@ -33,49 +28,6 @@ interface CustomerServiceAsync {
fun assignments(): AssignmentServiceAsync
- /**
- * Queries the customer's governance hierarchy tree, returning a cursor-paginated list of nodes
- * with their usage configuration (limit, cadence, scope) and current usage, sortable and
- * filterable by usage. Each node carries `parentId` so the tree can be rebuilt client-side.
- * Usage is read from a periodically-refreshed read model and never gates access.
- */
- fun retrieveGovernance(id: String): CompletableFuture =
- retrieveGovernance(id, CustomerRetrieveGovernanceParams.none())
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- id: String,
- params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture =
- retrieveGovernance(params.toBuilder().id(id).build(), requestOptions)
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- id: String,
- params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
- ): CompletableFuture =
- retrieveGovernance(id, params, RequestOptions.none())
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- params: CustomerRetrieveGovernanceParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- params: CustomerRetrieveGovernanceParams
- ): CompletableFuture =
- retrieveGovernance(params, RequestOptions.none())
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- id: String,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- retrieveGovernance(id, CustomerRetrieveGovernanceParams.none(), requestOptions)
-
/**
* A view of [CustomerServiceAsync] that provides access to raw HTTP responses for each method.
*/
@@ -95,48 +47,5 @@ interface CustomerServiceAsync {
fun entities(): EntityServiceAsync.WithRawResponse
fun assignments(): AssignmentServiceAsync.WithRawResponse
-
- /**
- * Returns a raw HTTP response for `get /api/v1-beta/customers/{id}/governance`, but is
- * otherwise the same as [CustomerServiceAsync.retrieveGovernance].
- */
- fun retrieveGovernance(
- id: String
- ): CompletableFuture> =
- retrieveGovernance(id, CustomerRetrieveGovernanceParams.none())
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- id: String,
- params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture> =
- retrieveGovernance(params.toBuilder().id(id).build(), requestOptions)
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- id: String,
- params: CustomerRetrieveGovernanceParams = CustomerRetrieveGovernanceParams.none(),
- ): CompletableFuture> =
- retrieveGovernance(id, params, RequestOptions.none())
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- params: CustomerRetrieveGovernanceParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- params: CustomerRetrieveGovernanceParams
- ): CompletableFuture> =
- retrieveGovernance(params, RequestOptions.none())
-
- /** @see retrieveGovernance */
- fun retrieveGovernance(
- id: String,
- requestOptions: RequestOptions,
- ): CompletableFuture> =
- retrieveGovernance(id, CustomerRetrieveGovernanceParams.none(), requestOptions)
}
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsyncImpl.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsyncImpl.kt
index ba51b17b..9b3f7bb7 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsyncImpl.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/async/v1beta/CustomerServiceAsyncImpl.kt
@@ -3,29 +3,13 @@
package io.stigg.services.async.v1beta
import io.stigg.core.ClientOptions
-import io.stigg.core.RequestOptions
-import io.stigg.core.checkRequired
-import io.stigg.core.handlers.errorBodyHandler
-import io.stigg.core.handlers.errorHandler
-import io.stigg.core.handlers.jsonHandler
-import io.stigg.core.http.HttpMethod
-import io.stigg.core.http.HttpRequest
-import io.stigg.core.http.HttpResponse
-import io.stigg.core.http.HttpResponse.Handler
-import io.stigg.core.http.HttpResponseFor
-import io.stigg.core.http.parseable
-import io.stigg.core.prepareAsync
-import io.stigg.models.v1beta.customers.CustomerRetrieveGovernanceParams
-import io.stigg.models.v1beta.customers.CustomerRetrieveGovernanceResponse
import io.stigg.services.async.v1beta.customers.AssignmentServiceAsync
import io.stigg.services.async.v1beta.customers.AssignmentServiceAsyncImpl
import io.stigg.services.async.v1beta.customers.EntitlementServiceAsync
import io.stigg.services.async.v1beta.customers.EntitlementServiceAsyncImpl
import io.stigg.services.async.v1beta.customers.EntityServiceAsync
import io.stigg.services.async.v1beta.customers.EntityServiceAsyncImpl
-import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
-import kotlin.jvm.optionals.getOrNull
class CustomerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
CustomerServiceAsync {
@@ -55,19 +39,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
override fun assignments(): AssignmentServiceAsync = assignments
- override fun retrieveGovernance(
- params: CustomerRetrieveGovernanceParams,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- // get /api/v1-beta/customers/{id}/governance
- withRawResponse().retrieveGovernance(params, requestOptions).thenApply { it.parse() }
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CustomerServiceAsync.WithRawResponse {
- private val errorHandler: Handler =
- errorHandler(errorBodyHandler(clientOptions.jsonMapper))
-
private val entitlements: EntitlementServiceAsync.WithRawResponse by lazy {
EntitlementServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
@@ -92,44 +66,5 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
override fun entities(): EntityServiceAsync.WithRawResponse = entities
override fun assignments(): AssignmentServiceAsync.WithRawResponse = assignments
-
- private val retrieveGovernanceHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun retrieveGovernance(
- params: CustomerRetrieveGovernanceParams,
- requestOptions: RequestOptions,
- ): CompletableFuture> {
- // We check here instead of in the params builder because this can be specified
- // positionally or in the params class.
- checkRequired("id", params.id().getOrNull())
- val request =
- HttpRequest.builder()
- .method(HttpMethod.GET)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments(
- "api",
- "v1-beta",
- "customers",
- params._pathParam(0),
- "governance",
- )
- .build()
- .prepareAsync(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- return request
- .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
- .thenApply { response ->
- errorHandler.handle(response).parseable {
- response
- .use { retrieveGovernanceHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
- }
}
}
diff --git a/stigg-java-core/src/main/kotlin/io/stigg/services/blocking/v1/EventService.kt b/stigg-java-core/src/main/kotlin/io/stigg/services/blocking/v1/EventService.kt
index 9fc81dec..9ebda4f6 100644
--- a/stigg-java-core/src/main/kotlin/io/stigg/services/blocking/v1/EventService.kt
+++ b/stigg-java-core/src/main/kotlin/io/stigg/services/blocking/v1/EventService.kt
@@ -6,10 +6,11 @@ import com.google.errorprone.annotations.MustBeClosed
import io.stigg.core.ClientOptions
import io.stigg.core.RequestOptions
import io.stigg.core.http.HttpResponseFor
-import io.stigg.models.v1.events.EventEstimateCostParams
-import io.stigg.models.v1.events.EventEstimateCostResponse
+import io.stigg.models.v1.events.EventEstimateParams
+import io.stigg.models.v1.events.EventEstimateResponse
import io.stigg.models.v1.events.EventReportParams
import io.stigg.models.v1.events.EventReportResponse
+import io.stigg.services.blocking.v1.events.BetaService
import io.stigg.services.blocking.v1.events.DataExportService
import java.util.function.Consumer
@@ -30,18 +31,20 @@ interface EventService {
fun dataExport(): DataExportService
+ fun beta(): BetaService
+
/**
* Estimates the credit cost of a usage event without ingesting it. Returns the estimated cost
* per credit currency, the current balance, and the balance after the estimated consumption.
*/
- fun estimateCost(params: EventEstimateCostParams): EventEstimateCostResponse =
- estimateCost(params, RequestOptions.none())
+ fun estimate(params: EventEstimateParams): EventEstimateResponse =
+ estimate(params, RequestOptions.none())
- /** @see estimateCost */
- fun estimateCost(
- params: EventEstimateCostParams,
+ /** @see estimate */
+ fun estimate(
+ params: EventEstimateParams,
requestOptions: RequestOptions = RequestOptions.none(),
- ): EventEstimateCostResponse
+ ): EventEstimateResponse
/**
* Reports raw usage events for event-based metering. Events are ingested asynchronously and
@@ -68,21 +71,22 @@ interface EventService {
fun dataExport(): DataExportService.WithRawResponse
+ fun beta(): BetaService.WithRawResponse
+
/**
* Returns a raw HTTP response for `post /api/v1/events/estimate`, but is otherwise the same
- * as [EventService.estimateCost].
+ * as [EventService.estimate].
*/
@MustBeClosed
- fun estimateCost(
- params: EventEstimateCostParams
- ): HttpResponseFor