diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ea3d667ed..0a7c04585 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.36.0"
+ ".": "4.37.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 6359ad060..e5ac7b3ad 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 232
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-50d816559ef0935e64d07789ff936a2b762e26ab0714a2fa6bc06d06d4484294.yml
-openapi_spec_hash: c5d8f37edbf66c1fef627d787b4c54fd
-config_hash: b64135fff1fe9cf4069b9ecf59ae8b07
+configured_endpoints: 261
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-afacc4343d0efc074c8c5667eb83570642c8b9acaa7792ca8e075c6d18ef9f3a.yml
+openapi_spec_hash: a62a557c61532681963fd21e748b0eb4
+config_hash: bb69d8d0771dbac4a84fc6dca11e3ceb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18b285fb8..0a5762094 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog
+## 4.37.0 (2026-05-21)
+
+Full Changelog: [v4.36.0...v4.37.0](https://github.com/openai/openai-java/compare/v4.36.0...v4.37.0)
+
+### Features
+
+* **api:** manual updates ([751f476](https://github.com/openai/openai-java/commit/751f476ae83e88dcf122aa2d34bdc16983e800b4))
+* **api:** manual updates ([1a21364](https://github.com/openai/openai-java/commit/1a21364f95933116344b0ab703796fb559eb8735))
+* **api:** update OpenAPI spec or Stainless config ([33debac](https://github.com/openai/openai-java/commit/33debacb88320787265e083cbdb91ec6e3e812f5))
+
+
+### Chores
+
+* **api:** docs updates ([704032e](https://github.com/openai/openai-java/commit/704032ebbb3244054e5e8425c82dfe45562378e9))
+
## 4.36.0 (2026-05-13)
Full Changelog: [v4.35.0...v4.36.0](https://github.com/openai/openai-java/compare/v4.35.0...v4.36.0)
diff --git a/README.md b/README.md
index 8ed9b76a3..d2bd6c31b 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.36.0)
-[](https://javadoc.io/doc/com.openai/openai-java/4.36.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.37.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.37.0)
@@ -11,7 +11,7 @@ The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://
-The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.36.0).
+The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.37.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
### Gradle
```kotlin
-implementation("com.openai:openai-java:4.36.0")
+implementation("com.openai:openai-java:4.37.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.36.0")
com.openai
openai-java
- 4.36.0
+ 4.37.0
```
@@ -1433,7 +1433,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
#### Gradle
```kotlin
-implementation("com.openai:openai-java-spring-boot-starter:4.36.0")
+implementation("com.openai:openai-java-spring-boot-starter:4.37.0")
```
#### Maven
@@ -1442,7 +1442,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.36.0")
com.openai
openai-java-spring-boot-starter
- 4.36.0
+ 4.37.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 13b4e5b0b..0242a2387 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.36.0" // x-release-please-version
+ version = "4.37.0" // x-release-please-version
}
subprojects {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/DataRetentionRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/DataRetentionRetrieveParams.kt
new file mode 100644
index 000000000..2633a9d80
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/DataRetentionRetrieveParams.kt
@@ -0,0 +1,172 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.admin.organization.dataretention
+
+import com.openai.core.Params
+import com.openai.core.http.Headers
+import com.openai.core.http.QueryParams
+import java.util.Objects
+
+/** Retrieves organization data retention controls. */
+class DataRetentionRetrieveParams
+private constructor(
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun none(): DataRetentionRetrieveParams = builder().build()
+
+ /**
+ * Returns a mutable builder for constructing an instance of [DataRetentionRetrieveParams].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [DataRetentionRetrieveParams]. */
+ class Builder internal constructor() {
+
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(dataRetentionRetrieveParams: DataRetentionRetrieveParams) = apply {
+ additionalHeaders = dataRetentionRetrieveParams.additionalHeaders.toBuilder()
+ additionalQueryParams = dataRetentionRetrieveParams.additionalQueryParams.toBuilder()
+ }
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [DataRetentionRetrieveParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): DataRetentionRetrieveParams =
+ DataRetentionRetrieveParams(additionalHeaders.build(), additionalQueryParams.build())
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is DataRetentionRetrieveParams &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "DataRetentionRetrieveParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/DataRetentionUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/DataRetentionUpdateParams.kt
new file mode 100644
index 000000000..6da48966f
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/DataRetentionUpdateParams.kt
@@ -0,0 +1,596 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.admin.organization.dataretention
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.openai.core.Enum
+import com.openai.core.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.Params
+import com.openai.core.checkRequired
+import com.openai.core.http.Headers
+import com.openai.core.http.QueryParams
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+/** Updates organization data retention controls. */
+class DataRetentionUpdateParams
+private constructor(
+ private val body: Body,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /**
+ * The desired organization data retention type.
+ *
+ * @throws OpenAIInvalidDataException 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 retentionType(): RetentionType = body.retentionType()
+
+ /**
+ * Returns the raw JSON value of [retentionType].
+ *
+ * Unlike [retentionType], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _retentionType(): JsonField = body._retentionType()
+
+ fun _additionalBodyProperties(): Map = body._additionalProperties()
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [DataRetentionUpdateParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .retentionType()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [DataRetentionUpdateParams]. */
+ class Builder internal constructor() {
+
+ private var body: Body.Builder = Body.builder()
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(dataRetentionUpdateParams: DataRetentionUpdateParams) = apply {
+ body = dataRetentionUpdateParams.body.toBuilder()
+ additionalHeaders = dataRetentionUpdateParams.additionalHeaders.toBuilder()
+ additionalQueryParams = dataRetentionUpdateParams.additionalQueryParams.toBuilder()
+ }
+
+ /**
+ * Sets the entire request body.
+ *
+ * This is generally only useful if you are already constructing the body separately.
+ * Otherwise, it's more convenient to use the top-level setters instead:
+ * - [retentionType]
+ */
+ fun body(body: Body) = apply { this.body = body.toBuilder() }
+
+ /** The desired organization data retention type. */
+ fun retentionType(retentionType: RetentionType) = apply {
+ body.retentionType(retentionType)
+ }
+
+ /**
+ * Sets [Builder.retentionType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.retentionType] with a well-typed [RetentionType] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun retentionType(retentionType: JsonField) = apply {
+ body.retentionType(retentionType)
+ }
+
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ body.additionalProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ body.putAdditionalProperty(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
+ apply {
+ body.putAllAdditionalProperties(additionalBodyProperties)
+ }
+
+ fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ body.removeAllAdditionalProperties(keys)
+ }
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [DataRetentionUpdateParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .retentionType()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): DataRetentionUpdateParams =
+ DataRetentionUpdateParams(
+ body.build(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): Body = body
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ /** Parameters for updating organization data retention controls. */
+ class Body
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val retentionType: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("retention_type")
+ @ExcludeMissing
+ retentionType: JsonField = JsonMissing.of()
+ ) : this(retentionType, mutableMapOf())
+
+ /**
+ * The desired organization data retention type.
+ *
+ * @throws OpenAIInvalidDataException 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 retentionType(): RetentionType = retentionType.getRequired("retention_type")
+
+ /**
+ * Returns the raw JSON value of [retentionType].
+ *
+ * Unlike [retentionType], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("retention_type")
+ @ExcludeMissing
+ fun _retentionType(): JsonField = retentionType
+
+ @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 [Body].
+ *
+ * The following fields are required:
+ * ```java
+ * .retentionType()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Body]. */
+ class Builder internal constructor() {
+
+ private var retentionType: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(body: Body) = apply {
+ retentionType = body.retentionType
+ additionalProperties = body.additionalProperties.toMutableMap()
+ }
+
+ /** The desired organization data retention type. */
+ fun retentionType(retentionType: RetentionType) =
+ retentionType(JsonField.of(retentionType))
+
+ /**
+ * Sets [Builder.retentionType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.retentionType] with a well-typed [RetentionType]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun retentionType(retentionType: JsonField) = apply {
+ this.retentionType = retentionType
+ }
+
+ 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 [Body].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .retentionType()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Body =
+ Body(
+ checkRequired("retentionType", retentionType),
+ 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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ retentionType().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 = (retentionType.asKnown().getOrNull()?.validity() ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Body &&
+ retentionType == other.retentionType &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(retentionType, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Body{retentionType=$retentionType, additionalProperties=$additionalProperties}"
+ }
+
+ /** The desired organization data retention type. */
+ class RetentionType @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 ZERO_DATA_RETENTION = of("zero_data_retention")
+
+ @JvmField val MODIFIED_ABUSE_MONITORING = of("modified_abuse_monitoring")
+
+ @JvmField val ENHANCED_ZERO_DATA_RETENTION = of("enhanced_zero_data_retention")
+
+ @JvmField
+ val ENHANCED_MODIFIED_ABUSE_MONITORING = of("enhanced_modified_abuse_monitoring")
+
+ @JvmStatic fun of(value: String) = RetentionType(JsonField.of(value))
+ }
+
+ /** An enum containing [RetentionType]'s known values. */
+ enum class Known {
+ ZERO_DATA_RETENTION,
+ MODIFIED_ABUSE_MONITORING,
+ ENHANCED_ZERO_DATA_RETENTION,
+ ENHANCED_MODIFIED_ABUSE_MONITORING,
+ }
+
+ /**
+ * An enum containing [RetentionType]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [RetentionType] 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 {
+ ZERO_DATA_RETENTION,
+ MODIFIED_ABUSE_MONITORING,
+ ENHANCED_ZERO_DATA_RETENTION,
+ ENHANCED_MODIFIED_ABUSE_MONITORING,
+ /**
+ * An enum member indicating that [RetentionType] 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) {
+ ZERO_DATA_RETENTION -> Value.ZERO_DATA_RETENTION
+ MODIFIED_ABUSE_MONITORING -> Value.MODIFIED_ABUSE_MONITORING
+ ENHANCED_ZERO_DATA_RETENTION -> Value.ENHANCED_ZERO_DATA_RETENTION
+ ENHANCED_MODIFIED_ABUSE_MONITORING -> Value.ENHANCED_MODIFIED_ABUSE_MONITORING
+ 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 OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ZERO_DATA_RETENTION -> Known.ZERO_DATA_RETENTION
+ MODIFIED_ABUSE_MONITORING -> Known.MODIFIED_ABUSE_MONITORING
+ ENHANCED_ZERO_DATA_RETENTION -> Known.ENHANCED_ZERO_DATA_RETENTION
+ ENHANCED_MODIFIED_ABUSE_MONITORING -> Known.ENHANCED_MODIFIED_ABUSE_MONITORING
+ else -> throw OpenAIInvalidDataException("Unknown RetentionType: $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 OpenAIInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { OpenAIInvalidDataException("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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): RetentionType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 RetentionType && 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 DataRetentionUpdateParams &&
+ body == other.body &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "DataRetentionUpdateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/OrganizationDataRetention.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/OrganizationDataRetention.kt
new file mode 100644
index 000000000..e9da1e45c
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/dataretention/OrganizationDataRetention.kt
@@ -0,0 +1,373 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.admin.organization.dataretention
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.openai.core.Enum
+import com.openai.core.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.checkRequired
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+/** Represents the organization's data retention control setting. */
+class OrganizationDataRetention
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val object_: JsonValue,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("object") @ExcludeMissing object_: JsonValue = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ ) : this(object_, type, mutableMapOf())
+
+ /**
+ * The object type, which is always `organization.data_retention`.
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("organization.data_retention")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("object") @ExcludeMissing fun _object_(): JsonValue = object_
+
+ /**
+ * The configured organization data retention type.
+ *
+ * @throws OpenAIInvalidDataException 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 type(): Type = type.getRequired("type")
+
+ /**
+ * Returns the raw JSON value of [type].
+ *
+ * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+
+ @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 [OrganizationDataRetention].
+ *
+ * The following fields are required:
+ * ```java
+ * .type()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [OrganizationDataRetention]. */
+ class Builder internal constructor() {
+
+ private var object_: JsonValue = JsonValue.from("organization.data_retention")
+ private var type: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(organizationDataRetention: OrganizationDataRetention) = apply {
+ object_ = organizationDataRetention.object_
+ type = organizationDataRetention.type
+ additionalProperties = organizationDataRetention.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("organization.data_retention")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun object_(object_: JsonValue) = apply { this.object_ = object_ }
+
+ /** The configured organization data retention type. */
+ fun type(type: Type) = type(JsonField.of(type))
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [Type] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun type(type: JsonField) = apply { this.type = type }
+
+ 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 [OrganizationDataRetention].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): OrganizationDataRetention =
+ OrganizationDataRetention(
+ object_,
+ checkRequired("type", type),
+ 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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): OrganizationDataRetention = apply {
+ if (validated) {
+ return@apply
+ }
+
+ _object_().let {
+ if (it != JsonValue.from("organization.data_retention")) {
+ throw OpenAIInvalidDataException("'object_' is invalid, received $it")
+ }
+ }
+ type().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 =
+ object_.let { if (it == JsonValue.from("organization.data_retention")) 1 else 0 } +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** The configured organization data retention type. */
+ class Type @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 ZERO_DATA_RETENTION = of("zero_data_retention")
+
+ @JvmField val MODIFIED_ABUSE_MONITORING = of("modified_abuse_monitoring")
+
+ @JvmField val ENHANCED_ZERO_DATA_RETENTION = of("enhanced_zero_data_retention")
+
+ @JvmField
+ val ENHANCED_MODIFIED_ABUSE_MONITORING = of("enhanced_modified_abuse_monitoring")
+
+ @JvmStatic fun of(value: String) = Type(JsonField.of(value))
+ }
+
+ /** An enum containing [Type]'s known values. */
+ enum class Known {
+ ZERO_DATA_RETENTION,
+ MODIFIED_ABUSE_MONITORING,
+ ENHANCED_ZERO_DATA_RETENTION,
+ ENHANCED_MODIFIED_ABUSE_MONITORING,
+ }
+
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] 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 {
+ ZERO_DATA_RETENTION,
+ MODIFIED_ABUSE_MONITORING,
+ ENHANCED_ZERO_DATA_RETENTION,
+ ENHANCED_MODIFIED_ABUSE_MONITORING,
+ /** An enum member indicating that [Type] 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) {
+ ZERO_DATA_RETENTION -> Value.ZERO_DATA_RETENTION
+ MODIFIED_ABUSE_MONITORING -> Value.MODIFIED_ABUSE_MONITORING
+ ENHANCED_ZERO_DATA_RETENTION -> Value.ENHANCED_ZERO_DATA_RETENTION
+ ENHANCED_MODIFIED_ABUSE_MONITORING -> Value.ENHANCED_MODIFIED_ABUSE_MONITORING
+ 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 OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ZERO_DATA_RETENTION -> Known.ZERO_DATA_RETENTION
+ MODIFIED_ABUSE_MONITORING -> Known.MODIFIED_ABUSE_MONITORING
+ ENHANCED_ZERO_DATA_RETENTION -> Known.ENHANCED_ZERO_DATA_RETENTION
+ ENHANCED_MODIFIED_ABUSE_MONITORING -> Known.ENHANCED_MODIFIED_ABUSE_MONITORING
+ else -> throw OpenAIInvalidDataException("Unknown Type: $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 OpenAIInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { OpenAIInvalidDataException("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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 Type && 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 OrganizationDataRetention &&
+ object_ == other.object_ &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(object_, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "OrganizationDataRetention{object_=$object_, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt
index 5f5422d00..6104f67ca 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/Group.kt
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
+import com.openai.core.Enum
import com.openai.core.ExcludeMissing
import com.openai.core.JsonField
import com.openai.core.JsonMissing
@@ -14,6 +15,7 @@ import com.openai.core.checkRequired
import com.openai.errors.OpenAIInvalidDataException
import java.util.Collections
import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
/** Details about an organization group. */
class Group
@@ -21,7 +23,7 @@ class Group
private constructor(
private val id: JsonField,
private val createdAt: JsonField,
- private val groupType: JsonField,
+ private val groupType: JsonField,
private val isScimManaged: JsonField,
private val name: JsonField,
private val additionalProperties: MutableMap,
@@ -31,7 +33,9 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(),
- @JsonProperty("group_type") @ExcludeMissing groupType: JsonField = JsonMissing.of(),
+ @JsonProperty("group_type")
+ @ExcludeMissing
+ groupType: JsonField = JsonMissing.of(),
@JsonProperty("is_scim_managed")
@ExcludeMissing
isScimManaged: JsonField = JsonMissing.of(),
@@ -60,7 +64,7 @@ private constructor(
* @throws OpenAIInvalidDataException 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 groupType(): String = groupType.getRequired("group_type")
+ fun groupType(): GroupType = groupType.getRequired("group_type")
/**
* Whether the group is managed through SCIM and controlled by your identity provider.
@@ -97,7 +101,7 @@ private constructor(
*
* Unlike [groupType], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("group_type") @ExcludeMissing fun _groupType(): JsonField = groupType
+ @JsonProperty("group_type") @ExcludeMissing fun _groupType(): JsonField = groupType
/**
* Returns the raw JSON value of [isScimManaged].
@@ -149,7 +153,7 @@ private constructor(
private var id: JsonField? = null
private var createdAt: JsonField? = null
- private var groupType: JsonField? = null
+ private var groupType: JsonField? = null
private var isScimManaged: JsonField? = null
private var name: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@@ -187,16 +191,16 @@ private constructor(
fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
/** The type of the group. */
- fun groupType(groupType: String) = groupType(JsonField.of(groupType))
+ fun groupType(groupType: GroupType) = groupType(JsonField.of(groupType))
/**
* Sets [Builder.groupType] to an arbitrary JSON value.
*
- * You should usually call [Builder.groupType] with a well-typed [String] value instead.
+ * You should usually call [Builder.groupType] with a well-typed [GroupType] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
- fun groupType(groupType: JsonField) = apply { this.groupType = groupType }
+ fun groupType(groupType: JsonField) = apply { this.groupType = groupType }
/** Whether the group is managed through SCIM and controlled by your identity provider. */
fun isScimManaged(isScimManaged: Boolean) = isScimManaged(JsonField.of(isScimManaged))
@@ -286,7 +290,7 @@ private constructor(
id()
createdAt()
- groupType()
+ groupType().validate()
isScimManaged()
name()
validated = true
@@ -309,10 +313,147 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
- (if (groupType.asKnown().isPresent) 1 else 0) +
+ (groupType.asKnown().getOrNull()?.validity() ?: 0) +
(if (isScimManaged.asKnown().isPresent) 1 else 0) +
(if (name.asKnown().isPresent) 1 else 0)
+ /** The type of the group. */
+ class GroupType @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 GROUP = of("group")
+
+ @JvmField val TENANT_GROUP = of("tenant_group")
+
+ @JvmStatic fun of(value: String) = GroupType(JsonField.of(value))
+ }
+
+ /** An enum containing [GroupType]'s known values. */
+ enum class Known {
+ GROUP,
+ TENANT_GROUP,
+ }
+
+ /**
+ * An enum containing [GroupType]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [GroupType] 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 {
+ GROUP,
+ TENANT_GROUP,
+ /**
+ * An enum member indicating that [GroupType] 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) {
+ GROUP -> Value.GROUP
+ TENANT_GROUP -> Value.TENANT_GROUP
+ 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 OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ GROUP -> Known.GROUP
+ TENANT_GROUP -> Known.TENANT_GROUP
+ else -> throw OpenAIInvalidDataException("Unknown GroupType: $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 OpenAIInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { OpenAIInvalidDataException("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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): GroupType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 GroupType && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupRetrieveParams.kt
new file mode 100644
index 000000000..551772730
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/GroupRetrieveParams.kt
@@ -0,0 +1,189 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.admin.organization.groups
+
+import com.openai.core.Params
+import com.openai.core.http.Headers
+import com.openai.core.http.QueryParams
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Retrieves a group. */
+class GroupRetrieveParams
+private constructor(
+ private val groupId: String?,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ fun groupId(): Optional = Optional.ofNullable(groupId)
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun none(): GroupRetrieveParams = builder().build()
+
+ /** Returns a mutable builder for constructing an instance of [GroupRetrieveParams]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [GroupRetrieveParams]. */
+ class Builder internal constructor() {
+
+ private var groupId: String? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(groupRetrieveParams: GroupRetrieveParams) = apply {
+ groupId = groupRetrieveParams.groupId
+ additionalHeaders = groupRetrieveParams.additionalHeaders.toBuilder()
+ additionalQueryParams = groupRetrieveParams.additionalQueryParams.toBuilder()
+ }
+
+ fun groupId(groupId: String?) = apply { this.groupId = groupId }
+
+ /** Alias for calling [Builder.groupId] with `groupId.orElse(null)`. */
+ fun groupId(groupId: Optional) = groupId(groupId.getOrNull())
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [GroupRetrieveParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): GroupRetrieveParams =
+ GroupRetrieveParams(groupId, additionalHeaders.build(), additionalQueryParams.build())
+ }
+
+ fun _pathParam(index: Int): String =
+ when (index) {
+ 0 -> groupId ?: ""
+ else -> ""
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is GroupRetrieveParams &&
+ groupId == other.groupId &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int = Objects.hash(groupId, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "GroupRetrieveParams{groupId=$groupId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt
index aabc3da55..abe7437ed 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleListResponse.kt
@@ -24,6 +24,7 @@ class RoleListResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val id: JsonField,
+ private val assignmentSources: JsonField>,
private val createdAt: JsonField,
private val createdBy: JsonField,
private val createdByUserObj: JsonField,
@@ -40,6 +41,9 @@ private constructor(
@JsonCreator
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("assignment_sources")
+ @ExcludeMissing
+ assignmentSources: JsonField> = JsonMissing.of(),
@JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(),
@JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
@JsonProperty("created_by_user_obj")
@@ -62,6 +66,7 @@ private constructor(
@JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(),
) : this(
id,
+ assignmentSources,
createdAt,
createdBy,
createdByUserObj,
@@ -83,6 +88,15 @@ private constructor(
*/
fun id(): String = id.getRequired("id")
+ /**
+ * Principals from which the role assignment is inherited, when available.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun assignmentSources(): Optional> =
+ assignmentSources.getOptional("assignment_sources")
+
/**
* When the role was created.
*
@@ -171,6 +185,16 @@ private constructor(
*/
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+ /**
+ * Returns the raw JSON value of [assignmentSources].
+ *
+ * Unlike [assignmentSources], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("assignment_sources")
+ @ExcludeMissing
+ fun _assignmentSources(): JsonField> = assignmentSources
+
/**
* Returns the raw JSON value of [createdAt].
*
@@ -270,6 +294,7 @@ private constructor(
* The following fields are required:
* ```java
* .id()
+ * .assignmentSources()
* .createdAt()
* .createdBy()
* .createdByUserObj()
@@ -289,6 +314,7 @@ private constructor(
class Builder internal constructor() {
private var id: JsonField? = null
+ private var assignmentSources: JsonField>? = null
private var createdAt: JsonField? = null
private var createdBy: JsonField? = null
private var createdByUserObj: JsonField? = null
@@ -304,6 +330,7 @@ private constructor(
@JvmSynthetic
internal fun from(roleListResponse: RoleListResponse) = apply {
id = roleListResponse.id
+ assignmentSources = roleListResponse.assignmentSources.map { it.toMutableList() }
createdAt = roleListResponse.createdAt
createdBy = roleListResponse.createdBy
createdByUserObj = roleListResponse.createdByUserObj
@@ -328,6 +355,37 @@ private constructor(
*/
fun id(id: JsonField) = apply { this.id = id }
+ /** Principals from which the role assignment is inherited, when available. */
+ fun assignmentSources(assignmentSources: List?) =
+ assignmentSources(JsonField.ofNullable(assignmentSources))
+
+ /** Alias for calling [Builder.assignmentSources] with `assignmentSources.orElse(null)`. */
+ fun assignmentSources(assignmentSources: Optional>) =
+ assignmentSources(assignmentSources.getOrNull())
+
+ /**
+ * Sets [Builder.assignmentSources] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.assignmentSources] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun assignmentSources(assignmentSources: JsonField>) = apply {
+ this.assignmentSources = assignmentSources.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [AssignmentSource] to [assignmentSources].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAssignmentSource(assignmentSource: AssignmentSource) = apply {
+ assignmentSources =
+ (assignmentSources ?: JsonField.of(mutableListOf())).also {
+ checkKnown("assignmentSources", it).add(assignmentSource)
+ }
+ }
+
/** When the role was created. */
fun createdAt(createdAt: Long?) = createdAt(JsonField.ofNullable(createdAt))
@@ -526,6 +584,7 @@ private constructor(
* The following fields are required:
* ```java
* .id()
+ * .assignmentSources()
* .createdAt()
* .createdBy()
* .createdByUserObj()
@@ -543,6 +602,7 @@ private constructor(
fun build(): RoleListResponse =
RoleListResponse(
checkRequired("id", id),
+ checkRequired("assignmentSources", assignmentSources).map { it.toImmutable() },
checkRequired("createdAt", createdAt),
checkRequired("createdBy", createdBy),
checkRequired("createdByUserObj", createdByUserObj),
@@ -573,6 +633,7 @@ private constructor(
}
id()
+ assignmentSources().ifPresent { it.forEach { it.validate() } }
createdAt()
createdBy()
createdByUserObj().ifPresent { it.validate() }
@@ -602,6 +663,7 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
+ (assignmentSources.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(if (createdBy.asKnown().isPresent) 1 else 0) +
(createdByUserObj.asKnown().getOrNull()?.validity() ?: 0) +
@@ -613,6 +675,222 @@ private constructor(
(if (resourceType.asKnown().isPresent) 1 else 0) +
(if (updatedAt.asKnown().isPresent) 1 else 0)
+ class AssignmentSource
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val principalId: JsonField,
+ private val principalType: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("principal_id")
+ @ExcludeMissing
+ principalId: JsonField = JsonMissing.of(),
+ @JsonProperty("principal_type")
+ @ExcludeMissing
+ principalType: JsonField = JsonMissing.of(),
+ ) : this(principalId, principalType, mutableMapOf())
+
+ /**
+ * @throws OpenAIInvalidDataException 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 principalId(): String = principalId.getRequired("principal_id")
+
+ /**
+ * @throws OpenAIInvalidDataException 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 principalType(): String = principalType.getRequired("principal_type")
+
+ /**
+ * Returns the raw JSON value of [principalId].
+ *
+ * Unlike [principalId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("principal_id")
+ @ExcludeMissing
+ fun _principalId(): JsonField = principalId
+
+ /**
+ * Returns the raw JSON value of [principalType].
+ *
+ * Unlike [principalType], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("principal_type")
+ @ExcludeMissing
+ fun _principalType(): JsonField = principalType
+
+ @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 [AssignmentSource].
+ *
+ * The following fields are required:
+ * ```java
+ * .principalId()
+ * .principalType()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AssignmentSource]. */
+ class Builder internal constructor() {
+
+ private var principalId: JsonField? = null
+ private var principalType: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(assignmentSource: AssignmentSource) = apply {
+ principalId = assignmentSource.principalId
+ principalType = assignmentSource.principalType
+ additionalProperties = assignmentSource.additionalProperties.toMutableMap()
+ }
+
+ fun principalId(principalId: String) = principalId(JsonField.of(principalId))
+
+ /**
+ * Sets [Builder.principalId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.principalId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun principalId(principalId: JsonField) = apply {
+ this.principalId = principalId
+ }
+
+ fun principalType(principalType: String) = principalType(JsonField.of(principalType))
+
+ /**
+ * Sets [Builder.principalType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.principalType] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun principalType(principalType: JsonField) = apply {
+ this.principalType = principalType
+ }
+
+ 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 [AssignmentSource].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .principalId()
+ * .principalType()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AssignmentSource =
+ AssignmentSource(
+ checkRequired("principalId", principalId),
+ checkRequired("principalType", principalType),
+ 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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): AssignmentSource = apply {
+ if (validated) {
+ return@apply
+ }
+
+ principalId()
+ principalType()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 (principalId.asKnown().isPresent) 1 else 0) +
+ (if (principalType.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AssignmentSource &&
+ principalId == other.principalId &&
+ principalType == other.principalType &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(principalId, principalType, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AssignmentSource{principalId=$principalId, principalType=$principalType, additionalProperties=$additionalProperties}"
+ }
+
/** User details for the actor that created the role, when available. */
class CreatedByUserObj
@JsonCreator
@@ -838,6 +1116,7 @@ private constructor(
return other is RoleListResponse &&
id == other.id &&
+ assignmentSources == other.assignmentSources &&
createdAt == other.createdAt &&
createdBy == other.createdBy &&
createdByUserObj == other.createdByUserObj &&
@@ -854,6 +1133,7 @@ private constructor(
private val hashCode: Int by lazy {
Objects.hash(
id,
+ assignmentSources,
createdAt,
createdBy,
createdByUserObj,
@@ -871,5 +1151,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "RoleListResponse{id=$id, createdAt=$createdAt, createdBy=$createdBy, createdByUserObj=$createdByUserObj, description=$description, metadata=$metadata, name=$name, permissions=$permissions, predefinedRole=$predefinedRole, resourceType=$resourceType, updatedAt=$updatedAt, additionalProperties=$additionalProperties}"
+ "RoleListResponse{id=$id, assignmentSources=$assignmentSources, createdAt=$createdAt, createdBy=$createdBy, createdByUserObj=$createdByUserObj, description=$description, metadata=$metadata, name=$name, permissions=$permissions, predefinedRole=$predefinedRole, resourceType=$resourceType, updatedAt=$updatedAt, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleRetrieveParams.kt
new file mode 100644
index 000000000..522eb4d9e
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleRetrieveParams.kt
@@ -0,0 +1,217 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.admin.organization.groups.roles
+
+import com.openai.core.Params
+import com.openai.core.checkRequired
+import com.openai.core.http.Headers
+import com.openai.core.http.QueryParams
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Retrieves an organization role assigned to a group. */
+class RoleRetrieveParams
+private constructor(
+ private val groupId: String,
+ private val roleId: String?,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ fun groupId(): String = groupId
+
+ fun roleId(): Optional = Optional.ofNullable(roleId)
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [RoleRetrieveParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .groupId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [RoleRetrieveParams]. */
+ class Builder internal constructor() {
+
+ private var groupId: String? = null
+ private var roleId: String? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(roleRetrieveParams: RoleRetrieveParams) = apply {
+ groupId = roleRetrieveParams.groupId
+ roleId = roleRetrieveParams.roleId
+ additionalHeaders = roleRetrieveParams.additionalHeaders.toBuilder()
+ additionalQueryParams = roleRetrieveParams.additionalQueryParams.toBuilder()
+ }
+
+ fun groupId(groupId: String) = apply { this.groupId = groupId }
+
+ fun roleId(roleId: String?) = apply { this.roleId = roleId }
+
+ /** Alias for calling [Builder.roleId] with `roleId.orElse(null)`. */
+ fun roleId(roleId: Optional) = roleId(roleId.getOrNull())
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [RoleRetrieveParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .groupId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): RoleRetrieveParams =
+ RoleRetrieveParams(
+ checkRequired("groupId", groupId),
+ roleId,
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _pathParam(index: Int): String =
+ when (index) {
+ 0 -> groupId
+ 1 -> roleId ?: ""
+ else -> ""
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RoleRetrieveParams &&
+ groupId == other.groupId &&
+ roleId == other.roleId &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(groupId, roleId, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "RoleRetrieveParams{groupId=$groupId, roleId=$roleId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleRetrieveResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleRetrieveResponse.kt
new file mode 100644
index 000000000..2c7c7f22f
--- /dev/null
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/groups/roles/RoleRetrieveResponse.kt
@@ -0,0 +1,1155 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.openai.models.admin.organization.groups.roles
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.openai.core.ExcludeMissing
+import com.openai.core.JsonField
+import com.openai.core.JsonMissing
+import com.openai.core.JsonValue
+import com.openai.core.checkKnown
+import com.openai.core.checkRequired
+import com.openai.core.toImmutable
+import com.openai.errors.OpenAIInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Detailed information about a role assignment entry returned when listing assignments. */
+class RoleRetrieveResponse
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val id: JsonField,
+ private val assignmentSources: JsonField>,
+ private val createdAt: JsonField,
+ private val createdBy: JsonField,
+ private val createdByUserObj: JsonField,
+ private val description: JsonField,
+ private val metadata: JsonField,
+ private val name: JsonField,
+ private val permissions: JsonField>,
+ private val predefinedRole: JsonField,
+ private val resourceType: JsonField,
+ private val updatedAt: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("assignment_sources")
+ @ExcludeMissing
+ assignmentSources: JsonField> = JsonMissing.of(),
+ @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(),
+ @JsonProperty("created_by") @ExcludeMissing createdBy: JsonField = JsonMissing.of(),
+ @JsonProperty("created_by_user_obj")
+ @ExcludeMissing
+ createdByUserObj: JsonField = JsonMissing.of(),
+ @JsonProperty("description")
+ @ExcludeMissing
+ description: JsonField = JsonMissing.of(),
+ @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("permissions")
+ @ExcludeMissing
+ permissions: JsonField> = JsonMissing.of(),
+ @JsonProperty("predefined_role")
+ @ExcludeMissing
+ predefinedRole: JsonField = JsonMissing.of(),
+ @JsonProperty("resource_type")
+ @ExcludeMissing
+ resourceType: JsonField = JsonMissing.of(),
+ @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(),
+ ) : this(
+ id,
+ assignmentSources,
+ createdAt,
+ createdBy,
+ createdByUserObj,
+ description,
+ metadata,
+ name,
+ permissions,
+ predefinedRole,
+ resourceType,
+ updatedAt,
+ mutableMapOf(),
+ )
+
+ /**
+ * Identifier for the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * Principals from which the role assignment is inherited, when available.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun assignmentSources(): Optional> =
+ assignmentSources.getOptional("assignment_sources")
+
+ /**
+ * When the role was created.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun createdAt(): Optional = createdAt.getOptional("created_at")
+
+ /**
+ * Identifier of the actor who created the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun createdBy(): Optional = createdBy.getOptional("created_by")
+
+ /**
+ * User details for the actor that created the role, when available.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun createdByUserObj(): Optional =
+ createdByUserObj.getOptional("created_by_user_obj")
+
+ /**
+ * Description of the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun description(): Optional = description.getOptional("description")
+
+ /**
+ * Arbitrary metadata stored on the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun metadata(): Optional = metadata.getOptional("metadata")
+
+ /**
+ * Name of the role.
+ *
+ * @throws OpenAIInvalidDataException 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 name(): String = name.getRequired("name")
+
+ /**
+ * Permissions associated with the role.
+ *
+ * @throws OpenAIInvalidDataException 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 permissions(): List = permissions.getRequired("permissions")
+
+ /**
+ * Whether the role is predefined by OpenAI.
+ *
+ * @throws OpenAIInvalidDataException 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 predefinedRole(): Boolean = predefinedRole.getRequired("predefined_role")
+
+ /**
+ * Resource type the role applies to.
+ *
+ * @throws OpenAIInvalidDataException 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 resourceType(): String = resourceType.getRequired("resource_type")
+
+ /**
+ * When the role was last updated.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun updatedAt(): Optional = updatedAt.getOptional("updated_at")
+
+ /**
+ * Returns the raw JSON value of [id].
+ *
+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+
+ /**
+ * Returns the raw JSON value of [assignmentSources].
+ *
+ * Unlike [assignmentSources], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("assignment_sources")
+ @ExcludeMissing
+ fun _assignmentSources(): JsonField> = assignmentSources
+
+ /**
+ * Returns the raw JSON value of [createdAt].
+ *
+ * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField = createdAt
+
+ /**
+ * Returns the raw JSON value of [createdBy].
+ *
+ * Unlike [createdBy], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created_by") @ExcludeMissing fun _createdBy(): JsonField = createdBy
+
+ /**
+ * Returns the raw JSON value of [createdByUserObj].
+ *
+ * Unlike [createdByUserObj], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("created_by_user_obj")
+ @ExcludeMissing
+ fun _createdByUserObj(): JsonField = createdByUserObj
+
+ /**
+ * Returns the raw JSON value of [description].
+ *
+ * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description
+
+ /**
+ * Returns the raw JSON value of [metadata].
+ *
+ * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ /**
+ * Returns the raw JSON value of [permissions].
+ *
+ * Unlike [permissions], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("permissions")
+ @ExcludeMissing
+ fun _permissions(): JsonField> = permissions
+
+ /**
+ * Returns the raw JSON value of [predefinedRole].
+ *
+ * Unlike [predefinedRole], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("predefined_role")
+ @ExcludeMissing
+ fun _predefinedRole(): JsonField = predefinedRole
+
+ /**
+ * Returns the raw JSON value of [resourceType].
+ *
+ * Unlike [resourceType], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("resource_type")
+ @ExcludeMissing
+ fun _resourceType(): JsonField = resourceType
+
+ /**
+ * Returns the raw JSON value of [updatedAt].
+ *
+ * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("updated_at") @ExcludeMissing fun _updatedAt(): JsonField = updatedAt
+
+ @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 [RoleRetrieveResponse].
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .assignmentSources()
+ * .createdAt()
+ * .createdBy()
+ * .createdByUserObj()
+ * .description()
+ * .metadata()
+ * .name()
+ * .permissions()
+ * .predefinedRole()
+ * .resourceType()
+ * .updatedAt()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [RoleRetrieveResponse]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var assignmentSources: JsonField>? = null
+ private var createdAt: JsonField? = null
+ private var createdBy: JsonField? = null
+ private var createdByUserObj: JsonField? = null
+ private var description: JsonField? = null
+ private var metadata: JsonField? = null
+ private var name: JsonField? = null
+ private var permissions: JsonField>? = null
+ private var predefinedRole: JsonField? = null
+ private var resourceType: JsonField? = null
+ private var updatedAt: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(roleRetrieveResponse: RoleRetrieveResponse) = apply {
+ id = roleRetrieveResponse.id
+ assignmentSources = roleRetrieveResponse.assignmentSources.map { it.toMutableList() }
+ createdAt = roleRetrieveResponse.createdAt
+ createdBy = roleRetrieveResponse.createdBy
+ createdByUserObj = roleRetrieveResponse.createdByUserObj
+ description = roleRetrieveResponse.description
+ metadata = roleRetrieveResponse.metadata
+ name = roleRetrieveResponse.name
+ permissions = roleRetrieveResponse.permissions.map { it.toMutableList() }
+ predefinedRole = roleRetrieveResponse.predefinedRole
+ resourceType = roleRetrieveResponse.resourceType
+ updatedAt = roleRetrieveResponse.updatedAt
+ additionalProperties = roleRetrieveResponse.additionalProperties.toMutableMap()
+ }
+
+ /** Identifier for the role. */
+ fun id(id: String) = id(JsonField.of(id))
+
+ /**
+ * Sets [Builder.id] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.id] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /** Principals from which the role assignment is inherited, when available. */
+ fun assignmentSources(assignmentSources: List?) =
+ assignmentSources(JsonField.ofNullable(assignmentSources))
+
+ /** Alias for calling [Builder.assignmentSources] with `assignmentSources.orElse(null)`. */
+ fun assignmentSources(assignmentSources: Optional>) =
+ assignmentSources(assignmentSources.getOrNull())
+
+ /**
+ * Sets [Builder.assignmentSources] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.assignmentSources] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun assignmentSources(assignmentSources: JsonField>) = apply {
+ this.assignmentSources = assignmentSources.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [AssignmentSource] to [assignmentSources].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAssignmentSource(assignmentSource: AssignmentSource) = apply {
+ assignmentSources =
+ (assignmentSources ?: JsonField.of(mutableListOf())).also {
+ checkKnown("assignmentSources", it).add(assignmentSource)
+ }
+ }
+
+ /** When the role was created. */
+ fun createdAt(createdAt: Long?) = createdAt(JsonField.ofNullable(createdAt))
+
+ /**
+ * Alias for [Builder.createdAt].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun createdAt(createdAt: Long) = createdAt(createdAt as Long?)
+
+ /** Alias for calling [Builder.createdAt] with `createdAt.orElse(null)`. */
+ fun createdAt(createdAt: Optional) = createdAt(createdAt.getOrNull())
+
+ /**
+ * Sets [Builder.createdAt] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdAt] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
+
+ /** Identifier of the actor who created the role. */
+ fun createdBy(createdBy: String?) = createdBy(JsonField.ofNullable(createdBy))
+
+ /** Alias for calling [Builder.createdBy] with `createdBy.orElse(null)`. */
+ fun createdBy(createdBy: Optional) = createdBy(createdBy.getOrNull())
+
+ /**
+ * Sets [Builder.createdBy] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdBy] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun createdBy(createdBy: JsonField) = apply { this.createdBy = createdBy }
+
+ /** User details for the actor that created the role, when available. */
+ fun createdByUserObj(createdByUserObj: CreatedByUserObj?) =
+ createdByUserObj(JsonField.ofNullable(createdByUserObj))
+
+ /** Alias for calling [Builder.createdByUserObj] with `createdByUserObj.orElse(null)`. */
+ fun createdByUserObj(createdByUserObj: Optional) =
+ createdByUserObj(createdByUserObj.getOrNull())
+
+ /**
+ * Sets [Builder.createdByUserObj] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.createdByUserObj] with a well-typed [CreatedByUserObj]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun createdByUserObj(createdByUserObj: JsonField) = apply {
+ this.createdByUserObj = createdByUserObj
+ }
+
+ /** Description of the role. */
+ fun description(description: String?) = description(JsonField.ofNullable(description))
+
+ /** Alias for calling [Builder.description] with `description.orElse(null)`. */
+ fun description(description: Optional) = description(description.getOrNull())
+
+ /**
+ * Sets [Builder.description] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.description] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun description(description: JsonField) = apply { this.description = description }
+
+ /** Arbitrary metadata stored on the role. */
+ fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
+
+ /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
+ fun metadata(metadata: Optional) = metadata(metadata.getOrNull())
+
+ /**
+ * Sets [Builder.metadata] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun metadata(metadata: JsonField) = apply { this.metadata = metadata }
+
+ /** Name of the role. */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ /** Permissions associated with the role. */
+ fun permissions(permissions: List) = permissions(JsonField.of(permissions))
+
+ /**
+ * Sets [Builder.permissions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.permissions] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun permissions(permissions: JsonField>) = apply {
+ this.permissions = permissions.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [permissions].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addPermission(permission: String) = apply {
+ permissions =
+ (permissions ?: JsonField.of(mutableListOf())).also {
+ checkKnown("permissions", it).add(permission)
+ }
+ }
+
+ /** Whether the role is predefined by OpenAI. */
+ fun predefinedRole(predefinedRole: Boolean) = predefinedRole(JsonField.of(predefinedRole))
+
+ /**
+ * Sets [Builder.predefinedRole] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.predefinedRole] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun predefinedRole(predefinedRole: JsonField) = apply {
+ this.predefinedRole = predefinedRole
+ }
+
+ /** Resource type the role applies to. */
+ fun resourceType(resourceType: String) = resourceType(JsonField.of(resourceType))
+
+ /**
+ * Sets [Builder.resourceType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.resourceType] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun resourceType(resourceType: JsonField) = apply {
+ this.resourceType = resourceType
+ }
+
+ /** When the role was last updated. */
+ fun updatedAt(updatedAt: Long?) = updatedAt(JsonField.ofNullable(updatedAt))
+
+ /**
+ * Alias for [Builder.updatedAt].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun updatedAt(updatedAt: Long) = updatedAt(updatedAt as Long?)
+
+ /** Alias for calling [Builder.updatedAt] with `updatedAt.orElse(null)`. */
+ fun updatedAt(updatedAt: Optional) = updatedAt(updatedAt.getOrNull())
+
+ /**
+ * Sets [Builder.updatedAt] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.updatedAt] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt }
+
+ 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 [RoleRetrieveResponse].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .assignmentSources()
+ * .createdAt()
+ * .createdBy()
+ * .createdByUserObj()
+ * .description()
+ * .metadata()
+ * .name()
+ * .permissions()
+ * .predefinedRole()
+ * .resourceType()
+ * .updatedAt()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): RoleRetrieveResponse =
+ RoleRetrieveResponse(
+ checkRequired("id", id),
+ checkRequired("assignmentSources", assignmentSources).map { it.toImmutable() },
+ checkRequired("createdAt", createdAt),
+ checkRequired("createdBy", createdBy),
+ checkRequired("createdByUserObj", createdByUserObj),
+ checkRequired("description", description),
+ checkRequired("metadata", metadata),
+ checkRequired("name", name),
+ checkRequired("permissions", permissions).map { it.toImmutable() },
+ checkRequired("predefinedRole", predefinedRole),
+ checkRequired("resourceType", resourceType),
+ checkRequired("updatedAt", updatedAt),
+ 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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): RoleRetrieveResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ assignmentSources().ifPresent { it.forEach { it.validate() } }
+ createdAt()
+ createdBy()
+ createdByUserObj().ifPresent { it.validate() }
+ description()
+ metadata().ifPresent { it.validate() }
+ name()
+ permissions()
+ predefinedRole()
+ resourceType()
+ updatedAt()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (assignmentSources.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (createdBy.asKnown().isPresent) 1 else 0) +
+ (createdByUserObj.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (permissions.asKnown().getOrNull()?.size ?: 0) +
+ (if (predefinedRole.asKnown().isPresent) 1 else 0) +
+ (if (resourceType.asKnown().isPresent) 1 else 0) +
+ (if (updatedAt.asKnown().isPresent) 1 else 0)
+
+ class AssignmentSource
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val principalId: JsonField,
+ private val principalType: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("principal_id")
+ @ExcludeMissing
+ principalId: JsonField = JsonMissing.of(),
+ @JsonProperty("principal_type")
+ @ExcludeMissing
+ principalType: JsonField = JsonMissing.of(),
+ ) : this(principalId, principalType, mutableMapOf())
+
+ /**
+ * @throws OpenAIInvalidDataException 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 principalId(): String = principalId.getRequired("principal_id")
+
+ /**
+ * @throws OpenAIInvalidDataException 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 principalType(): String = principalType.getRequired("principal_type")
+
+ /**
+ * Returns the raw JSON value of [principalId].
+ *
+ * Unlike [principalId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("principal_id")
+ @ExcludeMissing
+ fun _principalId(): JsonField = principalId
+
+ /**
+ * Returns the raw JSON value of [principalType].
+ *
+ * Unlike [principalType], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("principal_type")
+ @ExcludeMissing
+ fun _principalType(): JsonField = principalType
+
+ @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 [AssignmentSource].
+ *
+ * The following fields are required:
+ * ```java
+ * .principalId()
+ * .principalType()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AssignmentSource]. */
+ class Builder internal constructor() {
+
+ private var principalId: JsonField? = null
+ private var principalType: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(assignmentSource: AssignmentSource) = apply {
+ principalId = assignmentSource.principalId
+ principalType = assignmentSource.principalType
+ additionalProperties = assignmentSource.additionalProperties.toMutableMap()
+ }
+
+ fun principalId(principalId: String) = principalId(JsonField.of(principalId))
+
+ /**
+ * Sets [Builder.principalId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.principalId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun principalId(principalId: JsonField) = apply {
+ this.principalId = principalId
+ }
+
+ fun principalType(principalType: String) = principalType(JsonField.of(principalType))
+
+ /**
+ * Sets [Builder.principalType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.principalType] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun principalType(principalType: JsonField) = apply {
+ this.principalType = principalType
+ }
+
+ 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 [AssignmentSource].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .principalId()
+ * .principalType()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AssignmentSource =
+ AssignmentSource(
+ checkRequired("principalId", principalId),
+ checkRequired("principalType", principalType),
+ 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 OpenAIInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): AssignmentSource = apply {
+ if (validated) {
+ return@apply
+ }
+
+ principalId()
+ principalType()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OpenAIInvalidDataException) {
+ 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 (principalId.asKnown().isPresent) 1 else 0) +
+ (if (principalType.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AssignmentSource &&
+ principalId == other.principalId &&
+ principalType == other.principalType &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(principalId, principalType, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AssignmentSource{principalId=$principalId, principalType=$principalType, additionalProperties=$additionalProperties}"
+ }
+
+ /** User details for the actor that created the role, when available. */
+ class CreatedByUserObj
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [CreatedByUserObj]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CreatedByUserObj]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(createdByUserObj: CreatedByUserObj) = apply {
+ additionalProperties = createdByUserObj.additionalProperties.toMutableMap()
+ }
+
+ 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