diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 1bae6b6d9..a92bd0cac 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.39.1"
+ ".": "4.40.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 25e6ceff0..ceecd31fa 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 261
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-0161cb2a0faadedfc17ff59c7fcad9671962dbd170f83811003c23702148cf36.yml
-openapi_spec_hash: 1023c7442d0e2e7e213e8b3a253921c5
-config_hash: e02ca1082421dfe55b145c45e95d6126
+configured_endpoints: 263
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-4db8edc05bd5503d4aaad74e8b9c783aa1f4d40382a8075c53355bd18dfaf68c.yml
+openapi_spec_hash: 2466f6ad496b27334217999202e185c0
+config_hash: ef3ce17315a31703e7af0567b3e9738c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fb571b68..ed847f582 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## 4.40.0 (2026-06-16)
+
+Full Changelog: [v4.39.1...v4.40.0](https://github.com/openai/openai-java/compare/v4.39.1...v4.40.0)
+
+### Features
+
+* **api:** admin spend_alerts ([512770c](https://github.com/openai/openai-java/commit/512770c119201347bfab9e68fec00e1cff5b2df8))
+* **api:** manual updates ([701ebe0](https://github.com/openai/openai-java/commit/701ebe011fa2ed05f80e51307bc7e9886bfb9d8b))
+* **api:** update OpenAPI spec or Stainless config ([94b7412](https://github.com/openai/openai-java/commit/94b7412a98fb60d6865d362c48526b4a6dd0896a))
+
+
+### Build System
+
+* Use CI environment for OpenAI API key workflow ([#756](https://github.com/openai/openai-java/issues/756)) ([27de5f5](https://github.com/openai/openai-java/commit/27de5f5b159394b7f29a31389854890460122c1a))
+* Use publish environment for release job ([#758](https://github.com/openai/openai-java/issues/758)) ([bbb66f8](https://github.com/openai/openai-java/commit/bbb66f870877a3e9e3f73c5c41eb4558f23a901a))
+
## 4.39.1 (2026-06-04)
Full Changelog: [v4.39.0...v4.39.1](https://github.com/openai/openai-java/compare/v4.39.0...v4.39.1)
diff --git a/README.md b/README.md
index f6d59ac27..d54a09e10 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/4.39.1)
-[](https://javadoc.io/doc/com.openai/openai-java/4.39.1)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/4.40.0)
+[](https://javadoc.io/doc/com.openai/openai-java/4.40.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.39.1).
+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.40.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.39.1")
+implementation("com.openai:openai-java:4.40.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.39.1")
com.openaiopenai-java
- 4.39.1
+ 4.40.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.39.1")
+implementation("com.openai:openai-java-spring-boot-starter:4.40.0")
```
#### Maven
@@ -1442,7 +1442,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.39.1")
com.openaiopenai-java-spring-boot-starter
- 4.39.1
+ 4.40.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 46b0ae66b..eb92da758 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "4.39.1" // x-release-please-version
+ version = "4.40.0" // x-release-please-version
}
subprojects {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt b/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt
index 224a76108..285ebff40 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt
@@ -25,6 +25,7 @@ import kotlin.jvm.optionals.getOrNull
class Reasoning
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
+ private val context: JsonField,
private val effort: JsonField,
private val generateSummary: JsonField,
private val summary: JsonField,
@@ -33,6 +34,7 @@ private constructor(
@JsonCreator
private constructor(
+ @JsonProperty("context") @ExcludeMissing context: JsonField = JsonMissing.of(),
@JsonProperty("effort")
@ExcludeMissing
effort: JsonField = JsonMissing.of(),
@@ -40,7 +42,16 @@ private constructor(
@ExcludeMissing
generateSummary: JsonField = JsonMissing.of(),
@JsonProperty("summary") @ExcludeMissing summary: JsonField = JsonMissing.of(),
- ) : this(effort, generateSummary, summary, mutableMapOf())
+ ) : this(context, effort, generateSummary, summary, mutableMapOf())
+
+ /**
+ * Controls which reasoning items are rendered back to the model on later turns. When returned
+ * on a response, this is the effective reasoning context mode used for the response.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun context(): Optional = context.getOptional("context")
/**
* Constrains effort on reasoning for
@@ -85,6 +96,13 @@ private constructor(
*/
fun summary(): Optional = summary.getOptional("summary")
+ /**
+ * Returns the raw JSON value of [context].
+ *
+ * Unlike [context], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("context") @ExcludeMissing fun _context(): JsonField = context
+
/**
* Returns the raw JSON value of [effort].
*
@@ -130,6 +148,7 @@ private constructor(
/** A builder for [Reasoning]. */
class Builder internal constructor() {
+ private var context: JsonField = JsonMissing.of()
private var effort: JsonField = JsonMissing.of()
private var generateSummary: JsonField = JsonMissing.of()
private var summary: JsonField = JsonMissing.of()
@@ -137,12 +156,31 @@ private constructor(
@JvmSynthetic
internal fun from(reasoning: Reasoning) = apply {
+ context = reasoning.context
effort = reasoning.effort
generateSummary = reasoning.generateSummary
summary = reasoning.summary
additionalProperties = reasoning.additionalProperties.toMutableMap()
}
+ /**
+ * Controls which reasoning items are rendered back to the model on later turns. When
+ * returned on a response, this is the effective reasoning context mode used for the
+ * response.
+ */
+ fun context(context: Context?) = context(JsonField.ofNullable(context))
+
+ /** Alias for calling [Builder.context] with `context.orElse(null)`. */
+ fun context(context: Optional) = context(context.getOrNull())
+
+ /**
+ * Sets [Builder.context] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.context] with a well-typed [Context] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun context(context: JsonField) = apply { this.context = context }
+
/**
* Constrains effort on reasoning for
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -243,7 +281,13 @@ private constructor(
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Reasoning =
- Reasoning(effort, generateSummary, summary, additionalProperties.toMutableMap())
+ Reasoning(
+ context,
+ effort,
+ generateSummary,
+ summary,
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
@@ -261,6 +305,7 @@ private constructor(
return@apply
}
+ context().ifPresent { it.validate() }
effort().ifPresent { it.validate() }
generateSummary().ifPresent { it.validate() }
summary().ifPresent { it.validate() }
@@ -282,10 +327,155 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
- (effort.asKnown().getOrNull()?.validity() ?: 0) +
+ (context.asKnown().getOrNull()?.validity() ?: 0) +
+ (effort.asKnown().getOrNull()?.validity() ?: 0) +
(generateSummary.asKnown().getOrNull()?.validity() ?: 0) +
(summary.asKnown().getOrNull()?.validity() ?: 0)
+ /**
+ * Controls which reasoning items are rendered back to the model on later turns. When returned
+ * on a response, this is the effective reasoning context mode used for the response.
+ */
+ class Context @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 AUTO = of("auto")
+
+ @JvmField val CURRENT_TURN = of("current_turn")
+
+ @JvmField val ALL_TURNS = of("all_turns")
+
+ @JvmStatic fun of(value: String) = Context(JsonField.of(value))
+ }
+
+ /** An enum containing [Context]'s known values. */
+ enum class Known {
+ AUTO,
+ CURRENT_TURN,
+ ALL_TURNS,
+ }
+
+ /**
+ * An enum containing [Context]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Context] 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 {
+ AUTO,
+ CURRENT_TURN,
+ ALL_TURNS,
+ /** An enum member indicating that [Context] 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) {
+ AUTO -> Value.AUTO
+ CURRENT_TURN -> Value.CURRENT_TURN
+ ALL_TURNS -> Value.ALL_TURNS
+ 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) {
+ AUTO -> Known.AUTO
+ CURRENT_TURN -> Known.CURRENT_TURN
+ ALL_TURNS -> Known.ALL_TURNS
+ else -> throw OpenAIInvalidDataException("Unknown Context: $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(): Context = 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 Context && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
/**
* **Deprecated:** use `summary` instead.
*
@@ -590,6 +780,7 @@ private constructor(
}
return other is Reasoning &&
+ context == other.context &&
effort == other.effort &&
generateSummary == other.generateSummary &&
summary == other.summary &&
@@ -597,11 +788,11 @@ private constructor(
}
private val hashCode: Int by lazy {
- Objects.hash(effort, generateSummary, summary, additionalProperties)
+ Objects.hash(context, effort, generateSummary, summary, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "Reasoning{effort=$effort, generateSummary=$generateSummary, summary=$summary, additionalProperties=$additionalProperties}"
+ "Reasoning{context=$context, effort=$effort, generateSummary=$generateSummary, summary=$summary, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt
index feb025044..4f7026898 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKey.kt
@@ -23,6 +23,7 @@ class AdminApiKey
private constructor(
private val id: JsonField,
private val createdAt: JsonField,
+ private val expiresAt: JsonField,
private val object_: JsonValue,
private val owner: JsonField,
private val redactedValue: JsonField,
@@ -35,6 +36,7 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(),
+ @JsonProperty("expires_at") @ExcludeMissing expiresAt: JsonField = JsonMissing.of(),
@JsonProperty("object") @ExcludeMissing object_: JsonValue = JsonMissing.of(),
@JsonProperty("owner") @ExcludeMissing owner: JsonField = JsonMissing.of(),
@JsonProperty("redacted_value")
@@ -44,7 +46,17 @@ private constructor(
@ExcludeMissing
lastUsedAt: JsonField = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
- ) : this(id, createdAt, object_, owner, redactedValue, lastUsedAt, name, mutableMapOf())
+ ) : this(
+ id,
+ createdAt,
+ expiresAt,
+ object_,
+ owner,
+ redactedValue,
+ lastUsedAt,
+ name,
+ mutableMapOf(),
+ )
/**
* The identifier, which can be referenced in API endpoints
@@ -62,6 +74,14 @@ private constructor(
*/
fun createdAt(): Long = createdAt.getRequired("created_at")
+ /**
+ * The Unix timestamp (in seconds) of when the API key expires
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun expiresAt(): Optional = expiresAt.getOptional("expires_at")
+
/**
* The object type, which is always `organization.admin_api_key`
*
@@ -119,6 +139,13 @@ private constructor(
*/
@JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField = createdAt
+ /**
+ * Returns the raw JSON value of [expiresAt].
+ *
+ * Unlike [expiresAt], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("expires_at") @ExcludeMissing fun _expiresAt(): JsonField = expiresAt
+
/**
* Returns the raw JSON value of [owner].
*
@@ -170,6 +197,7 @@ private constructor(
* ```java
* .id()
* .createdAt()
+ * .expiresAt()
* .owner()
* .redactedValue()
* ```
@@ -182,6 +210,7 @@ private constructor(
private var id: JsonField? = null
private var createdAt: JsonField? = null
+ private var expiresAt: JsonField? = null
private var object_: JsonValue = JsonValue.from("organization.admin_api_key")
private var owner: JsonField? = null
private var redactedValue: JsonField? = null
@@ -193,6 +222,7 @@ private constructor(
internal fun from(adminApiKey: AdminApiKey) = apply {
id = adminApiKey.id
createdAt = adminApiKey.createdAt
+ expiresAt = adminApiKey.expiresAt
object_ = adminApiKey.object_
owner = adminApiKey.owner
redactedValue = adminApiKey.redactedValue
@@ -223,6 +253,27 @@ private constructor(
*/
fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
+ /** The Unix timestamp (in seconds) of when the API key expires */
+ fun expiresAt(expiresAt: Long?) = expiresAt(JsonField.ofNullable(expiresAt))
+
+ /**
+ * Alias for [Builder.expiresAt].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun expiresAt(expiresAt: Long) = expiresAt(expiresAt as Long?)
+
+ /** Alias for calling [Builder.expiresAt] with `expiresAt.orElse(null)`. */
+ fun expiresAt(expiresAt: Optional) = expiresAt(expiresAt.getOrNull())
+
+ /**
+ * Sets [Builder.expiresAt] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.expiresAt] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun expiresAt(expiresAt: JsonField) = apply { this.expiresAt = expiresAt }
+
/**
* Sets the field to an arbitrary JSON value.
*
@@ -324,6 +375,7 @@ private constructor(
* ```java
* .id()
* .createdAt()
+ * .expiresAt()
* .owner()
* .redactedValue()
* ```
@@ -334,6 +386,7 @@ private constructor(
AdminApiKey(
checkRequired("id", id),
checkRequired("createdAt", createdAt),
+ checkRequired("expiresAt", expiresAt),
object_,
checkRequired("owner", owner),
checkRequired("redactedValue", redactedValue),
@@ -360,6 +413,7 @@ private constructor(
id()
createdAt()
+ expiresAt()
_object_().let {
if (it != JsonValue.from("organization.admin_api_key")) {
throw OpenAIInvalidDataException("'object_' is invalid, received $it")
@@ -389,6 +443,7 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (expiresAt.asKnown().isPresent) 1 else 0) +
object_.let { if (it == JsonValue.from("organization.admin_api_key")) 1 else 0 } +
(owner.asKnown().getOrNull()?.validity() ?: 0) +
(if (redactedValue.asKnown().isPresent) 1 else 0) +
@@ -730,6 +785,7 @@ private constructor(
return other is AdminApiKey &&
id == other.id &&
createdAt == other.createdAt &&
+ expiresAt == other.expiresAt &&
object_ == other.object_ &&
owner == other.owner &&
redactedValue == other.redactedValue &&
@@ -742,6 +798,7 @@ private constructor(
Objects.hash(
id,
createdAt,
+ expiresAt,
object_,
owner,
redactedValue,
@@ -754,5 +811,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AdminApiKey{id=$id, createdAt=$createdAt, object_=$object_, owner=$owner, redactedValue=$redactedValue, lastUsedAt=$lastUsedAt, name=$name, additionalProperties=$additionalProperties}"
+ "AdminApiKey{id=$id, createdAt=$createdAt, expiresAt=$expiresAt, object_=$object_, owner=$owner, redactedValue=$redactedValue, lastUsedAt=$lastUsedAt, name=$name, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt
index f40398276..655aa1d4d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateParams.kt
@@ -17,6 +17,7 @@ import com.openai.core.http.QueryParams
import com.openai.errors.OpenAIInvalidDataException
import java.util.Collections
import java.util.Objects
+import java.util.Optional
/** Create an organization admin API key */
class AdminApiKeyCreateParams
@@ -32,6 +33,15 @@ private constructor(
*/
fun name(): String = body.name()
+ /**
+ * The number of seconds until the API key expires. Omit this field for a key that does not
+ * expire.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun expiresInSeconds(): Optional = body.expiresInSeconds()
+
/**
* Returns the raw JSON value of [name].
*
@@ -39,6 +49,14 @@ private constructor(
*/
fun _name(): JsonField = body._name()
+ /**
+ * Returns the raw JSON value of [expiresInSeconds].
+ *
+ * Unlike [expiresInSeconds], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ fun _expiresInSeconds(): JsonField = body._expiresInSeconds()
+
fun _additionalBodyProperties(): Map = body._additionalProperties()
/** Additional headers to send with the request. */
@@ -82,6 +100,7 @@ private constructor(
* 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:
* - [name]
+ * - [expiresInSeconds]
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -95,6 +114,25 @@ private constructor(
*/
fun name(name: JsonField) = apply { body.name(name) }
+ /**
+ * The number of seconds until the API key expires. Omit this field for a key that does not
+ * expire.
+ */
+ fun expiresInSeconds(expiresInSeconds: Long) = apply {
+ body.expiresInSeconds(expiresInSeconds)
+ }
+
+ /**
+ * Sets [Builder.expiresInSeconds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.expiresInSeconds] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun expiresInSeconds(expiresInSeconds: JsonField) = apply {
+ body.expiresInSeconds(expiresInSeconds)
+ }
+
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
}
@@ -242,13 +280,17 @@ private constructor(
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val name: JsonField,
+ private val expiresInSeconds: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of()
- ) : this(name, mutableMapOf())
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("expires_in_seconds")
+ @ExcludeMissing
+ expiresInSeconds: JsonField = JsonMissing.of(),
+ ) : this(name, expiresInSeconds, mutableMapOf())
/**
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
@@ -256,6 +298,15 @@ private constructor(
*/
fun name(): String = name.getRequired("name")
+ /**
+ * The number of seconds until the API key expires. Omit this field for a key that does not
+ * expire.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun expiresInSeconds(): Optional = expiresInSeconds.getOptional("expires_in_seconds")
+
/**
* Returns the raw JSON value of [name].
*
@@ -263,6 +314,16 @@ private constructor(
*/
@JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+ /**
+ * Returns the raw JSON value of [expiresInSeconds].
+ *
+ * Unlike [expiresInSeconds], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("expires_in_seconds")
+ @ExcludeMissing
+ fun _expiresInSeconds(): JsonField = expiresInSeconds
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -292,11 +353,13 @@ private constructor(
class Builder internal constructor() {
private var name: JsonField? = null
+ private var expiresInSeconds: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(body: Body) = apply {
name = body.name
+ expiresInSeconds = body.expiresInSeconds
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -311,6 +374,24 @@ private constructor(
*/
fun name(name: JsonField) = apply { this.name = name }
+ /**
+ * The number of seconds until the API key expires. Omit this field for a key that does
+ * not expire.
+ */
+ fun expiresInSeconds(expiresInSeconds: Long) =
+ expiresInSeconds(JsonField.of(expiresInSeconds))
+
+ /**
+ * Sets [Builder.expiresInSeconds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.expiresInSeconds] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun expiresInSeconds(expiresInSeconds: JsonField) = apply {
+ this.expiresInSeconds = expiresInSeconds
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -343,7 +424,11 @@ private constructor(
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Body =
- Body(checkRequired("name", name), additionalProperties.toMutableMap())
+ Body(
+ checkRequired("name", name),
+ expiresInSeconds,
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
@@ -363,6 +448,7 @@ private constructor(
}
name()
+ expiresInSeconds()
validated = true
}
@@ -380,7 +466,10 @@ private constructor(
*
* Used for best match union deserialization.
*/
- @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0)
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (if (expiresInSeconds.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -389,14 +478,18 @@ private constructor(
return other is Body &&
name == other.name &&
+ expiresInSeconds == other.expiresInSeconds &&
additionalProperties == other.additionalProperties
}
- private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) }
+ private val hashCode: Int by lazy {
+ Objects.hash(name, expiresInSeconds, additionalProperties)
+ }
override fun hashCode(): Int = hashCode
- override fun toString() = "Body{name=$name, additionalProperties=$additionalProperties}"
+ override fun toString() =
+ "Body{name=$name, expiresInSeconds=$expiresInSeconds, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt
index c7acdc7ed..5cd215793 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/adminapikeys/AdminApiKeyCreateResponse.kt
@@ -23,6 +23,7 @@ class AdminApiKeyCreateResponse
private constructor(
private val id: JsonField,
private val createdAt: JsonField,
+ private val expiresAt: JsonField,
private val object_: JsonValue,
private val owner: JsonField,
private val redactedValue: JsonField,
@@ -36,6 +37,7 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(),
+ @JsonProperty("expires_at") @ExcludeMissing expiresAt: JsonField = JsonMissing.of(),
@JsonProperty("object") @ExcludeMissing object_: JsonValue = JsonMissing.of(),
@JsonProperty("owner")
@ExcludeMissing
@@ -48,12 +50,24 @@ private constructor(
lastUsedAt: JsonField = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
@JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(),
- ) : this(id, createdAt, object_, owner, redactedValue, lastUsedAt, name, value, mutableMapOf())
+ ) : this(
+ id,
+ createdAt,
+ expiresAt,
+ object_,
+ owner,
+ redactedValue,
+ lastUsedAt,
+ name,
+ value,
+ mutableMapOf(),
+ )
fun toAdminApiKey(): AdminApiKey =
AdminApiKey.builder()
.id(id)
.createdAt(createdAt)
+ .expiresAt(expiresAt)
.object_(object_)
.owner(owner)
.redactedValue(redactedValue)
@@ -77,6 +91,14 @@ private constructor(
*/
fun createdAt(): Long = createdAt.getRequired("created_at")
+ /**
+ * The Unix timestamp (in seconds) of when the API key expires
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun expiresAt(): Optional = expiresAt.getOptional("expires_at")
+
/**
* The object type, which is always `organization.admin_api_key`
*
@@ -142,6 +164,13 @@ private constructor(
*/
@JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField = createdAt
+ /**
+ * Returns the raw JSON value of [expiresAt].
+ *
+ * Unlike [expiresAt], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("expires_at") @ExcludeMissing fun _expiresAt(): JsonField = expiresAt
+
/**
* Returns the raw JSON value of [owner].
*
@@ -200,6 +229,7 @@ private constructor(
* ```java
* .id()
* .createdAt()
+ * .expiresAt()
* .owner()
* .redactedValue()
* .value()
@@ -213,6 +243,7 @@ private constructor(
private var id: JsonField? = null
private var createdAt: JsonField? = null
+ private var expiresAt: JsonField? = null
private var object_: JsonValue = JsonValue.from("organization.admin_api_key")
private var owner: JsonField? = null
private var redactedValue: JsonField? = null
@@ -225,6 +256,7 @@ private constructor(
internal fun from(adminApiKeyCreateResponse: AdminApiKeyCreateResponse) = apply {
id = adminApiKeyCreateResponse.id
createdAt = adminApiKeyCreateResponse.createdAt
+ expiresAt = adminApiKeyCreateResponse.expiresAt
object_ = adminApiKeyCreateResponse.object_
owner = adminApiKeyCreateResponse.owner
redactedValue = adminApiKeyCreateResponse.redactedValue
@@ -256,6 +288,27 @@ private constructor(
*/
fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
+ /** The Unix timestamp (in seconds) of when the API key expires */
+ fun expiresAt(expiresAt: Long?) = expiresAt(JsonField.ofNullable(expiresAt))
+
+ /**
+ * Alias for [Builder.expiresAt].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun expiresAt(expiresAt: Long) = expiresAt(expiresAt as Long?)
+
+ /** Alias for calling [Builder.expiresAt] with `expiresAt.orElse(null)`. */
+ fun expiresAt(expiresAt: Optional) = expiresAt(expiresAt.getOrNull())
+
+ /**
+ * Sets [Builder.expiresAt] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.expiresAt] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun expiresAt(expiresAt: JsonField) = apply { this.expiresAt = expiresAt }
+
/**
* Sets the field to an arbitrary JSON value.
*
@@ -369,6 +422,7 @@ private constructor(
* ```java
* .id()
* .createdAt()
+ * .expiresAt()
* .owner()
* .redactedValue()
* .value()
@@ -380,6 +434,7 @@ private constructor(
AdminApiKeyCreateResponse(
checkRequired("id", id),
checkRequired("createdAt", createdAt),
+ checkRequired("expiresAt", expiresAt),
object_,
checkRequired("owner", owner),
checkRequired("redactedValue", redactedValue),
@@ -407,6 +462,7 @@ private constructor(
id()
createdAt()
+ expiresAt()
_object_().let {
if (it != JsonValue.from("organization.admin_api_key")) {
throw OpenAIInvalidDataException("'object_' is invalid, received $it")
@@ -437,6 +493,7 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (expiresAt.asKnown().isPresent) 1 else 0) +
object_.let { if (it == JsonValue.from("organization.admin_api_key")) 1 else 0 } +
(owner.asKnown().getOrNull()?.validity() ?: 0) +
(if (redactedValue.asKnown().isPresent) 1 else 0) +
@@ -452,6 +509,7 @@ private constructor(
return other is AdminApiKeyCreateResponse &&
id == other.id &&
createdAt == other.createdAt &&
+ expiresAt == other.expiresAt &&
object_ == other.object_ &&
owner == other.owner &&
redactedValue == other.redactedValue &&
@@ -465,6 +523,7 @@ private constructor(
Objects.hash(
id,
createdAt,
+ expiresAt,
object_,
owner,
redactedValue,
@@ -478,5 +537,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AdminApiKeyCreateResponse{id=$id, createdAt=$createdAt, object_=$object_, owner=$owner, redactedValue=$redactedValue, lastUsedAt=$lastUsedAt, name=$name, value=$value, additionalProperties=$additionalProperties}"
+ "AdminApiKeyCreateResponse{id=$id, createdAt=$createdAt, expiresAt=$expiresAt, object_=$object_, owner=$owner, redactedValue=$redactedValue, lastUsedAt=$lastUsedAt, name=$name, value=$value, additionalProperties=$additionalProperties}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt
index a0be53423..9f445f26f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListParams.kt
@@ -26,6 +26,7 @@ private constructor(
private val limit: Long?,
private val projectIds: List?,
private val resourceIds: List?,
+ private val tenantOnly: Boolean?,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -72,9 +73,20 @@ private constructor(
/** Return only events for these projects. */
fun projectIds(): Optional> = Optional.ofNullable(projectIds)
- /** Return only events performed on these targets. For example, a project ID updated. */
+ /**
+ * Return only events performed on these targets. For example, a project ID updated. For ChatGPT
+ * connector role events, use the workspace connector resource ID shown in `details.id`, such as
+ * `__`.
+ */
fun resourceIds(): Optional> = Optional.ofNullable(resourceIds)
+ /**
+ * Return only tenant-scoped events associated with this organization. Required for
+ * tenant-scoped events such as `role.bound_to_resource` and `role.unbound_from_resource`. When
+ * `true`, all supplied event types must be tenant-scoped.
+ */
+ fun tenantOnly(): Optional = Optional.ofNullable(tenantOnly)
+
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -103,6 +115,7 @@ private constructor(
private var limit: Long? = null
private var projectIds: MutableList? = null
private var resourceIds: MutableList? = null
+ private var tenantOnly: Boolean? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -117,6 +130,7 @@ private constructor(
limit = auditLogListParams.limit
projectIds = auditLogListParams.projectIds?.toMutableList()
resourceIds = auditLogListParams.resourceIds?.toMutableList()
+ tenantOnly = auditLogListParams.tenantOnly
additionalHeaders = auditLogListParams.additionalHeaders.toBuilder()
additionalQueryParams = auditLogListParams.additionalQueryParams.toBuilder()
}
@@ -238,7 +252,11 @@ private constructor(
projectIds = (projectIds ?: mutableListOf()).apply { add(projectId) }
}
- /** Return only events performed on these targets. For example, a project ID updated. */
+ /**
+ * Return only events performed on these targets. For example, a project ID updated. For
+ * ChatGPT connector role events, use the workspace connector resource ID shown in
+ * `details.id`, such as `__`.
+ */
fun resourceIds(resourceIds: List?) = apply {
this.resourceIds = resourceIds?.toMutableList()
}
@@ -255,6 +273,23 @@ private constructor(
resourceIds = (resourceIds ?: mutableListOf()).apply { add(resourceId) }
}
+ /**
+ * Return only tenant-scoped events associated with this organization. Required for
+ * tenant-scoped events such as `role.bound_to_resource` and `role.unbound_from_resource`.
+ * When `true`, all supplied event types must be tenant-scoped.
+ */
+ fun tenantOnly(tenantOnly: Boolean?) = apply { this.tenantOnly = tenantOnly }
+
+ /**
+ * Alias for [Builder.tenantOnly].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun tenantOnly(tenantOnly: Boolean) = tenantOnly(tenantOnly as Boolean?)
+
+ /** Alias for calling [Builder.tenantOnly] with `tenantOnly.orElse(null)`. */
+ fun tenantOnly(tenantOnly: Optional) = tenantOnly(tenantOnly.getOrNull())
+
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
putAllAdditionalHeaders(additionalHeaders)
@@ -369,6 +404,7 @@ private constructor(
limit,
projectIds?.toImmutable(),
resourceIds?.toImmutable(),
+ tenantOnly,
additionalHeaders.build(),
additionalQueryParams.build(),
)
@@ -398,6 +434,7 @@ private constructor(
limit?.let { put("limit", it.toString()) }
projectIds?.forEach { put("project_ids[]", it) }
resourceIds?.forEach { put("resource_ids[]", it) }
+ tenantOnly?.let { put("tenant_only", it.toString()) }
putAll(additionalQueryParams)
}
.build()
@@ -719,6 +756,10 @@ private constructor(
@JvmField val ROLE_ASSIGNMENT_DELETED = of("role.assignment.deleted")
+ @JvmField val ROLE_BOUND_TO_RESOURCE = of("role.bound_to_resource")
+
+ @JvmField val ROLE_UNBOUND_FROM_RESOURCE = of("role.unbound_from_resource")
+
@JvmField val SCIM_ENABLED = of("scim.enabled")
@JvmField val SCIM_DISABLED = of("scim.disabled")
@@ -789,6 +830,8 @@ private constructor(
ROLE_DELETED,
ROLE_ASSIGNMENT_CREATED,
ROLE_ASSIGNMENT_DELETED,
+ ROLE_BOUND_TO_RESOURCE,
+ ROLE_UNBOUND_FROM_RESOURCE,
SCIM_ENABLED,
SCIM_DISABLED,
SERVICE_ACCOUNT_CREATED,
@@ -858,6 +901,8 @@ private constructor(
ROLE_DELETED,
ROLE_ASSIGNMENT_CREATED,
ROLE_ASSIGNMENT_DELETED,
+ ROLE_BOUND_TO_RESOURCE,
+ ROLE_UNBOUND_FROM_RESOURCE,
SCIM_ENABLED,
SCIM_DISABLED,
SERVICE_ACCOUNT_CREATED,
@@ -933,6 +978,8 @@ private constructor(
ROLE_DELETED -> Value.ROLE_DELETED
ROLE_ASSIGNMENT_CREATED -> Value.ROLE_ASSIGNMENT_CREATED
ROLE_ASSIGNMENT_DELETED -> Value.ROLE_ASSIGNMENT_DELETED
+ ROLE_BOUND_TO_RESOURCE -> Value.ROLE_BOUND_TO_RESOURCE
+ ROLE_UNBOUND_FROM_RESOURCE -> Value.ROLE_UNBOUND_FROM_RESOURCE
SCIM_ENABLED -> Value.SCIM_ENABLED
SCIM_DISABLED -> Value.SCIM_DISABLED
SERVICE_ACCOUNT_CREATED -> Value.SERVICE_ACCOUNT_CREATED
@@ -1007,6 +1054,8 @@ private constructor(
ROLE_DELETED -> Known.ROLE_DELETED
ROLE_ASSIGNMENT_CREATED -> Known.ROLE_ASSIGNMENT_CREATED
ROLE_ASSIGNMENT_DELETED -> Known.ROLE_ASSIGNMENT_DELETED
+ ROLE_BOUND_TO_RESOURCE -> Known.ROLE_BOUND_TO_RESOURCE
+ ROLE_UNBOUND_FROM_RESOURCE -> Known.ROLE_UNBOUND_FROM_RESOURCE
SCIM_ENABLED -> Known.SCIM_ENABLED
SCIM_DISABLED -> Known.SCIM_DISABLED
SERVICE_ACCOUNT_CREATED -> Known.SERVICE_ACCOUNT_CREATED
@@ -1094,6 +1143,7 @@ private constructor(
limit == other.limit &&
projectIds == other.projectIds &&
resourceIds == other.resourceIds &&
+ tenantOnly == other.tenantOnly &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
@@ -1109,10 +1159,11 @@ private constructor(
limit,
projectIds,
resourceIds,
+ tenantOnly,
additionalHeaders,
additionalQueryParams,
)
override fun toString() =
- "AuditLogListParams{actorEmails=$actorEmails, actorIds=$actorIds, after=$after, before=$before, effectiveAt=$effectiveAt, eventTypes=$eventTypes, limit=$limit, projectIds=$projectIds, resourceIds=$resourceIds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "AuditLogListParams{actorEmails=$actorEmails, actorIds=$actorIds, after=$after, before=$before, effectiveAt=$effectiveAt, eventTypes=$eventTypes, limit=$limit, projectIds=$projectIds, resourceIds=$resourceIds, tenantOnly=$tenantOnly, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt
index 11f1eb208..81c8bf1e1 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/admin/organization/auditlogs/AuditLogListResponse.kt
@@ -65,8 +65,10 @@ private constructor(
private val rateLimitUpdated: JsonField,
private val roleAssignmentCreated: JsonField,
private val roleAssignmentDeleted: JsonField,
+ private val roleBoundToResource: JsonField,
private val roleCreated: JsonField,
private val roleDeleted: JsonField,
+ private val roleUnboundFromResource: JsonField,
private val roleUpdated: JsonField,
private val scimDisabled: JsonField,
private val scimEnabled: JsonField,
@@ -205,12 +207,18 @@ private constructor(
@JsonProperty("role.assignment.deleted")
@ExcludeMissing
roleAssignmentDeleted: JsonField = JsonMissing.of(),
+ @JsonProperty("role.bound_to_resource")
+ @ExcludeMissing
+ roleBoundToResource: JsonField = JsonMissing.of(),
@JsonProperty("role.created")
@ExcludeMissing
roleCreated: JsonField = JsonMissing.of(),
@JsonProperty("role.deleted")
@ExcludeMissing
roleDeleted: JsonField = JsonMissing.of(),
+ @JsonProperty("role.unbound_from_resource")
+ @ExcludeMissing
+ roleUnboundFromResource: JsonField = JsonMissing.of(),
@JsonProperty("role.updated")
@ExcludeMissing
roleUpdated: JsonField = JsonMissing.of(),
@@ -304,8 +312,10 @@ private constructor(
rateLimitUpdated,
roleAssignmentCreated,
roleAssignmentDeleted,
+ roleBoundToResource,
roleCreated,
roleDeleted,
+ roleUnboundFromResource,
roleUpdated,
scimDisabled,
scimEnabled,
@@ -681,6 +691,15 @@ private constructor(
fun roleAssignmentDeleted(): Optional =
roleAssignmentDeleted.getOptional("role.assignment.deleted")
+ /**
+ * The details for events with this `type`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun roleBoundToResource(): Optional =
+ roleBoundToResource.getOptional("role.bound_to_resource")
+
/**
* The details for events with this `type`.
*
@@ -697,6 +716,15 @@ private constructor(
*/
fun roleDeleted(): Optional = roleDeleted.getOptional("role.deleted")
+ /**
+ * The details for events with this `type`.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun roleUnboundFromResource(): Optional =
+ roleUnboundFromResource.getOptional("role.unbound_from_resource")
+
/**
* The details for events with this `type`.
*
@@ -1196,6 +1224,16 @@ private constructor(
@ExcludeMissing
fun _roleAssignmentDeleted(): JsonField = roleAssignmentDeleted
+ /**
+ * Returns the raw JSON value of [roleBoundToResource].
+ *
+ * Unlike [roleBoundToResource], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("role.bound_to_resource")
+ @ExcludeMissing
+ fun _roleBoundToResource(): JsonField = roleBoundToResource
+
/**
* Returns the raw JSON value of [roleCreated].
*
@@ -1214,6 +1252,16 @@ private constructor(
@ExcludeMissing
fun _roleDeleted(): JsonField = roleDeleted
+ /**
+ * Returns the raw JSON value of [roleUnboundFromResource].
+ *
+ * Unlike [roleUnboundFromResource], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("role.unbound_from_resource")
+ @ExcludeMissing
+ fun _roleUnboundFromResource(): JsonField = roleUnboundFromResource
+
/**
* Returns the raw JSON value of [roleUpdated].
*
@@ -1437,8 +1485,10 @@ private constructor(
private var rateLimitUpdated: JsonField = JsonMissing.of()
private var roleAssignmentCreated: JsonField = JsonMissing.of()
private var roleAssignmentDeleted: JsonField = JsonMissing.of()
+ private var roleBoundToResource: JsonField = JsonMissing.of()
private var roleCreated: JsonField = JsonMissing.of()
private var roleDeleted: JsonField = JsonMissing.of()
+ private var roleUnboundFromResource: JsonField = JsonMissing.of()
private var roleUpdated: JsonField = JsonMissing.of()
private var scimDisabled: JsonField = JsonMissing.of()
private var scimEnabled: JsonField = JsonMissing.of()
@@ -1508,8 +1558,10 @@ private constructor(
rateLimitUpdated = auditLogListResponse.rateLimitUpdated
roleAssignmentCreated = auditLogListResponse.roleAssignmentCreated
roleAssignmentDeleted = auditLogListResponse.roleAssignmentDeleted
+ roleBoundToResource = auditLogListResponse.roleBoundToResource
roleCreated = auditLogListResponse.roleCreated
roleDeleted = auditLogListResponse.roleDeleted
+ roleUnboundFromResource = auditLogListResponse.roleUnboundFromResource
roleUpdated = auditLogListResponse.roleUpdated
scimDisabled = auditLogListResponse.scimDisabled
scimEnabled = auditLogListResponse.scimEnabled
@@ -2107,6 +2159,21 @@ private constructor(
this.roleAssignmentDeleted = roleAssignmentDeleted
}
+ /** The details for events with this `type`. */
+ fun roleBoundToResource(roleBoundToResource: RoleBoundToResource) =
+ roleBoundToResource(JsonField.of(roleBoundToResource))
+
+ /**
+ * Sets [Builder.roleBoundToResource] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.roleBoundToResource] with a well-typed
+ * [RoleBoundToResource] value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun roleBoundToResource(roleBoundToResource: JsonField) = apply {
+ this.roleBoundToResource = roleBoundToResource
+ }
+
/** The details for events with this `type`. */
fun roleCreated(roleCreated: RoleCreated) = roleCreated(JsonField.of(roleCreated))
@@ -2135,6 +2202,22 @@ private constructor(
this.roleDeleted = roleDeleted
}
+ /** The details for events with this `type`. */
+ fun roleUnboundFromResource(roleUnboundFromResource: RoleUnboundFromResource) =
+ roleUnboundFromResource(JsonField.of(roleUnboundFromResource))
+
+ /**
+ * Sets [Builder.roleUnboundFromResource] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.roleUnboundFromResource] with a well-typed
+ * [RoleUnboundFromResource] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun roleUnboundFromResource(roleUnboundFromResource: JsonField) =
+ apply {
+ this.roleUnboundFromResource = roleUnboundFromResource
+ }
+
/** The details for events with this `type`. */
fun roleUpdated(roleUpdated: RoleUpdated) = roleUpdated(JsonField.of(roleUpdated))
@@ -2452,8 +2535,10 @@ private constructor(
rateLimitUpdated,
roleAssignmentCreated,
roleAssignmentDeleted,
+ roleBoundToResource,
roleCreated,
roleDeleted,
+ roleUnboundFromResource,
roleUpdated,
scimDisabled,
scimEnabled,
@@ -2527,8 +2612,10 @@ private constructor(
rateLimitUpdated().ifPresent { it.validate() }
roleAssignmentCreated().ifPresent { it.validate() }
roleAssignmentDeleted().ifPresent { it.validate() }
+ roleBoundToResource().ifPresent { it.validate() }
roleCreated().ifPresent { it.validate() }
roleDeleted().ifPresent { it.validate() }
+ roleUnboundFromResource().ifPresent { it.validate() }
roleUpdated().ifPresent { it.validate() }
scimDisabled().ifPresent { it.validate() }
scimEnabled().ifPresent { it.validate() }
@@ -2601,8 +2688,10 @@ private constructor(
(rateLimitUpdated.asKnown().getOrNull()?.validity() ?: 0) +
(roleAssignmentCreated.asKnown().getOrNull()?.validity() ?: 0) +
(roleAssignmentDeleted.asKnown().getOrNull()?.validity() ?: 0) +
+ (roleBoundToResource.asKnown().getOrNull()?.validity() ?: 0) +
(roleCreated.asKnown().getOrNull()?.validity() ?: 0) +
(roleDeleted.asKnown().getOrNull()?.validity() ?: 0) +
+ (roleUnboundFromResource.asKnown().getOrNull()?.validity() ?: 0) +
(roleUpdated.asKnown().getOrNull()?.validity() ?: 0) +
(scimDisabled.asKnown().getOrNull()?.validity() ?: 0) +
(scimEnabled.asKnown().getOrNull()?.validity() ?: 0) +
@@ -2741,6 +2830,10 @@ private constructor(
@JvmField val ROLE_ASSIGNMENT_DELETED = of("role.assignment.deleted")
+ @JvmField val ROLE_BOUND_TO_RESOURCE = of("role.bound_to_resource")
+
+ @JvmField val ROLE_UNBOUND_FROM_RESOURCE = of("role.unbound_from_resource")
+
@JvmField val SCIM_ENABLED = of("scim.enabled")
@JvmField val SCIM_DISABLED = of("scim.disabled")
@@ -2811,6 +2904,8 @@ private constructor(
ROLE_DELETED,
ROLE_ASSIGNMENT_CREATED,
ROLE_ASSIGNMENT_DELETED,
+ ROLE_BOUND_TO_RESOURCE,
+ ROLE_UNBOUND_FROM_RESOURCE,
SCIM_ENABLED,
SCIM_DISABLED,
SERVICE_ACCOUNT_CREATED,
@@ -2880,6 +2975,8 @@ private constructor(
ROLE_DELETED,
ROLE_ASSIGNMENT_CREATED,
ROLE_ASSIGNMENT_DELETED,
+ ROLE_BOUND_TO_RESOURCE,
+ ROLE_UNBOUND_FROM_RESOURCE,
SCIM_ENABLED,
SCIM_DISABLED,
SERVICE_ACCOUNT_CREATED,
@@ -2953,6 +3050,8 @@ private constructor(
ROLE_DELETED -> Value.ROLE_DELETED
ROLE_ASSIGNMENT_CREATED -> Value.ROLE_ASSIGNMENT_CREATED
ROLE_ASSIGNMENT_DELETED -> Value.ROLE_ASSIGNMENT_DELETED
+ ROLE_BOUND_TO_RESOURCE -> Value.ROLE_BOUND_TO_RESOURCE
+ ROLE_UNBOUND_FROM_RESOURCE -> Value.ROLE_UNBOUND_FROM_RESOURCE
SCIM_ENABLED -> Value.SCIM_ENABLED
SCIM_DISABLED -> Value.SCIM_DISABLED
SERVICE_ACCOUNT_CREATED -> Value.SERVICE_ACCOUNT_CREATED
@@ -3027,6 +3126,8 @@ private constructor(
ROLE_DELETED -> Known.ROLE_DELETED
ROLE_ASSIGNMENT_CREATED -> Known.ROLE_ASSIGNMENT_CREATED
ROLE_ASSIGNMENT_DELETED -> Known.ROLE_ASSIGNMENT_DELETED
+ ROLE_BOUND_TO_RESOURCE -> Known.ROLE_BOUND_TO_RESOURCE
+ ROLE_UNBOUND_FROM_RESOURCE -> Known.ROLE_UNBOUND_FROM_RESOURCE
SCIM_ENABLED -> Known.SCIM_ENABLED
SCIM_DISABLED -> Known.SCIM_DISABLED
SERVICE_ACCOUNT_CREATED -> Known.SERVICE_ACCOUNT_CREATED
@@ -14385,20 +14486,32 @@ private constructor(
}
/** The details for events with this `type`. */
- class RoleCreated
+ class RoleBoundToResource
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val id: JsonField,
+ private val connectorId: JsonField,
+ private val connectorName: JsonField,
+ private val enabled: JsonField,
private val permissions: JsonField>,
private val resourceId: JsonField,
private val resourceType: JsonField,
- private val roleName: JsonField,
+ private val roleId: JsonField,
+ private val source: JsonField,
+ private val workspaceId: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("connector_id")
+ @ExcludeMissing
+ connectorId: JsonField = JsonMissing.of(),
+ @JsonProperty("connector_name")
+ @ExcludeMissing
+ connectorName: JsonField = JsonMissing.of(),
+ @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(),
@JsonProperty("permissions")
@ExcludeMissing
permissions: JsonField> = JsonMissing.of(),
@@ -14408,13 +14521,28 @@ private constructor(
@JsonProperty("resource_type")
@ExcludeMissing
resourceType: JsonField = JsonMissing.of(),
- @JsonProperty("role_name")
+ @JsonProperty("role_id") @ExcludeMissing roleId: JsonField = JsonMissing.of(),
+ @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(),
+ @JsonProperty("workspace_id")
@ExcludeMissing
- roleName: JsonField = JsonMissing.of(),
- ) : this(id, permissions, resourceId, resourceType, roleName, mutableMapOf())
+ workspaceId: JsonField = JsonMissing.of(),
+ ) : this(
+ id,
+ connectorId,
+ connectorName,
+ enabled,
+ permissions,
+ resourceId,
+ resourceType,
+ roleId,
+ source,
+ workspaceId,
+ mutableMapOf(),
+ )
/**
- * The role ID.
+ * The ID of the resource the role was bound to. ChatGPT workspace connector resources use
+ * `__`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -14422,7 +14550,32 @@ private constructor(
fun id(): Optional = id.getOptional("id")
/**
- * The permissions granted by the role.
+ * The connector ID for a ChatGPT workspace connector resource.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun connectorId(): Optional = connectorId.getOptional("connector_id")
+
+ /**
+ * The connector display name for a ChatGPT workspace connector resource, or the connector
+ * ID when the display name could not be resolved.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun connectorName(): Optional = connectorName.getOptional("connector_name")
+
+ /**
+ * Whether the connector is enabled for the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun enabled(): Optional = enabled.getOptional("enabled")
+
+ /**
+ * The permissions granted to the role for the resource.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -14430,7 +14583,7 @@ private constructor(
fun permissions(): Optional> = permissions.getOptional("permissions")
/**
- * The resource the role is scoped to.
+ * The ID of the resource the role was bound to.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -14438,7 +14591,7 @@ private constructor(
fun resourceId(): Optional = resourceId.getOptional("resource_id")
/**
- * The type of resource the role belongs to.
+ * The type of resource the role was bound to.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -14446,12 +14599,28 @@ private constructor(
fun resourceType(): Optional = resourceType.getOptional("resource_type")
/**
- * The name of the role.
+ * The ID of the role that was bound to the resource.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
- fun roleName(): Optional = roleName.getOptional("role_name")
+ fun roleId(): Optional = roleId.getOptional("role_id")
+
+ /**
+ * The connector role mutation path that produced the event.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun source(): Optional = source.getOptional("source")
+
+ /**
+ * The workspace ID for a ChatGPT workspace connector resource.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun workspaceId(): Optional = workspaceId.getOptional("workspace_id")
/**
* Returns the raw JSON value of [id].
@@ -14460,6 +14629,32 @@ private constructor(
*/
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+ /**
+ * Returns the raw JSON value of [connectorId].
+ *
+ * Unlike [connectorId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("connector_id")
+ @ExcludeMissing
+ fun _connectorId(): JsonField = connectorId
+
+ /**
+ * Returns the raw JSON value of [connectorName].
+ *
+ * Unlike [connectorName], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("connector_name")
+ @ExcludeMissing
+ fun _connectorName(): JsonField = connectorName
+
+ /**
+ * Returns the raw JSON value of [enabled].
+ *
+ * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled
+
/**
* Returns the raw JSON value of [permissions].
*
@@ -14489,11 +14684,27 @@ private constructor(
fun _resourceType(): JsonField = resourceType
/**
- * Returns the raw JSON value of [roleName].
+ * Returns the raw JSON value of [roleId].
*
- * Unlike [roleName], this method doesn't throw if the JSON field has an unexpected type.
+ * Unlike [roleId], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("role_name") @ExcludeMissing fun _roleName(): JsonField = roleName
+ @JsonProperty("role_id") @ExcludeMissing fun _roleId(): JsonField = roleId
+
+ /**
+ * Returns the raw JSON value of [source].
+ *
+ * Unlike [source], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source
+
+ /**
+ * Returns the raw JSON value of [workspaceId].
+ *
+ * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("workspace_id")
+ @ExcludeMissing
+ fun _workspaceId(): JsonField = workspaceId
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
@@ -14509,31 +14720,44 @@ private constructor(
companion object {
- /** Returns a mutable builder for constructing an instance of [RoleCreated]. */
+ /** Returns a mutable builder for constructing an instance of [RoleBoundToResource]. */
@JvmStatic fun builder() = Builder()
}
- /** A builder for [RoleCreated]. */
+ /** A builder for [RoleBoundToResource]. */
class Builder internal constructor() {
private var id: JsonField = JsonMissing.of()
+ private var connectorId: JsonField = JsonMissing.of()
+ private var connectorName: JsonField = JsonMissing.of()
+ private var enabled: JsonField = JsonMissing.of()
private var permissions: JsonField>? = null
private var resourceId: JsonField = JsonMissing.of()
private var resourceType: JsonField = JsonMissing.of()
- private var roleName: JsonField = JsonMissing.of()
+ private var roleId: JsonField = JsonMissing.of()
+ private var source: JsonField = JsonMissing.of()
+ private var workspaceId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(roleCreated: RoleCreated) = apply {
- id = roleCreated.id
- permissions = roleCreated.permissions.map { it.toMutableList() }
- resourceId = roleCreated.resourceId
- resourceType = roleCreated.resourceType
- roleName = roleCreated.roleName
- additionalProperties = roleCreated.additionalProperties.toMutableMap()
+ internal fun from(roleBoundToResource: RoleBoundToResource) = apply {
+ id = roleBoundToResource.id
+ connectorId = roleBoundToResource.connectorId
+ connectorName = roleBoundToResource.connectorName
+ enabled = roleBoundToResource.enabled
+ permissions = roleBoundToResource.permissions.map { it.toMutableList() }
+ resourceId = roleBoundToResource.resourceId
+ resourceType = roleBoundToResource.resourceType
+ roleId = roleBoundToResource.roleId
+ source = roleBoundToResource.source
+ workspaceId = roleBoundToResource.workspaceId
+ additionalProperties = roleBoundToResource.additionalProperties.toMutableMap()
}
- /** The role ID. */
+ /**
+ * The ID of the resource the role was bound to. ChatGPT workspace connector resources
+ * use `__`.
+ */
fun id(id: String) = id(JsonField.of(id))
/**
@@ -14545,7 +14769,50 @@ private constructor(
*/
fun id(id: JsonField) = apply { this.id = id }
- /** The permissions granted by the role. */
+ /** The connector ID for a ChatGPT workspace connector resource. */
+ fun connectorId(connectorId: String) = connectorId(JsonField.of(connectorId))
+
+ /**
+ * Sets [Builder.connectorId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.connectorId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun connectorId(connectorId: JsonField) = apply {
+ this.connectorId = connectorId
+ }
+
+ /**
+ * The connector display name for a ChatGPT workspace connector resource, or the
+ * connector ID when the display name could not be resolved.
+ */
+ fun connectorName(connectorName: String) = connectorName(JsonField.of(connectorName))
+
+ /**
+ * Sets [Builder.connectorName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.connectorName] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun connectorName(connectorName: JsonField) = apply {
+ this.connectorName = connectorName
+ }
+
+ /** Whether the connector is enabled for the role. */
+ fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled))
+
+ /**
+ * Sets [Builder.enabled] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun enabled(enabled: JsonField) = apply { this.enabled = enabled }
+
+ /** The permissions granted to the role for the resource. */
fun permissions(permissions: List) = permissions(JsonField.of(permissions))
/**
@@ -14571,7 +14838,7 @@ private constructor(
}
}
- /** The resource the role is scoped to. */
+ /** The ID of the resource the role was bound to. */
fun resourceId(resourceId: String) = resourceId(JsonField.of(resourceId))
/**
@@ -14583,7 +14850,7 @@ private constructor(
*/
fun resourceId(resourceId: JsonField) = apply { this.resourceId = resourceId }
- /** The type of resource the role belongs to. */
+ /** The type of resource the role was bound to. */
fun resourceType(resourceType: String) = resourceType(JsonField.of(resourceType))
/**
@@ -14597,17 +14864,43 @@ private constructor(
this.resourceType = resourceType
}
- /** The name of the role. */
- fun roleName(roleName: String) = roleName(JsonField.of(roleName))
+ /** The ID of the role that was bound to the resource. */
+ fun roleId(roleId: String) = roleId(JsonField.of(roleId))
/**
- * Sets [Builder.roleName] to an arbitrary JSON value.
+ * Sets [Builder.roleId] to an arbitrary JSON value.
*
- * You should usually call [Builder.roleName] with a well-typed [String] value instead.
+ * You should usually call [Builder.roleId] with a well-typed [String] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
- fun roleName(roleName: JsonField) = apply { this.roleName = roleName }
+ fun roleId(roleId: JsonField) = apply { this.roleId = roleId }
+
+ /** The connector role mutation path that produced the event. */
+ fun source(source: Source) = source(JsonField.of(source))
+
+ /**
+ * Sets [Builder.source] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.source] with a well-typed [Source] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun source(source: JsonField) = apply { this.source = source }
+
+ /** The workspace ID for a ChatGPT workspace connector resource. */
+ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId))
+
+ /**
+ * Sets [Builder.workspaceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.workspaceId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun workspaceId(workspaceId: JsonField) = apply {
+ this.workspaceId = workspaceId
+ }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -14629,17 +14922,22 @@ private constructor(
}
/**
- * Returns an immutable instance of [RoleCreated].
+ * Returns an immutable instance of [RoleBoundToResource].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
- fun build(): RoleCreated =
- RoleCreated(
+ fun build(): RoleBoundToResource =
+ RoleBoundToResource(
id,
+ connectorId,
+ connectorName,
+ enabled,
(permissions ?: JsonMissing.of()).map { it.toImmutable() },
resourceId,
resourceType,
- roleName,
+ roleId,
+ source,
+ workspaceId,
additionalProperties.toMutableMap(),
)
}
@@ -14655,16 +14953,21 @@ private constructor(
* @throws OpenAIInvalidDataException if any value type in this object doesn't match its
* expected type.
*/
- fun validate(): RoleCreated = apply {
+ fun validate(): RoleBoundToResource = apply {
if (validated) {
return@apply
}
id()
+ connectorId()
+ connectorName()
+ enabled()
permissions()
resourceId()
resourceType()
- roleName()
+ roleId()
+ source().ifPresent { it.validate() }
+ workspaceId()
validated = true
}
@@ -14685,94 +14988,970 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
+ (if (connectorId.asKnown().isPresent) 1 else 0) +
+ (if (connectorName.asKnown().isPresent) 1 else 0) +
+ (if (enabled.asKnown().isPresent) 1 else 0) +
(permissions.asKnown().getOrNull()?.size ?: 0) +
(if (resourceId.asKnown().isPresent) 1 else 0) +
(if (resourceType.asKnown().isPresent) 1 else 0) +
- (if (roleName.asKnown().isPresent) 1 else 0)
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
+ (if (roleId.asKnown().isPresent) 1 else 0) +
+ (source.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (workspaceId.asKnown().isPresent) 1 else 0)
- return other is RoleCreated &&
- id == other.id &&
- permissions == other.permissions &&
- resourceId == other.resourceId &&
- resourceType == other.resourceType &&
- roleName == other.roleName &&
- additionalProperties == other.additionalProperties
- }
+ /** The connector role mutation path that produced the event. */
+ class Source @JsonCreator private constructor(private val value: JsonField) : Enum {
- private val hashCode: Int by lazy {
- Objects.hash(id, permissions, resourceId, resourceType, roleName, additionalProperties)
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "RoleCreated{id=$id, permissions=$permissions, resourceId=$resourceId, resourceType=$resourceType, roleName=$roleName, additionalProperties=$additionalProperties}"
- }
+ /**
+ * 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
- /** The details for events with this `type`. */
- class RoleDeleted
- @JsonCreator(mode = JsonCreator.Mode.DISABLED)
- private constructor(
- private val id: JsonField,
- private val additionalProperties: MutableMap,
- ) {
+ companion object {
- @JsonCreator
- private constructor(
- @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of()
- ) : this(id, mutableMapOf())
+ @JvmField val ROLE_TOGGLE = of("role_toggle")
- /**
- * The role ID.
- *
- * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun id(): Optional = id.getOptional("id")
+ @JvmField val ROLE_CONNECTOR_UPDATE = of("role_connector_update")
- /**
- * 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
+ @JvmField val ROLE_DELETE = of("role_delete")
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
- }
+ @JvmField val WORKSPACE_PERMISSIONS = of("workspace_permissions")
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
+ @JvmField val CONNECTOR_PUBLISH = of("connector_publish")
- fun toBuilder() = Builder().from(this)
+ @JvmStatic fun of(value: String) = Source(JsonField.of(value))
+ }
- companion object {
+ /** An enum containing [Source]'s known values. */
+ enum class Known {
+ ROLE_TOGGLE,
+ ROLE_CONNECTOR_UPDATE,
+ ROLE_DELETE,
+ WORKSPACE_PERMISSIONS,
+ CONNECTOR_PUBLISH,
+ }
+
+ /**
+ * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Source] 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 {
+ ROLE_TOGGLE,
+ ROLE_CONNECTOR_UPDATE,
+ ROLE_DELETE,
+ WORKSPACE_PERMISSIONS,
+ CONNECTOR_PUBLISH,
+ /**
+ * An enum member indicating that [Source] 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) {
+ ROLE_TOGGLE -> Value.ROLE_TOGGLE
+ ROLE_CONNECTOR_UPDATE -> Value.ROLE_CONNECTOR_UPDATE
+ ROLE_DELETE -> Value.ROLE_DELETE
+ WORKSPACE_PERMISSIONS -> Value.WORKSPACE_PERMISSIONS
+ CONNECTOR_PUBLISH -> Value.CONNECTOR_PUBLISH
+ 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) {
+ ROLE_TOGGLE -> Known.ROLE_TOGGLE
+ ROLE_CONNECTOR_UPDATE -> Known.ROLE_CONNECTOR_UPDATE
+ ROLE_DELETE -> Known.ROLE_DELETE
+ WORKSPACE_PERMISSIONS -> Known.WORKSPACE_PERMISSIONS
+ CONNECTOR_PUBLISH -> Known.CONNECTOR_PUBLISH
+ else -> throw OpenAIInvalidDataException("Unknown Source: $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(): Source = 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 Source && 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 RoleBoundToResource &&
+ id == other.id &&
+ connectorId == other.connectorId &&
+ connectorName == other.connectorName &&
+ enabled == other.enabled &&
+ permissions == other.permissions &&
+ resourceId == other.resourceId &&
+ resourceType == other.resourceType &&
+ roleId == other.roleId &&
+ source == other.source &&
+ workspaceId == other.workspaceId &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ id,
+ connectorId,
+ connectorName,
+ enabled,
+ permissions,
+ resourceId,
+ resourceType,
+ roleId,
+ source,
+ workspaceId,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "RoleBoundToResource{id=$id, connectorId=$connectorId, connectorName=$connectorName, enabled=$enabled, permissions=$permissions, resourceId=$resourceId, resourceType=$resourceType, roleId=$roleId, source=$source, workspaceId=$workspaceId, additionalProperties=$additionalProperties}"
+ }
+
+ /** The details for events with this `type`. */
+ class RoleCreated
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val id: JsonField,
+ private val permissions: JsonField>,
+ private val resourceId: JsonField,
+ private val resourceType: JsonField,
+ private val roleName: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("permissions")
+ @ExcludeMissing
+ permissions: JsonField> = JsonMissing.of(),
+ @JsonProperty("resource_id")
+ @ExcludeMissing
+ resourceId: JsonField = JsonMissing.of(),
+ @JsonProperty("resource_type")
+ @ExcludeMissing
+ resourceType: JsonField = JsonMissing.of(),
+ @JsonProperty("role_name")
+ @ExcludeMissing
+ roleName: JsonField = JsonMissing.of(),
+ ) : this(id, permissions, resourceId, resourceType, roleName, mutableMapOf())
+
+ /**
+ * The role ID.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun id(): Optional = id.getOptional("id")
+
+ /**
+ * The permissions granted by the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun permissions(): Optional> = permissions.getOptional("permissions")
+
+ /**
+ * The resource the role is scoped to.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun resourceId(): Optional = resourceId.getOptional("resource_id")
+
+ /**
+ * The type of resource the role belongs to.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun resourceType(): Optional = resourceType.getOptional("resource_type")
+
+ /**
+ * The name of the role.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun roleName(): Optional = roleName.getOptional("role_name")
+
+ /**
+ * 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 [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 [resourceId].
+ *
+ * Unlike [resourceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("resource_id")
+ @ExcludeMissing
+ fun _resourceId(): JsonField = resourceId
+
+ /**
+ * 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 [roleName].
+ *
+ * Unlike [roleName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("role_name") @ExcludeMissing fun _roleName(): JsonField = roleName
+
+ @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 [RoleCreated]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [RoleCreated]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField = JsonMissing.of()
+ private var permissions: JsonField>? = null
+ private var resourceId: JsonField = JsonMissing.of()
+ private var resourceType: JsonField = JsonMissing.of()
+ private var roleName: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(roleCreated: RoleCreated) = apply {
+ id = roleCreated.id
+ permissions = roleCreated.permissions.map { it.toMutableList() }
+ resourceId = roleCreated.resourceId
+ resourceType = roleCreated.resourceType
+ roleName = roleCreated.roleName
+ additionalProperties = roleCreated.additionalProperties.toMutableMap()
+ }
+
+ /** The role ID. */
+ 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 }
+
+ /** The permissions granted by 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)
+ }
+ }
+
+ /** The resource the role is scoped to. */
+ fun resourceId(resourceId: String) = resourceId(JsonField.of(resourceId))
+
+ /**
+ * Sets [Builder.resourceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.resourceId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun resourceId(resourceId: JsonField) = apply { this.resourceId = resourceId }
+
+ /** The type of resource the role belongs 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
+ }
+
+ /** The name of the role. */
+ fun roleName(roleName: String) = roleName(JsonField.of(roleName))
+
+ /**
+ * Sets [Builder.roleName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.roleName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun roleName(roleName: JsonField) = apply { this.roleName = roleName }
+
+ 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 [RoleCreated].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): RoleCreated =
+ RoleCreated(
+ id,
+ (permissions ?: JsonMissing.of()).map { it.toImmutable() },
+ resourceId,
+ resourceType,
+ roleName,
+ 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(): RoleCreated = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ permissions()
+ resourceId()
+ resourceType()
+ roleName()
+ 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) +
+ (permissions.asKnown().getOrNull()?.size ?: 0) +
+ (if (resourceId.asKnown().isPresent) 1 else 0) +
+ (if (resourceType.asKnown().isPresent) 1 else 0) +
+ (if (roleName.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RoleCreated &&
+ id == other.id &&
+ permissions == other.permissions &&
+ resourceId == other.resourceId &&
+ resourceType == other.resourceType &&
+ roleName == other.roleName &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(id, permissions, resourceId, resourceType, roleName, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "RoleCreated{id=$id, permissions=$permissions, resourceId=$resourceId, resourceType=$resourceType, roleName=$roleName, additionalProperties=$additionalProperties}"
+ }
+
+ /** The details for events with this `type`. */
+ class RoleDeleted
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val id: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of()
+ ) : this(id, mutableMapOf())
+
+ /**
+ * The role ID.
+ *
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun id(): Optional = id.getOptional("id")
+
+ /**
+ * Returns the raw JSON value of [id].
+ *
+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map