diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 733678539..3ab3b9e3d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.46.0" + ".": "2.47.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 4888e3462..c45ebbf3c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-04d07a5a32685ff9769f89d63e4ceaa49738b4d8dac73041bc9a691759350108.yml -openapi_spec_hash: d793931588b3a62fad0cfbae27ad6654 -config_hash: 7315b549547ccd1891c7fe53f6a1796a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-dffbd6e37f0be6d218800cdb283e5ad958c715021986d788e10c89c0a80a9f44.yml +openapi_spec_hash: 753042938edfcbf43eb60c63c3369a30 +config_hash: 2fc184efddefac872a2f58876711b4f5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 584b42079..d5cf57085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.47.0 (2026-06-30) + +Full Changelog: [v2.46.0...v2.47.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.46.0...v2.47.0) + +### Features + +* **api:** add support for Managed Agents event delta streaming, agent overrides, reverse pagination, vault credential injection scoping, and agent and deployment webhook events ([5eed04b](https://github.com/anthropics/anthropic-sdk-java/commit/5eed04b793a44b9d3dabbafe079d88ba0ac6651f)) + ## 2.46.0 (2026-06-30) Full Changelog: [v2.45.0...v2.46.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.45.0...v2.46.0) diff --git a/README.md b/README.md index 0553f95bb..468ca10a8 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Full documentation is available at **[platform.claude.com/docs/en/api/sdks/java] ### Gradle ```kotlin -implementation("com.anthropic:anthropic-java:2.46.0") +implementation("com.anthropic:anthropic-java:2.47.0") ``` ### Maven @@ -24,7 +24,7 @@ implementation("com.anthropic:anthropic-java:2.46.0") com.anthropic anthropic-java - 2.46.0 + 2.47.0 ``` diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt index 35c154fda..7f79aed77 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt @@ -66,6 +66,8 @@ internal fun sseHandler(jsonMapper: JsonMapper): Handler yield(message) "ping" -> continue "error" -> { diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWork.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWork.kt index d8eb3071d..f5e067341 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWork.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWork.kt @@ -35,6 +35,7 @@ private constructor( private val environmentId: JsonField, private val latestHeartbeatAt: JsonField, private val metadata: JsonField, + private val secret: JsonField, private val startedAt: JsonField, private val state: JsonField, private val stopRequestedAt: JsonField, @@ -60,6 +61,7 @@ private constructor( @ExcludeMissing latestHeartbeatAt: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("secret") @ExcludeMissing secret: JsonField = JsonMissing.of(), @JsonProperty("started_at") @ExcludeMissing startedAt: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), @JsonProperty("stop_requested_at") @@ -75,6 +77,7 @@ private constructor( environmentId, latestHeartbeatAt, metadata, + secret, startedAt, state, stopRequestedAt, @@ -139,6 +142,15 @@ private constructor( */ fun metadata(): Metadata = metadata.getRequired("metadata") + /** + * Credential payload used by the environment worker to execute this work item. May be populated + * when polling for work; null on all other retrieval paths. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun secret(): Optional = secret.getOptional("secret") + /** * RFC 3339 timestamp when work execution started * @@ -240,6 +252,13 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [secret]. + * + * Unlike [secret], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("secret") @ExcludeMissing fun _secret(): JsonField = secret + /** * Returns the raw JSON value of [startedAt]. * @@ -296,6 +315,7 @@ private constructor( * .environmentId() * .latestHeartbeatAt() * .metadata() + * .secret() * .startedAt() * .state() * .stopRequestedAt() @@ -315,6 +335,7 @@ private constructor( private var environmentId: JsonField? = null private var latestHeartbeatAt: JsonField? = null private var metadata: JsonField? = null + private var secret: JsonField? = null private var startedAt: JsonField? = null private var state: JsonField? = null private var stopRequestedAt: JsonField? = null @@ -331,6 +352,7 @@ private constructor( environmentId = betaSelfHostedWork.environmentId latestHeartbeatAt = betaSelfHostedWork.latestHeartbeatAt metadata = betaSelfHostedWork.metadata + secret = betaSelfHostedWork.secret startedAt = betaSelfHostedWork.startedAt state = betaSelfHostedWork.state stopRequestedAt = betaSelfHostedWork.stopRequestedAt @@ -441,6 +463,23 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * Credential payload used by the environment worker to execute this work item. May be + * populated when polling for work; null on all other retrieval paths. + */ + fun secret(secret: String?) = secret(JsonField.ofNullable(secret)) + + /** Alias for calling [Builder.secret] with `secret.orElse(null)`. */ + fun secret(secret: Optional) = secret(secret.getOrNull()) + + /** + * Sets [Builder.secret] to an arbitrary JSON value. + * + * You should usually call [Builder.secret] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun secret(secret: JsonField) = apply { this.secret = secret } + /** RFC 3339 timestamp when work execution started */ fun startedAt(startedAt: String?) = startedAt(JsonField.ofNullable(startedAt)) @@ -548,6 +587,7 @@ private constructor( * .environmentId() * .latestHeartbeatAt() * .metadata() + * .secret() * .startedAt() * .state() * .stopRequestedAt() @@ -565,6 +605,7 @@ private constructor( checkRequired("environmentId", environmentId), checkRequired("latestHeartbeatAt", latestHeartbeatAt), checkRequired("metadata", metadata), + checkRequired("secret", secret), checkRequired("startedAt", startedAt), checkRequired("state", state), checkRequired("stopRequestedAt", stopRequestedAt), @@ -596,6 +637,7 @@ private constructor( environmentId() latestHeartbeatAt() metadata().validate() + secret() startedAt() state().validate() stopRequestedAt() @@ -630,6 +672,7 @@ private constructor( (if (environmentId.asKnown().isPresent) 1 else 0) + (if (latestHeartbeatAt.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (secret.asKnown().isPresent) 1 else 0) + (if (startedAt.asKnown().isPresent) 1 else 0) + (state.asKnown().getOrNull()?.validity() ?: 0) + (if (stopRequestedAt.asKnown().isPresent) 1 else 0) + @@ -913,6 +956,7 @@ private constructor( environmentId == other.environmentId && latestHeartbeatAt == other.latestHeartbeatAt && metadata == other.metadata && + secret == other.secret && startedAt == other.startedAt && state == other.state && stopRequestedAt == other.stopRequestedAt && @@ -930,6 +974,7 @@ private constructor( environmentId, latestHeartbeatAt, metadata, + secret, startedAt, state, stopRequestedAt, @@ -942,5 +987,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "BetaSelfHostedWork{id=$id, acknowledgedAt=$acknowledgedAt, createdAt=$createdAt, data=$data, environmentId=$environmentId, latestHeartbeatAt=$latestHeartbeatAt, metadata=$metadata, startedAt=$startedAt, state=$state, stopRequestedAt=$stopRequestedAt, stoppedAt=$stoppedAt, type=$type, additionalProperties=$additionalProperties}" + "BetaSelfHostedWork{id=$id, acknowledgedAt=$acknowledgedAt, createdAt=$createdAt, data=$data, environmentId=$environmentId, latestHeartbeatAt=$latestHeartbeatAt, metadata=$metadata, secret=$secret, startedAt=$startedAt, state=$state, stopRequestedAt=$stopRequestedAt, stoppedAt=$stoppedAt, type=$type, additionalProperties=$additionalProperties}" } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentMessagePreview.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentMessagePreview.kt new file mode 100644 index 000000000..fa0b77929 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentMessagePreview.kt @@ -0,0 +1,355 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.Enum +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class BetaManagedAgentsAgentMessagePreview +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(id, type, mutableMapOf()) + + /** + * The id the buffered agent.message will carry if it is emitted. Matches the event_id on this + * preview's event_delta events. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 [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 [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 + * [BetaManagedAgentsAgentMessagePreview]. + * + * The following fields are required: + * ```java + * .id() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsAgentMessagePreview]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaManagedAgentsAgentMessagePreview: BetaManagedAgentsAgentMessagePreview + ) = apply { + id = betaManagedAgentsAgentMessagePreview.id + type = betaManagedAgentsAgentMessagePreview.type + additionalProperties = + betaManagedAgentsAgentMessagePreview.additionalProperties.toMutableMap() + } + + /** + * The id the buffered agent.message will carry if it is emitted. Matches the event_id on + * this preview's event_delta events. + */ + 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 } + + 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 [BetaManagedAgentsAgentMessagePreview]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsAgentMessagePreview = + BetaManagedAgentsAgentMessagePreview( + checkRequired("id", id), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsAgentMessagePreview = apply { + if (validated) { + return@apply + } + + id() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + (type.asKnown().getOrNull()?.validity() ?: 0) + + 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 AGENT_MESSAGE = of("agent.message") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + AGENT_MESSAGE + } + + /** + * 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 { + AGENT_MESSAGE, + /** 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) { + AGENT_MESSAGE -> Value.AGENT_MESSAGE + 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 AnthropicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AGENT_MESSAGE -> Known.AGENT_MESSAGE + else -> throw AnthropicInvalidDataException("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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + AnthropicInvalidDataException("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 AnthropicInvalidDataException 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: AnthropicInvalidDataException) { + 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 BetaManagedAgentsAgentMessagePreview && + id == other.id && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsAgentMessagePreview{id=$id, type=$type, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentThinkingPreview.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentThinkingPreview.kt new file mode 100644 index 000000000..fe687221e --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentThinkingPreview.kt @@ -0,0 +1,355 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.Enum +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class BetaManagedAgentsAgentThinkingPreview +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(id, type, mutableMapOf()) + + /** + * The id the buffered agent.thinking will carry if it is emitted. Start-only — no event_delta + * events follow. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 [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 [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 + * [BetaManagedAgentsAgentThinkingPreview]. + * + * The following fields are required: + * ```java + * .id() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsAgentThinkingPreview]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaManagedAgentsAgentThinkingPreview: BetaManagedAgentsAgentThinkingPreview + ) = apply { + id = betaManagedAgentsAgentThinkingPreview.id + type = betaManagedAgentsAgentThinkingPreview.type + additionalProperties = + betaManagedAgentsAgentThinkingPreview.additionalProperties.toMutableMap() + } + + /** + * The id the buffered agent.thinking will carry if it is emitted. Start-only — no + * event_delta events follow. + */ + 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 } + + 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 [BetaManagedAgentsAgentThinkingPreview]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsAgentThinkingPreview = + BetaManagedAgentsAgentThinkingPreview( + checkRequired("id", id), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsAgentThinkingPreview = apply { + if (validated) { + return@apply + } + + id() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + (type.asKnown().getOrNull()?.validity() ?: 0) + + 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 AGENT_THINKING = of("agent.thinking") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + AGENT_THINKING + } + + /** + * 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 { + AGENT_THINKING, + /** 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) { + AGENT_THINKING -> Value.AGENT_THINKING + 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 AnthropicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AGENT_THINKING -> Known.AGENT_THINKING + else -> throw AnthropicInvalidDataException("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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + AnthropicInvalidDataException("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 AnthropicInvalidDataException 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: AnthropicInvalidDataException) { + 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 BetaManagedAgentsAgentThinkingPreview && + id == other.id && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsAgentThinkingPreview{id=$id, type=$type, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentWithOverridesParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentWithOverridesParams.kt new file mode 100644 index 000000000..57d03bb8e --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentWithOverridesParams.kt @@ -0,0 +1,1332 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.BaseDeserializer +import com.anthropic.core.BaseSerializer +import com.anthropic.core.Enum +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.allMaxBy +import com.anthropic.core.checkKnown +import com.anthropic.core.checkRequired +import com.anthropic.core.getOrThrow +import com.anthropic.core.toImmutable +import com.anthropic.errors.AnthropicInvalidDataException +import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset20260401Params +import com.anthropic.models.beta.agents.BetaManagedAgentsAnthropicSkillParams +import com.anthropic.models.beta.agents.BetaManagedAgentsCustomSkillParams +import com.anthropic.models.beta.agents.BetaManagedAgentsCustomToolParams +import com.anthropic.models.beta.agents.BetaManagedAgentsMcpToolsetParams +import com.anthropic.models.beta.agents.BetaManagedAgentsModel +import com.anthropic.models.beta.agents.BetaManagedAgentsModelConfigParams +import com.anthropic.models.beta.agents.BetaManagedAgentsSkillParams +import com.anthropic.models.beta.agents.BetaManagedAgentsUrlMcpServerParams +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.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Reference to an `agent` plus optional configuration overrides. Each provided field replaces the + * agent's value for the caller's use; the agent resource is unchanged. + */ +class BetaManagedAgentsAgentWithOverridesParams +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val type: JsonField, + private val mcpServers: JsonField>, + private val model: JsonField, + private val skills: JsonField>, + private val system: JsonField, + private val tools: JsonField>, + private val version: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("mcp_servers") + @ExcludeMissing + mcpServers: JsonField> = JsonMissing.of(), + @JsonProperty("model") @ExcludeMissing model: JsonField = JsonMissing.of(), + @JsonProperty("skills") + @ExcludeMissing + skills: JsonField> = JsonMissing.of(), + @JsonProperty("system") @ExcludeMissing system: JsonField = JsonMissing.of(), + @JsonProperty("tools") @ExcludeMissing tools: JsonField> = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + ) : this(id, type, mcpServers, model, skills, system, tools, version, mutableMapOf()) + + /** + * The `agent` ID. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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") + + /** + * Replacement MCP server list. Full replacement: the provided array becomes the MCP servers. + * Send an empty array to clear; omit to preserve the agent's servers. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun mcpServers(): Optional> = + mcpServers.getOptional("mcp_servers") + + /** + * Replacement model. Accepts the model string, e.g. `claude-opus-4-6`, or a `model_config` + * object. Omit to use the agent's model. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun model(): Optional = model.getOptional("model") + + /** + * Replacement skill list. Full replacement: the provided array becomes the skills. Send an + * empty array to clear; omit to preserve the agent's skills. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun skills(): Optional> = skills.getOptional("skills") + + /** + * Replacement system prompt. Up to 100,000 characters. Set to null to clear the agent's system + * prompt; omit to preserve it. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun system(): Optional = system.getOptional("system") + + /** + * Replacement tool list. Full replacement: the provided array becomes the tool configuration. + * Send an empty array to clear; omit to preserve the agent's tools. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tools(): Optional> = tools.getOptional("tools") + + /** + * The specific `agent` version to use. Omit to use the latest version. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun version(): Optional = version.getOptional("version") + + /** + * 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 [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [mcpServers]. + * + * Unlike [mcpServers], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcp_servers") + @ExcludeMissing + fun _mcpServers(): JsonField> = mcpServers + + /** + * Returns the raw JSON value of [model]. + * + * Unlike [model], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model + + /** + * Returns the raw JSON value of [skills]. + * + * Unlike [skills], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("skills") + @ExcludeMissing + fun _skills(): JsonField> = skills + + /** + * Returns the raw JSON value of [system]. + * + * Unlike [system], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("system") @ExcludeMissing fun _system(): JsonField = system + + /** + * Returns the raw JSON value of [tools]. + * + * Unlike [tools], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tools") @ExcludeMissing fun _tools(): JsonField> = tools + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + @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 + * [BetaManagedAgentsAgentWithOverridesParams]. + * + * The following fields are required: + * ```java + * .id() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsAgentWithOverridesParams]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var type: JsonField? = null + private var mcpServers: JsonField>? = null + private var model: JsonField = JsonMissing.of() + private var skills: JsonField>? = null + private var system: JsonField = JsonMissing.of() + private var tools: JsonField>? = null + private var version: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaManagedAgentsAgentWithOverridesParams: BetaManagedAgentsAgentWithOverridesParams + ) = apply { + id = betaManagedAgentsAgentWithOverridesParams.id + type = betaManagedAgentsAgentWithOverridesParams.type + mcpServers = + betaManagedAgentsAgentWithOverridesParams.mcpServers + .map { it.toMutableList() } + .takeUnless { it.isMissing() } + model = betaManagedAgentsAgentWithOverridesParams.model + skills = + betaManagedAgentsAgentWithOverridesParams.skills + .map { it.toMutableList() } + .takeUnless { it.isMissing() } + system = betaManagedAgentsAgentWithOverridesParams.system + tools = + betaManagedAgentsAgentWithOverridesParams.tools + .map { it.toMutableList() } + .takeUnless { it.isMissing() } + version = betaManagedAgentsAgentWithOverridesParams.version + additionalProperties = + betaManagedAgentsAgentWithOverridesParams.additionalProperties.toMutableMap() + } + + /** The `agent` 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 } + + 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 } + + /** + * Replacement MCP server list. Full replacement: the provided array becomes the MCP + * servers. Send an empty array to clear; omit to preserve the agent's servers. + */ + fun mcpServers(mcpServers: List) = + mcpServers(JsonField.of(mcpServers)) + + /** + * Sets [Builder.mcpServers] to an arbitrary JSON value. + * + * You should usually call [Builder.mcpServers] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun mcpServers(mcpServers: JsonField>) = apply { + this.mcpServers = mcpServers.map { it.toMutableList() } + } + + /** + * Adds a single [BetaManagedAgentsUrlMcpServerParams] to [mcpServers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMcpServer(mcpServer: BetaManagedAgentsUrlMcpServerParams) = apply { + mcpServers = + (mcpServers ?: JsonField.of(mutableListOf())).also { + checkKnown("mcpServers", it).add(mcpServer) + } + } + + /** + * Replacement model. Accepts the model string, e.g. `claude-opus-4-6`, or a `model_config` + * object. Omit to use the agent's model. + */ + fun model(model: Model) = model(JsonField.of(model)) + + /** + * Sets [Builder.model] to an arbitrary JSON value. + * + * You should usually call [Builder.model] with a well-typed [Model] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun model(model: JsonField) = apply { this.model = model } + + /** Alias for calling [model] with `Model.ofBetaManagedAgents(betaManagedAgents)`. */ + fun model(betaManagedAgents: BetaManagedAgentsModel) = + model(Model.ofBetaManagedAgents(betaManagedAgents)) + + /** + * Alias for calling [model] with + * `Model.ofBetaManagedAgentsModelConfigParams(betaManagedAgentsModelConfigParams)`. + */ + fun model(betaManagedAgentsModelConfigParams: BetaManagedAgentsModelConfigParams) = + model(Model.ofBetaManagedAgentsModelConfigParams(betaManagedAgentsModelConfigParams)) + + /** + * Replacement skill list. Full replacement: the provided array becomes the skills. Send an + * empty array to clear; omit to preserve the agent's skills. + */ + fun skills(skills: List) = skills(JsonField.of(skills)) + + /** + * Sets [Builder.skills] to an arbitrary JSON value. + * + * You should usually call [Builder.skills] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun skills(skills: JsonField>) = apply { + this.skills = skills.map { it.toMutableList() } + } + + /** + * Adds a single [BetaManagedAgentsSkillParams] to [skills]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSkill(skill: BetaManagedAgentsSkillParams) = apply { + skills = + (skills ?: JsonField.of(mutableListOf())).also { + checkKnown("skills", it).add(skill) + } + } + + /** + * Alias for calling [addSkill] with `BetaManagedAgentsSkillParams.ofAnthropic(anthropic)`. + */ + fun addSkill(anthropic: BetaManagedAgentsAnthropicSkillParams) = + addSkill(BetaManagedAgentsSkillParams.ofAnthropic(anthropic)) + + /** + * Alias for calling [addSkill] with the following: + * ```java + * BetaManagedAgentsAnthropicSkillParams.builder() + * .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + * .skillId(skillId) + * .build() + * ``` + */ + fun addAnthropicSkill(skillId: String) = + addSkill( + BetaManagedAgentsAnthropicSkillParams.builder() + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .skillId(skillId) + .build() + ) + + /** Alias for calling [addSkill] with `BetaManagedAgentsSkillParams.ofCustom(custom)`. */ + fun addSkill(custom: BetaManagedAgentsCustomSkillParams) = + addSkill(BetaManagedAgentsSkillParams.ofCustom(custom)) + + /** + * Alias for calling [addSkill] with the following: + * ```java + * BetaManagedAgentsCustomSkillParams.builder() + * .type(BetaManagedAgentsCustomSkillParams.Type.CUSTOM) + * .skillId(skillId) + * .build() + * ``` + */ + fun addCustomSkill(skillId: String) = + addSkill( + BetaManagedAgentsCustomSkillParams.builder() + .type(BetaManagedAgentsCustomSkillParams.Type.CUSTOM) + .skillId(skillId) + .build() + ) + + /** + * Replacement system prompt. Up to 100,000 characters. Set to null to clear the agent's + * system prompt; omit to preserve it. + */ + fun system(system: String?) = system(JsonField.ofNullable(system)) + + /** Alias for calling [Builder.system] with `system.orElse(null)`. */ + fun system(system: Optional) = system(system.getOrNull()) + + /** + * Sets [Builder.system] to an arbitrary JSON value. + * + * You should usually call [Builder.system] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun system(system: JsonField) = apply { this.system = system } + + /** + * Replacement tool list. Full replacement: the provided array becomes the tool + * configuration. Send an empty array to clear; omit to preserve the agent's tools. + */ + fun tools(tools: List) = tools(JsonField.of(tools)) + + /** + * Sets [Builder.tools] to an arbitrary JSON value. + * + * You should usually call [Builder.tools] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tools(tools: JsonField>) = apply { + this.tools = tools.map { it.toMutableList() } + } + + /** + * Adds a single [Tool] to [tools]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTool(tool: Tool) = apply { + tools = + (tools ?: JsonField.of(mutableListOf())).also { checkKnown("tools", it).add(tool) } + } + + /** Alias for calling [addTool] with `Tool.ofAgentToolset20260401(agentToolset20260401)`. */ + fun addTool(agentToolset20260401: BetaManagedAgentsAgentToolset20260401Params) = + addTool(Tool.ofAgentToolset20260401(agentToolset20260401)) + + /** Alias for calling [addTool] with `Tool.ofMcpToolset(mcpToolset)`. */ + fun addTool(mcpToolset: BetaManagedAgentsMcpToolsetParams) = + addTool(Tool.ofMcpToolset(mcpToolset)) + + /** + * Alias for calling [addTool] with the following: + * ```java + * BetaManagedAgentsMcpToolsetParams.builder() + * .type(BetaManagedAgentsMcpToolsetParams.Type.MCP_TOOLSET) + * .mcpServerName(mcpServerName) + * .build() + * ``` + */ + fun addMcpToolsetTool(mcpServerName: String) = + addTool( + BetaManagedAgentsMcpToolsetParams.builder() + .type(BetaManagedAgentsMcpToolsetParams.Type.MCP_TOOLSET) + .mcpServerName(mcpServerName) + .build() + ) + + /** Alias for calling [addTool] with `Tool.ofCustom(custom)`. */ + fun addTool(custom: BetaManagedAgentsCustomToolParams) = addTool(Tool.ofCustom(custom)) + + /** The specific `agent` version to use. Omit to use the latest version. */ + fun version(version: Int) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [Int] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + 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 [BetaManagedAgentsAgentWithOverridesParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsAgentWithOverridesParams = + BetaManagedAgentsAgentWithOverridesParams( + checkRequired("id", id), + checkRequired("type", type), + (mcpServers ?: JsonMissing.of()).map { it.toImmutable() }, + model, + (skills ?: JsonMissing.of()).map { it.toImmutable() }, + system, + (tools ?: JsonMissing.of()).map { it.toImmutable() }, + version, + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsAgentWithOverridesParams = apply { + if (validated) { + return@apply + } + + id() + type().validate() + mcpServers().ifPresent { it.forEach { it.validate() } } + model().ifPresent { it.validate() } + skills().ifPresent { it.forEach { it.validate() } } + system() + tools().ifPresent { it.forEach { it.validate() } } + version() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (mcpServers.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (model.asKnown().getOrNull()?.validity() ?: 0) + + (skills.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (system.asKnown().isPresent) 1 else 0) + + (tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (version.asKnown().isPresent) 1 else 0) + + 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 AGENT_WITH_OVERRIDES = of("agent_with_overrides") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + AGENT_WITH_OVERRIDES + } + + /** + * 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 { + AGENT_WITH_OVERRIDES, + /** 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) { + AGENT_WITH_OVERRIDES -> Value.AGENT_WITH_OVERRIDES + 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 AnthropicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AGENT_WITH_OVERRIDES -> Known.AGENT_WITH_OVERRIDES + else -> throw AnthropicInvalidDataException("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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + AnthropicInvalidDataException("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 AnthropicInvalidDataException 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: AnthropicInvalidDataException) { + 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() + } + + /** + * Replacement model. Accepts the model string, e.g. `claude-opus-4-6`, or a `model_config` + * object. Omit to use the agent's model. + */ + @JsonDeserialize(using = Model.Deserializer::class) + @JsonSerialize(using = Model.Serializer::class) + class Model + private constructor( + private val betaManagedAgents: BetaManagedAgentsModel? = null, + private val betaManagedAgentsModelConfigParams: BetaManagedAgentsModelConfigParams? = null, + private val _json: JsonValue? = null, + ) { + + /** + * The model that will power your agent. + * + * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details + * and options. + */ + fun betaManagedAgents(): Optional = + Optional.ofNullable(betaManagedAgents) + + /** An object that defines additional configuration control over model use */ + fun betaManagedAgentsModelConfigParams(): Optional = + Optional.ofNullable(betaManagedAgentsModelConfigParams) + + fun isBetaManagedAgents(): Boolean = betaManagedAgents != null + + fun isBetaManagedAgentsModelConfigParams(): Boolean = + betaManagedAgentsModelConfigParams != null + + /** + * The model that will power your agent. + * + * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details + * and options. + */ + fun asBetaManagedAgents(): BetaManagedAgentsModel = + betaManagedAgents.getOrThrow("betaManagedAgents") + + /** An object that defines additional configuration control over model use */ + fun asBetaManagedAgentsModelConfigParams(): BetaManagedAgentsModelConfigParams = + betaManagedAgentsModelConfigParams.getOrThrow("betaManagedAgentsModelConfigParams") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.anthropic.core.JsonValue; + * import java.util.Optional; + * + * Optional result = model.accept(new Model.Visitor>() { + * @Override + * public Optional visitBetaManagedAgents(BetaManagedAgentsModel betaManagedAgents) { + * return Optional.of(betaManagedAgents.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + betaManagedAgents != null -> visitor.visitBetaManagedAgents(betaManagedAgents) + betaManagedAgentsModelConfigParams != null -> + visitor.visitBetaManagedAgentsModelConfigParams( + betaManagedAgentsModelConfigParams + ) + else -> visitor.unknown(_json) + } + + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Model = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitBetaManagedAgents( + betaManagedAgents: BetaManagedAgentsModel + ) {} + + override fun visitBetaManagedAgentsModelConfigParams( + betaManagedAgentsModelConfigParams: BetaManagedAgentsModelConfigParams + ) { + betaManagedAgentsModelConfigParams.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 = + accept( + object : Visitor { + override fun visitBetaManagedAgents(betaManagedAgents: BetaManagedAgentsModel) = + 1 + + override fun visitBetaManagedAgentsModelConfigParams( + betaManagedAgentsModelConfigParams: BetaManagedAgentsModelConfigParams + ) = betaManagedAgentsModelConfigParams.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Model && + betaManagedAgents == other.betaManagedAgents && + betaManagedAgentsModelConfigParams == other.betaManagedAgentsModelConfigParams + } + + override fun hashCode(): Int = + Objects.hash(betaManagedAgents, betaManagedAgentsModelConfigParams) + + override fun toString(): String = + when { + betaManagedAgents != null -> "Model{betaManagedAgents=$betaManagedAgents}" + betaManagedAgentsModelConfigParams != null -> + "Model{betaManagedAgentsModelConfigParams=$betaManagedAgentsModelConfigParams}" + _json != null -> "Model{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Model") + } + + companion object { + + /** + * The model that will power your agent. + * + * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional + * details and options. + */ + @JvmStatic + fun ofBetaManagedAgents(betaManagedAgents: BetaManagedAgentsModel) = + Model(betaManagedAgents = betaManagedAgents) + + /** An object that defines additional configuration control over model use */ + @JvmStatic + fun ofBetaManagedAgentsModelConfigParams( + betaManagedAgentsModelConfigParams: BetaManagedAgentsModelConfigParams + ) = Model(betaManagedAgentsModelConfigParams = betaManagedAgentsModelConfigParams) + } + + /** An interface that defines how to map each variant of [Model] to a value of type [T]. */ + interface Visitor { + + /** + * The model that will power your agent. + * + * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional + * details and options. + */ + fun visitBetaManagedAgents(betaManagedAgents: BetaManagedAgentsModel): T + + /** An object that defines additional configuration control over model use */ + fun visitBetaManagedAgentsModelConfigParams( + betaManagedAgentsModelConfigParams: BetaManagedAgentsModelConfigParams + ): T + + /** + * Maps an unknown variant of [Model] to a value of type [T]. + * + * An instance of [Model] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws AnthropicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw AnthropicInvalidDataException("Unknown Model: $json") + } + } + + internal class Deserializer : BaseDeserializer(Model::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Model { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Model(betaManagedAgents = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Model(betaManagedAgentsModelConfigParams = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> Model(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Model::class) { + + override fun serialize( + value: Model, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.betaManagedAgents != null -> + generator.writeObject(value.betaManagedAgents) + value.betaManagedAgentsModelConfigParams != null -> + generator.writeObject(value.betaManagedAgentsModelConfigParams) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Model") + } + } + } + } + + /** Union type for tool configurations in the tools array. */ + @JsonDeserialize(using = Tool.Deserializer::class) + @JsonSerialize(using = Tool.Serializer::class) + class Tool + private constructor( + private val agentToolset20260401: BetaManagedAgentsAgentToolset20260401Params? = null, + private val mcpToolset: BetaManagedAgentsMcpToolsetParams? = null, + private val custom: BetaManagedAgentsCustomToolParams? = null, + private val _json: JsonValue? = null, + ) { + + /** + * Configuration for built-in agent tools. Use this to enable or disable groups of tools + * available to the agent. + */ + fun agentToolset20260401(): Optional = + Optional.ofNullable(agentToolset20260401) + + /** Configuration for tools from an MCP server defined in `mcp_servers`. */ + fun mcpToolset(): Optional = + Optional.ofNullable(mcpToolset) + + /** + * A custom tool that is executed by the API client rather than the agent. When the agent + * calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, + * waiting for the client to provide the result via a `user.custom_tool_result` event. + */ + fun custom(): Optional = Optional.ofNullable(custom) + + fun isAgentToolset20260401(): Boolean = agentToolset20260401 != null + + fun isMcpToolset(): Boolean = mcpToolset != null + + fun isCustom(): Boolean = custom != null + + /** + * Configuration for built-in agent tools. Use this to enable or disable groups of tools + * available to the agent. + */ + fun asAgentToolset20260401(): BetaManagedAgentsAgentToolset20260401Params = + agentToolset20260401.getOrThrow("agentToolset20260401") + + /** Configuration for tools from an MCP server defined in `mcp_servers`. */ + fun asMcpToolset(): BetaManagedAgentsMcpToolsetParams = mcpToolset.getOrThrow("mcpToolset") + + /** + * A custom tool that is executed by the API client rather than the agent. When the agent + * calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, + * waiting for the client to provide the result via a `user.custom_tool_result` event. + */ + fun asCustom(): BetaManagedAgentsCustomToolParams = custom.getOrThrow("custom") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.anthropic.core.JsonValue; + * import java.util.Optional; + * + * Optional result = tool.accept(new Tool.Visitor>() { + * @Override + * public Optional visitAgentToolset20260401(BetaManagedAgentsAgentToolset20260401Params agentToolset20260401) { + * return Optional.of(agentToolset20260401.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + agentToolset20260401 != null -> + visitor.visitAgentToolset20260401(agentToolset20260401) + mcpToolset != null -> visitor.visitMcpToolset(mcpToolset) + custom != null -> visitor.visitCustom(custom) + else -> visitor.unknown(_json) + } + + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Tool = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitAgentToolset20260401( + agentToolset20260401: BetaManagedAgentsAgentToolset20260401Params + ) { + agentToolset20260401.validate() + } + + override fun visitMcpToolset(mcpToolset: BetaManagedAgentsMcpToolsetParams) { + mcpToolset.validate() + } + + override fun visitCustom(custom: BetaManagedAgentsCustomToolParams) { + custom.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 = + accept( + object : Visitor { + override fun visitAgentToolset20260401( + agentToolset20260401: BetaManagedAgentsAgentToolset20260401Params + ) = agentToolset20260401.validity() + + override fun visitMcpToolset(mcpToolset: BetaManagedAgentsMcpToolsetParams) = + mcpToolset.validity() + + override fun visitCustom(custom: BetaManagedAgentsCustomToolParams) = + custom.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tool && + agentToolset20260401 == other.agentToolset20260401 && + mcpToolset == other.mcpToolset && + custom == other.custom + } + + override fun hashCode(): Int = Objects.hash(agentToolset20260401, mcpToolset, custom) + + override fun toString(): String = + when { + agentToolset20260401 != null -> "Tool{agentToolset20260401=$agentToolset20260401}" + mcpToolset != null -> "Tool{mcpToolset=$mcpToolset}" + custom != null -> "Tool{custom=$custom}" + _json != null -> "Tool{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Tool") + } + + companion object { + + /** + * Configuration for built-in agent tools. Use this to enable or disable groups of tools + * available to the agent. + */ + @JvmStatic + fun ofAgentToolset20260401( + agentToolset20260401: BetaManagedAgentsAgentToolset20260401Params + ) = Tool(agentToolset20260401 = agentToolset20260401) + + /** Configuration for tools from an MCP server defined in `mcp_servers`. */ + @JvmStatic + fun ofMcpToolset(mcpToolset: BetaManagedAgentsMcpToolsetParams) = + Tool(mcpToolset = mcpToolset) + + /** + * A custom tool that is executed by the API client rather than the agent. When the + * agent calls this tool, an `agent.custom_tool_use` event is emitted and the session + * goes idle, waiting for the client to provide the result via a + * `user.custom_tool_result` event. + */ + @JvmStatic + fun ofCustom(custom: BetaManagedAgentsCustomToolParams) = Tool(custom = custom) + } + + /** An interface that defines how to map each variant of [Tool] to a value of type [T]. */ + interface Visitor { + + /** + * Configuration for built-in agent tools. Use this to enable or disable groups of tools + * available to the agent. + */ + fun visitAgentToolset20260401( + agentToolset20260401: BetaManagedAgentsAgentToolset20260401Params + ): T + + /** Configuration for tools from an MCP server defined in `mcp_servers`. */ + fun visitMcpToolset(mcpToolset: BetaManagedAgentsMcpToolsetParams): T + + /** + * A custom tool that is executed by the API client rather than the agent. When the + * agent calls this tool, an `agent.custom_tool_use` event is emitted and the session + * goes idle, waiting for the client to provide the result via a + * `user.custom_tool_result` event. + */ + fun visitCustom(custom: BetaManagedAgentsCustomToolParams): T + + /** + * Maps an unknown variant of [Tool] to a value of type [T]. + * + * An instance of [Tool] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws AnthropicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw AnthropicInvalidDataException("Unknown Tool: $json") + } + } + + internal class Deserializer : BaseDeserializer(Tool::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Tool { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "agent_toolset_20260401" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Tool(agentToolset20260401 = it, _json = json) } + ?: Tool(_json = json) + } + "mcp_toolset" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Tool(mcpToolset = it, _json = json) } ?: Tool(_json = json) + } + "custom" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Tool(custom = it, _json = json) } ?: Tool(_json = json) + } + } + + return Tool(_json = json) + } + } + + internal class Serializer : BaseSerializer(Tool::class) { + + override fun serialize( + value: Tool, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.agentToolset20260401 != null -> + generator.writeObject(value.agentToolset20260401) + value.mcpToolset != null -> generator.writeObject(value.mcpToolset) + value.custom != null -> generator.writeObject(value.custom) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Tool") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaManagedAgentsAgentWithOverridesParams && + id == other.id && + type == other.type && + mcpServers == other.mcpServers && + model == other.model && + skills == other.skills && + system == other.system && + tools == other.tools && + version == other.version && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + type, + mcpServers, + model, + skills, + system, + tools, + version, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsAgentWithOverridesParams{id=$id, type=$type, mcpServers=$mcpServers, model=$model, skills=$skills, system=$system, tools=$tools, version=$version, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaContent.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaContent.kt new file mode 100644 index 000000000..bdf8f132d --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaContent.kt @@ -0,0 +1,396 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.Enum +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock +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 java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class BetaManagedAgentsDeltaContent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val content: JsonField, + private val type: JsonField, + private val index: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("content") + @ExcludeMissing + content: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("index") @ExcludeMissing index: JsonField = JsonMissing.of(), + ) : this(content, type, index, mutableMapOf()) + + /** + * Regular text content. + * + * @throws AnthropicInvalidDataException 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 content(): BetaManagedAgentsTextBlock = content.getRequired("content") + + /** + * @throws AnthropicInvalidDataException 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") + + /** + * Which entry in the previewed event's content array this fragment lands in. Insert content as + * that entry when the index is new; append to the existing entry otherwise. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun index(): Optional = index.getOptional("index") + + /** + * Returns the raw JSON value of [content]. + * + * Unlike [content], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("content") + @ExcludeMissing + fun _content(): JsonField = content + + /** + * 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 + + /** + * Returns the raw JSON value of [index]. + * + * Unlike [index], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("index") @ExcludeMissing fun _index(): JsonField = index + + @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 + * [BetaManagedAgentsDeltaContent]. + * + * The following fields are required: + * ```java + * .content() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsDeltaContent]. */ + class Builder internal constructor() { + + private var content: JsonField? = null + private var type: JsonField? = null + private var index: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaManagedAgentsDeltaContent: BetaManagedAgentsDeltaContent) = apply { + content = betaManagedAgentsDeltaContent.content + type = betaManagedAgentsDeltaContent.type + index = betaManagedAgentsDeltaContent.index + additionalProperties = betaManagedAgentsDeltaContent.additionalProperties.toMutableMap() + } + + /** Regular text content. */ + fun content(content: BetaManagedAgentsTextBlock) = content(JsonField.of(content)) + + /** + * Sets [Builder.content] to an arbitrary JSON value. + * + * You should usually call [Builder.content] with a well-typed [BetaManagedAgentsTextBlock] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun content(content: JsonField) = apply { + this.content = content + } + + 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 } + + /** + * Which entry in the previewed event's content array this fragment lands in. Insert content + * as that entry when the index is new; append to the existing entry otherwise. + */ + fun index(index: Long) = index(JsonField.of(index)) + + /** + * Sets [Builder.index] to an arbitrary JSON value. + * + * You should usually call [Builder.index] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun index(index: JsonField) = apply { this.index = index } + + 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 [BetaManagedAgentsDeltaContent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .content() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsDeltaContent = + BetaManagedAgentsDeltaContent( + checkRequired("content", content), + checkRequired("type", type), + index, + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsDeltaContent = apply { + if (validated) { + return@apply + } + + content().validate() + type().validate() + index() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 = + (content.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (index.asKnown().isPresent) 1 else 0) + + 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 CONTENT_DELTA = of("content_delta") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CONTENT_DELTA + } + + /** + * 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 { + CONTENT_DELTA, + /** 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) { + CONTENT_DELTA -> Value.CONTENT_DELTA + 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 AnthropicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + CONTENT_DELTA -> Known.CONTENT_DELTA + else -> throw AnthropicInvalidDataException("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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + AnthropicInvalidDataException("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 AnthropicInvalidDataException 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: AnthropicInvalidDataException) { + 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 BetaManagedAgentsDeltaContent && + content == other.content && + type == other.type && + index == other.index && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(content, type, index, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsDeltaContent{content=$content, type=$type, index=$index, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaEvent.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaEvent.kt new file mode 100644 index 000000000..21ac94c52 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaEvent.kt @@ -0,0 +1,424 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.Enum +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock +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 java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** + * An incremental update to an event that is still being streamed. Deltas are best-effort and may + * stop early; when the buffered event with id == event_id is produced it carries the complete + * content. A model request that ends early (an error or interrupt) produces no buffered event — its + * terminal span.model_request_end closes the preview. Only sent on stream connections that opt in + * via event_deltas; never appears in event history. + */ +class BetaManagedAgentsDeltaEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val delta: JsonField, + private val eventId: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("delta") + @ExcludeMissing + delta: JsonField = JsonMissing.of(), + @JsonProperty("event_id") @ExcludeMissing eventId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(delta, eventId, type, mutableMapOf()) + + /** + * One fragment of the previewed event. The delta type is named for the previewed event's field + * it streams into: agent.message events stream content_delta fragments, each a partial element + * of the content array. + * + * @throws AnthropicInvalidDataException 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 delta(): BetaManagedAgentsDeltaContent = delta.getRequired("delta") + + /** + * The id of the event being previewed. Matches event.id on the corresponding event_start and + * the buffered event that reconciles the preview. + * + * @throws AnthropicInvalidDataException 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 eventId(): String = eventId.getRequired("event_id") + + /** + * @throws AnthropicInvalidDataException 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 [delta]. + * + * Unlike [delta], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("delta") + @ExcludeMissing + fun _delta(): JsonField = delta + + /** + * Returns the raw JSON value of [eventId]. + * + * Unlike [eventId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_id") @ExcludeMissing fun _eventId(): JsonField = eventId + + /** + * 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 [BetaManagedAgentsDeltaEvent]. + * + * The following fields are required: + * ```java + * .delta() + * .eventId() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsDeltaEvent]. */ + class Builder internal constructor() { + + private var delta: JsonField? = null + private var eventId: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaManagedAgentsDeltaEvent: BetaManagedAgentsDeltaEvent) = apply { + delta = betaManagedAgentsDeltaEvent.delta + eventId = betaManagedAgentsDeltaEvent.eventId + type = betaManagedAgentsDeltaEvent.type + additionalProperties = betaManagedAgentsDeltaEvent.additionalProperties.toMutableMap() + } + + /** + * One fragment of the previewed event. The delta type is named for the previewed event's + * field it streams into: agent.message events stream content_delta fragments, each a + * partial element of the content array. + */ + fun delta(delta: BetaManagedAgentsDeltaContent) = delta(JsonField.of(delta)) + + /** + * Sets [Builder.delta] to an arbitrary JSON value. + * + * You should usually call [Builder.delta] with a well-typed [BetaManagedAgentsDeltaContent] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun delta(delta: JsonField) = apply { this.delta = delta } + + /** + * Alias for calling [delta] with the following: + * ```java + * BetaManagedAgentsDeltaContent.builder() + * .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + * .content(content) + * .build() + * ``` + */ + fun contentDeltaDelta(content: BetaManagedAgentsTextBlock) = + delta( + BetaManagedAgentsDeltaContent.builder() + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .content(content) + .build() + ) + + /** + * The id of the event being previewed. Matches event.id on the corresponding event_start + * and the buffered event that reconciles the preview. + */ + fun eventId(eventId: String) = eventId(JsonField.of(eventId)) + + /** + * Sets [Builder.eventId] to an arbitrary JSON value. + * + * You should usually call [Builder.eventId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun eventId(eventId: JsonField) = apply { this.eventId = eventId } + + 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 [BetaManagedAgentsDeltaEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .delta() + * .eventId() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsDeltaEvent = + BetaManagedAgentsDeltaEvent( + checkRequired("delta", delta), + checkRequired("eventId", eventId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsDeltaEvent = apply { + if (validated) { + return@apply + } + + delta().validate() + eventId() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 = + (delta.asKnown().getOrNull()?.validity() ?: 0) + + (if (eventId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + 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 EVENT_DELTA = of("event_delta") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EVENT_DELTA + } + + /** + * 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 { + EVENT_DELTA, + /** 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) { + EVENT_DELTA -> Value.EVENT_DELTA + 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 AnthropicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EVENT_DELTA -> Known.EVENT_DELTA + else -> throw AnthropicInvalidDataException("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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + AnthropicInvalidDataException("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 AnthropicInvalidDataException 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: AnthropicInvalidDataException) { + 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 BetaManagedAgentsDeltaEvent && + delta == other.delta && + eventId == other.eventId && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(delta, eventId, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsDeltaEvent{delta=$delta, eventId=$eventId, type=$type, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaType.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaType.kt new file mode 100644 index 000000000..c4a8f97be --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaType.kt @@ -0,0 +1,147 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.Enum +import com.anthropic.core.JsonField +import com.anthropic.errors.AnthropicInvalidDataException +import com.fasterxml.jackson.annotation.JsonCreator + +/** EventDeltaType enum */ +class BetaManagedAgentsDeltaType +@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 AGENT_MESSAGE = of("agent.message") + + @JvmField val AGENT_THINKING = of("agent.thinking") + + @JvmStatic fun of(value: String) = BetaManagedAgentsDeltaType(JsonField.of(value)) + } + + /** An enum containing [BetaManagedAgentsDeltaType]'s known values. */ + enum class Known { + AGENT_MESSAGE, + AGENT_THINKING, + } + + /** + * An enum containing [BetaManagedAgentsDeltaType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [BetaManagedAgentsDeltaType] 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 { + AGENT_MESSAGE, + AGENT_THINKING, + /** + * An enum member indicating that [BetaManagedAgentsDeltaType] 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) { + AGENT_MESSAGE -> Value.AGENT_MESSAGE + AGENT_THINKING -> Value.AGENT_THINKING + 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 AnthropicInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + AGENT_MESSAGE -> Known.AGENT_MESSAGE + AGENT_THINKING -> Known.AGENT_THINKING + else -> + throw AnthropicInvalidDataException("Unknown BetaManagedAgentsDeltaType: $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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { AnthropicInvalidDataException("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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsDeltaType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 BetaManagedAgentsDeltaType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEvent.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEvent.kt new file mode 100644 index 000000000..2704f9cac --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEvent.kt @@ -0,0 +1,418 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.Enum +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed by + * zero or more event_delta events with the same event id, normally concluded by the buffered event + * carrying that id. If the producing model request ends without that event (an error or interrupt + * mid-stream), its terminal span.model_request_end closes the preview. Only sent on stream + * connections that opt in via event_deltas; never appears in event history. + */ +class BetaManagedAgentsStartEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val event: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("event") + @ExcludeMissing + event: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(event, type, mutableMapOf()) + + /** + * The previewed event's type and id. The event type determines which delta types the preview's + * event_delta events carry: agent.message events stream content_delta fragments; agent.thinking + * previews are start-only — no deltas follow, and the buffered agent.thinking with the same id + * concludes them. + * + * @throws AnthropicInvalidDataException 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 event(): BetaManagedAgentsStartEventPreview = event.getRequired("event") + + /** + * @throws AnthropicInvalidDataException 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 [event]. + * + * Unlike [event], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event") + @ExcludeMissing + fun _event(): JsonField = event + + /** + * 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 [BetaManagedAgentsStartEvent]. + * + * The following fields are required: + * ```java + * .event() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsStartEvent]. */ + class Builder internal constructor() { + + private var event: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaManagedAgentsStartEvent: BetaManagedAgentsStartEvent) = apply { + event = betaManagedAgentsStartEvent.event + type = betaManagedAgentsStartEvent.type + additionalProperties = betaManagedAgentsStartEvent.additionalProperties.toMutableMap() + } + + /** + * The previewed event's type and id. The event type determines which delta types the + * preview's event_delta events carry: agent.message events stream content_delta fragments; + * agent.thinking previews are start-only — no deltas follow, and the buffered + * agent.thinking with the same id concludes them. + */ + fun event(event: BetaManagedAgentsStartEventPreview) = event(JsonField.of(event)) + + /** + * Sets [Builder.event] to an arbitrary JSON value. + * + * You should usually call [Builder.event] with a well-typed + * [BetaManagedAgentsStartEventPreview] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun event(event: JsonField) = apply { + this.event = event + } + + /** + * Alias for calling [event] with + * `BetaManagedAgentsStartEventPreview.ofAgentMessage(agentMessage)`. + */ + fun event(agentMessage: BetaManagedAgentsAgentMessagePreview) = + event(BetaManagedAgentsStartEventPreview.ofAgentMessage(agentMessage)) + + /** + * Alias for calling [event] with the following: + * ```java + * BetaManagedAgentsAgentMessagePreview.builder() + * .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + * .id(id) + * .build() + * ``` + */ + fun agentMessageEvent(id: String) = + event( + BetaManagedAgentsAgentMessagePreview.builder() + .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + .id(id) + .build() + ) + + /** + * Alias for calling [event] with + * `BetaManagedAgentsStartEventPreview.ofAgentThinking(agentThinking)`. + */ + fun event(agentThinking: BetaManagedAgentsAgentThinkingPreview) = + event(BetaManagedAgentsStartEventPreview.ofAgentThinking(agentThinking)) + + /** + * Alias for calling [event] with the following: + * ```java + * BetaManagedAgentsAgentThinkingPreview.builder() + * .type(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + * .id(id) + * .build() + * ``` + */ + fun agentThinkingEvent(id: String) = + event( + BetaManagedAgentsAgentThinkingPreview.builder() + .type(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + .id(id) + .build() + ) + + 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 [BetaManagedAgentsStartEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .event() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsStartEvent = + BetaManagedAgentsStartEvent( + checkRequired("event", event), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsStartEvent = apply { + if (validated) { + return@apply + } + + event().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 = + (event.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + 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 EVENT_START = of("event_start") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EVENT_START + } + + /** + * 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 { + EVENT_START, + /** 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) { + EVENT_START -> Value.EVENT_START + 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 AnthropicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EVENT_START -> Known.EVENT_START + else -> throw AnthropicInvalidDataException("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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + AnthropicInvalidDataException("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 AnthropicInvalidDataException 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: AnthropicInvalidDataException) { + 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 BetaManagedAgentsStartEvent && + event == other.event && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(event, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsStartEvent{event=$event, type=$type, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventPreview.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventPreview.kt new file mode 100644 index 000000000..2349d5cc5 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventPreview.kt @@ -0,0 +1,252 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.BaseDeserializer +import com.anthropic.core.BaseSerializer +import com.anthropic.core.JsonValue +import com.anthropic.core.getOrThrow +import com.anthropic.errors.AnthropicInvalidDataException +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +@JsonDeserialize(using = BetaManagedAgentsStartEventPreview.Deserializer::class) +@JsonSerialize(using = BetaManagedAgentsStartEventPreview.Serializer::class) +class BetaManagedAgentsStartEventPreview +private constructor( + private val agentMessage: BetaManagedAgentsAgentMessagePreview? = null, + private val agentThinking: BetaManagedAgentsAgentThinkingPreview? = null, + private val _json: JsonValue? = null, +) { + + fun agentMessage(): Optional = + Optional.ofNullable(agentMessage) + + fun agentThinking(): Optional = + Optional.ofNullable(agentThinking) + + fun isAgentMessage(): Boolean = agentMessage != null + + fun isAgentThinking(): Boolean = agentThinking != null + + fun asAgentMessage(): BetaManagedAgentsAgentMessagePreview = + agentMessage.getOrThrow("agentMessage") + + fun asAgentThinking(): BetaManagedAgentsAgentThinkingPreview = + agentThinking.getOrThrow("agentThinking") + + fun _json(): Optional = Optional.ofNullable(_json) + + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import com.anthropic.core.JsonValue; + * import java.util.Optional; + * + * Optional result = betaManagedAgentsStartEventPreview.accept(new BetaManagedAgentsStartEventPreview.Visitor>() { + * @Override + * public Optional visitAgentMessage(BetaManagedAgentsAgentMessagePreview agentMessage) { + * return Optional.of(agentMessage.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ + fun accept(visitor: Visitor): T = + when { + agentMessage != null -> visitor.visitAgentMessage(agentMessage) + agentThinking != null -> visitor.visitAgentThinking(agentThinking) + else -> visitor.unknown(_json) + } + + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsStartEventPreview = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitAgentMessage(agentMessage: BetaManagedAgentsAgentMessagePreview) { + agentMessage.validate() + } + + override fun visitAgentThinking( + agentThinking: BetaManagedAgentsAgentThinkingPreview + ) { + agentThinking.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 = + accept( + object : Visitor { + override fun visitAgentMessage(agentMessage: BetaManagedAgentsAgentMessagePreview) = + agentMessage.validity() + + override fun visitAgentThinking( + agentThinking: BetaManagedAgentsAgentThinkingPreview + ) = agentThinking.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaManagedAgentsStartEventPreview && + agentMessage == other.agentMessage && + agentThinking == other.agentThinking + } + + override fun hashCode(): Int = Objects.hash(agentMessage, agentThinking) + + override fun toString(): String = + when { + agentMessage != null -> "BetaManagedAgentsStartEventPreview{agentMessage=$agentMessage}" + agentThinking != null -> + "BetaManagedAgentsStartEventPreview{agentThinking=$agentThinking}" + _json != null -> "BetaManagedAgentsStartEventPreview{_unknown=$_json}" + else -> throw IllegalStateException("Invalid BetaManagedAgentsStartEventPreview") + } + + companion object { + + @JvmStatic + fun ofAgentMessage(agentMessage: BetaManagedAgentsAgentMessagePreview) = + BetaManagedAgentsStartEventPreview(agentMessage = agentMessage) + + @JvmStatic + fun ofAgentThinking(agentThinking: BetaManagedAgentsAgentThinkingPreview) = + BetaManagedAgentsStartEventPreview(agentThinking = agentThinking) + } + + /** + * An interface that defines how to map each variant of [BetaManagedAgentsStartEventPreview] to + * a value of type [T]. + */ + interface Visitor { + + fun visitAgentMessage(agentMessage: BetaManagedAgentsAgentMessagePreview): T + + fun visitAgentThinking(agentThinking: BetaManagedAgentsAgentThinkingPreview): T + + /** + * Maps an unknown variant of [BetaManagedAgentsStartEventPreview] to a value of type [T]. + * + * An instance of [BetaManagedAgentsStartEventPreview] can contain an unknown variant if it + * was deserialized from data that doesn't match any known variant. For example, if the SDK + * is on an older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws AnthropicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw AnthropicInvalidDataException("Unknown BetaManagedAgentsStartEventPreview: $json") + } + } + + internal class Deserializer : + BaseDeserializer( + BetaManagedAgentsStartEventPreview::class + ) { + + override fun ObjectCodec.deserialize(node: JsonNode): BetaManagedAgentsStartEventPreview { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "agent.message" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + BetaManagedAgentsStartEventPreview(agentMessage = it, _json = json) + } ?: BetaManagedAgentsStartEventPreview(_json = json) + } + "agent.thinking" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + BetaManagedAgentsStartEventPreview(agentThinking = it, _json = json) + } ?: BetaManagedAgentsStartEventPreview(_json = json) + } + } + + return BetaManagedAgentsStartEventPreview(_json = json) + } + } + + internal class Serializer : + BaseSerializer( + BetaManagedAgentsStartEventPreview::class + ) { + + override fun serialize( + value: BetaManagedAgentsStartEventPreview, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.agentMessage != null -> generator.writeObject(value.agentMessage) + value.agentThinking != null -> generator.writeObject(value.agentThinking) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid BetaManagedAgentsStartEventPreview") + } + } + } +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionCreateParams.kt index 6484271e1..052287248 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionCreateParams.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionCreateParams.kt @@ -241,6 +241,14 @@ private constructor( body.agent(betaManagedAgentsAgentParams) } + /** + * Alias for calling [agent] with + * `Agent.ofBetaManagedAgentsAgentWithOverridesParams(betaManagedAgentsAgentWithOverridesParams)`. + */ + fun agent( + betaManagedAgentsAgentWithOverridesParams: BetaManagedAgentsAgentWithOverridesParams + ) = apply { body.agent(betaManagedAgentsAgentWithOverridesParams) } + /** ID of the `environment` defining the container configuration for this session. */ fun environmentId(environmentId: String) = apply { body.environmentId(environmentId) } @@ -715,6 +723,19 @@ private constructor( fun agent(betaManagedAgentsAgentParams: BetaManagedAgentsAgentParams) = agent(Agent.ofBetaManagedAgentsAgentParams(betaManagedAgentsAgentParams)) + /** + * Alias for calling [agent] with + * `Agent.ofBetaManagedAgentsAgentWithOverridesParams(betaManagedAgentsAgentWithOverridesParams)`. + */ + fun agent( + betaManagedAgentsAgentWithOverridesParams: BetaManagedAgentsAgentWithOverridesParams + ) = + agent( + Agent.ofBetaManagedAgentsAgentWithOverridesParams( + betaManagedAgentsAgentWithOverridesParams + ) + ) + /** ID of the `environment` defining the container configuration for this session. */ fun environmentId(environmentId: String) = environmentId(JsonField.of(environmentId)) @@ -994,6 +1015,9 @@ private constructor( private constructor( private val string: String? = null, private val betaManagedAgentsAgentParams: BetaManagedAgentsAgentParams? = null, + private val betaManagedAgentsAgentWithOverridesParams: + BetaManagedAgentsAgentWithOverridesParams? = + null, private val _json: JsonValue? = null, ) { @@ -1006,10 +1030,21 @@ private constructor( fun betaManagedAgentsAgentParams(): Optional = Optional.ofNullable(betaManagedAgentsAgentParams) + /** + * Reference to an `agent` plus optional configuration overrides. Each provided field + * replaces the agent's value for the caller's use; the agent resource is unchanged. + */ + fun betaManagedAgentsAgentWithOverridesParams(): + Optional = + Optional.ofNullable(betaManagedAgentsAgentWithOverridesParams) + fun isString(): Boolean = string != null fun isBetaManagedAgentsAgentParams(): Boolean = betaManagedAgentsAgentParams != null + fun isBetaManagedAgentsAgentWithOverridesParams(): Boolean = + betaManagedAgentsAgentWithOverridesParams != null + fun asString(): String = string.getOrThrow("string") /** @@ -1019,6 +1054,16 @@ private constructor( fun asBetaManagedAgentsAgentParams(): BetaManagedAgentsAgentParams = betaManagedAgentsAgentParams.getOrThrow("betaManagedAgentsAgentParams") + /** + * Reference to an `agent` plus optional configuration overrides. Each provided field + * replaces the agent's value for the caller's use; the agent resource is unchanged. + */ + fun asBetaManagedAgentsAgentWithOverridesParams(): + BetaManagedAgentsAgentWithOverridesParams = + betaManagedAgentsAgentWithOverridesParams.getOrThrow( + "betaManagedAgentsAgentWithOverridesParams" + ) + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -1055,6 +1100,10 @@ private constructor( string != null -> visitor.visitString(string) betaManagedAgentsAgentParams != null -> visitor.visitBetaManagedAgentsAgentParams(betaManagedAgentsAgentParams) + betaManagedAgentsAgentWithOverridesParams != null -> + visitor.visitBetaManagedAgentsAgentWithOverridesParams( + betaManagedAgentsAgentWithOverridesParams + ) else -> visitor.unknown(_json) } @@ -1083,6 +1132,13 @@ private constructor( ) { betaManagedAgentsAgentParams.validate() } + + override fun visitBetaManagedAgentsAgentWithOverridesParams( + betaManagedAgentsAgentWithOverridesParams: + BetaManagedAgentsAgentWithOverridesParams + ) { + betaManagedAgentsAgentWithOverridesParams.validate() + } } ) validated = true @@ -1112,6 +1168,11 @@ private constructor( betaManagedAgentsAgentParams: BetaManagedAgentsAgentParams ) = betaManagedAgentsAgentParams.validity() + override fun visitBetaManagedAgentsAgentWithOverridesParams( + betaManagedAgentsAgentWithOverridesParams: + BetaManagedAgentsAgentWithOverridesParams + ) = betaManagedAgentsAgentWithOverridesParams.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1123,16 +1184,25 @@ private constructor( return other is Agent && string == other.string && - betaManagedAgentsAgentParams == other.betaManagedAgentsAgentParams + betaManagedAgentsAgentParams == other.betaManagedAgentsAgentParams && + betaManagedAgentsAgentWithOverridesParams == + other.betaManagedAgentsAgentWithOverridesParams } - override fun hashCode(): Int = Objects.hash(string, betaManagedAgentsAgentParams) + override fun hashCode(): Int = + Objects.hash( + string, + betaManagedAgentsAgentParams, + betaManagedAgentsAgentWithOverridesParams, + ) override fun toString(): String = when { string != null -> "Agent{string=$string}" betaManagedAgentsAgentParams != null -> "Agent{betaManagedAgentsAgentParams=$betaManagedAgentsAgentParams}" + betaManagedAgentsAgentWithOverridesParams != null -> + "Agent{betaManagedAgentsAgentWithOverridesParams=$betaManagedAgentsAgentWithOverridesParams}" _json != null -> "Agent{_unknown=$_json}" else -> throw IllegalStateException("Invalid Agent") } @@ -1149,6 +1219,19 @@ private constructor( fun ofBetaManagedAgentsAgentParams( betaManagedAgentsAgentParams: BetaManagedAgentsAgentParams ) = Agent(betaManagedAgentsAgentParams = betaManagedAgentsAgentParams) + + /** + * Reference to an `agent` plus optional configuration overrides. Each provided field + * replaces the agent's value for the caller's use; the agent resource is unchanged. + */ + @JvmStatic + fun ofBetaManagedAgentsAgentWithOverridesParams( + betaManagedAgentsAgentWithOverridesParams: BetaManagedAgentsAgentWithOverridesParams + ) = + Agent( + betaManagedAgentsAgentWithOverridesParams = + betaManagedAgentsAgentWithOverridesParams + ) } /** An interface that defines how to map each variant of [Agent] to a value of type [T]. */ @@ -1164,6 +1247,14 @@ private constructor( betaManagedAgentsAgentParams: BetaManagedAgentsAgentParams ): T + /** + * Reference to an `agent` plus optional configuration overrides. Each provided field + * replaces the agent's value for the caller's use; the agent resource is unchanged. + */ + fun visitBetaManagedAgentsAgentWithOverridesParams( + betaManagedAgentsAgentWithOverridesParams: BetaManagedAgentsAgentWithOverridesParams + ): T + /** * Maps an unknown variant of [Agent] to a value of type [T]. * @@ -1188,6 +1279,16 @@ private constructor( sequenceOf( tryDeserialize(node, jacksonTypeRef()) ?.let { Agent(betaManagedAgentsAgentParams = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Agent( + betaManagedAgentsAgentWithOverridesParams = it, + _json = json, + ) + }, tryDeserialize(node, jacksonTypeRef())?.let { Agent(string = it, _json = json) }, @@ -1219,6 +1320,8 @@ private constructor( value.string != null -> generator.writeObject(value.string) value.betaManagedAgentsAgentParams != null -> generator.writeObject(value.betaManagedAgentsAgentParams) + value.betaManagedAgentsAgentWithOverridesParams != null -> + generator.writeObject(value.betaManagedAgentsAgentWithOverridesParams) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Agent") } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPage.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPage.kt index 9c9121f4c..ed2539181 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPage.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPage.kt @@ -33,6 +33,13 @@ private constructor( */ fun nextPageRaw(): Optional = response._nextPage().getOptional("next_page") + /** + * Delegates to [SessionListPageResponse], but gracefully handles missing data. + * + * @see SessionListPageResponse.prevPage + */ + fun prevPage(): Optional = response._prevPage().getOptional("prev_page") + override fun items(): List = data() override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageRaw().isPresent diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageAsync.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageAsync.kt index 71a73d0f9..df11afafc 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageAsync.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageAsync.kt @@ -36,6 +36,13 @@ private constructor( */ fun nextPageRaw(): Optional = response._nextPage().getOptional("next_page") + /** + * Delegates to [SessionListPageResponse], but gracefully handles missing data. + * + * @see SessionListPageResponse.prevPage + */ + fun prevPage(): Optional = response._prevPage().getOptional("prev_page") + override fun items(): List = data() override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageRaw().isPresent diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponse.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponse.kt index f22d36ef0..41239031d 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponse.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponse.kt @@ -24,6 +24,7 @@ class SessionListPageResponse private constructor( private val data: JsonField>, private val nextPage: JsonField, + private val prevPage: JsonField, private val additionalProperties: MutableMap, ) { @@ -33,7 +34,8 @@ private constructor( @ExcludeMissing data: JsonField> = JsonMissing.of(), @JsonProperty("next_page") @ExcludeMissing nextPage: JsonField = JsonMissing.of(), - ) : this(data, nextPage, mutableMapOf()) + @JsonProperty("prev_page") @ExcludeMissing prevPage: JsonField = JsonMissing.of(), + ) : this(data, nextPage, prevPage, mutableMapOf()) /** * List of sessions. @@ -51,6 +53,15 @@ private constructor( */ fun nextPage(): Optional = nextPage.getOptional("next_page") + /** + * Opaque cursor for the previous page. Null when on the first page. Pass as the `page` + * parameter to navigate backward. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun prevPage(): Optional = prevPage.getOptional("prev_page") + /** * Returns the raw JSON value of [data]. * @@ -67,6 +78,13 @@ private constructor( */ @JsonProperty("next_page") @ExcludeMissing fun _nextPage(): JsonField = nextPage + /** + * Returns the raw JSON value of [prevPage]. + * + * Unlike [prevPage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("prev_page") @ExcludeMissing fun _prevPage(): JsonField = prevPage + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -90,6 +108,7 @@ private constructor( private var data: JsonField>? = null private var nextPage: JsonField = JsonMissing.of() + private var prevPage: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -99,6 +118,7 @@ private constructor( .map { it.toMutableList() } .takeUnless { it.isMissing() } nextPage = sessionListPageResponse.nextPage + prevPage = sessionListPageResponse.prevPage additionalProperties = sessionListPageResponse.additionalProperties.toMutableMap() } @@ -142,6 +162,23 @@ private constructor( */ fun nextPage(nextPage: JsonField) = apply { this.nextPage = nextPage } + /** + * Opaque cursor for the previous page. Null when on the first page. Pass as the `page` + * parameter to navigate backward. + */ + fun prevPage(prevPage: String?) = prevPage(JsonField.ofNullable(prevPage)) + + /** Alias for calling [Builder.prevPage] with `prevPage.orElse(null)`. */ + fun prevPage(prevPage: Optional) = prevPage(prevPage.getOrNull()) + + /** + * Sets [Builder.prevPage] to an arbitrary JSON value. + * + * You should usually call [Builder.prevPage] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun prevPage(prevPage: JsonField) = apply { this.prevPage = prevPage } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -170,6 +207,7 @@ private constructor( SessionListPageResponse( (data ?: JsonMissing.of()).map { it.toImmutable() }, nextPage, + prevPage, additionalProperties.toMutableMap(), ) } @@ -191,6 +229,7 @@ private constructor( data().ifPresent { it.forEach { it.validate() } } nextPage() + prevPage() validated = true } @@ -210,7 +249,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (nextPage.asKnown().isPresent) 1 else 0) + (if (nextPage.asKnown().isPresent) 1 else 0) + + (if (prevPage.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -220,13 +260,16 @@ private constructor( return other is SessionListPageResponse && data == other.data && nextPage == other.nextPage && + prevPage == other.prevPage && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(data, nextPage, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(data, nextPage, prevPage, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "SessionListPageResponse{data=$data, nextPage=$nextPage, additionalProperties=$additionalProperties}" + "SessionListPageResponse{data=$data, nextPage=$nextPage, prevPage=$prevPage, additionalProperties=$additionalProperties}" } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEvents.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEvents.kt index 3c5ef298a..cd2c11929 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEvents.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEvents.kt @@ -7,7 +7,9 @@ import com.anthropic.core.BaseSerializer import com.anthropic.core.JsonValue import com.anthropic.core.getOrThrow import com.anthropic.errors.AnthropicInvalidDataException +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionUpdatedEvent +import com.anthropic.models.beta.sessions.BetaManagedAgentsStartEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSystemMessageEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsUserToolResultEvent import com.fasterxml.jackson.core.JsonGenerator @@ -68,6 +70,8 @@ private constructor( BetaManagedAgentsSessionThreadStatusRescheduledEvent? = null, private val sessionUpdated: BetaManagedAgentsSessionUpdatedEvent? = null, + private val eventStart: BetaManagedAgentsStartEvent? = null, + private val eventDelta: BetaManagedAgentsDeltaEvent? = null, private val systemMessage: BetaManagedAgentsSystemMessageEvent? = null, private val _json: JsonValue? = null, ) { @@ -257,6 +261,24 @@ private constructor( fun sessionUpdated(): Optional = Optional.ofNullable(sessionUpdated) + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed + * by zero or more event_delta events with the same event id, normally concluded by the buffered + * event carrying that id. If the producing model request ends without that event (an error or + * interrupt mid-stream), its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + fun eventStart(): Optional = Optional.ofNullable(eventStart) + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort and + * may stop early; when the buffered event with id == event_id is produced it carries the + * complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on stream + * connections that opt in via event_deltas; never appears in event history. + */ + fun eventDelta(): Optional = Optional.ofNullable(eventDelta) + /** * A mid-conversation system message event. Carries system-role content that is appended to the * session as a `role: "system"` turn. @@ -330,6 +352,10 @@ private constructor( fun isSessionUpdated(): Boolean = sessionUpdated != null + fun isEventStart(): Boolean = eventStart != null + + fun isEventDelta(): Boolean = eventDelta != null + fun isSystemMessage(): Boolean = systemMessage != null /** A user message event in the session conversation. */ @@ -513,6 +539,24 @@ private constructor( fun asSessionUpdated(): BetaManagedAgentsSessionUpdatedEvent = sessionUpdated.getOrThrow("sessionUpdated") + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed + * by zero or more event_delta events with the same event id, normally concluded by the buffered + * event carrying that id. If the producing model request ends without that event (an error or + * interrupt mid-stream), its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + fun asEventStart(): BetaManagedAgentsStartEvent = eventStart.getOrThrow("eventStart") + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort and + * may stop early; when the buffered event with id == event_id is produced it carries the + * complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on stream + * connections that opt in via event_deltas; never appears in event history. + */ + fun asEventDelta(): BetaManagedAgentsDeltaEvent = eventDelta.getOrThrow("eventDelta") + /** * A mid-conversation system message event. Carries system-role content that is appended to the * session as a `role: "system"` turn. @@ -599,6 +643,8 @@ private constructor( sessionThreadStatusRescheduled != null -> visitor.visitSessionThreadStatusRescheduled(sessionThreadStatusRescheduled) sessionUpdated != null -> visitor.visitSessionUpdated(sessionUpdated) + eventStart != null -> visitor.visitEventStart(eventStart) + eventDelta != null -> visitor.visitEventDelta(eventDelta) systemMessage != null -> visitor.visitSystemMessage(systemMessage) else -> visitor.unknown(_json) } @@ -812,6 +858,14 @@ private constructor( sessionUpdated.validate() } + override fun visitEventStart(eventStart: BetaManagedAgentsStartEvent) { + eventStart.validate() + } + + override fun visitEventDelta(eventDelta: BetaManagedAgentsDeltaEvent) { + eventDelta.validate() + } + override fun visitSystemMessage( systemMessage: BetaManagedAgentsSystemMessageEvent ) { @@ -969,6 +1023,12 @@ private constructor( sessionUpdated: BetaManagedAgentsSessionUpdatedEvent ) = sessionUpdated.validity() + override fun visitEventStart(eventStart: BetaManagedAgentsStartEvent) = + eventStart.validity() + + override fun visitEventDelta(eventDelta: BetaManagedAgentsDeltaEvent) = + eventDelta.validity() + override fun visitSystemMessage( systemMessage: BetaManagedAgentsSystemMessageEvent ) = systemMessage.validity() @@ -1016,6 +1076,8 @@ private constructor( userToolResult == other.userToolResult && sessionThreadStatusRescheduled == other.sessionThreadStatusRescheduled && sessionUpdated == other.sessionUpdated && + eventStart == other.eventStart && + eventDelta == other.eventDelta && systemMessage == other.systemMessage } @@ -1054,6 +1116,8 @@ private constructor( userToolResult, sessionThreadStatusRescheduled, sessionUpdated, + eventStart, + eventDelta, systemMessage, ) @@ -1124,6 +1188,8 @@ private constructor( "BetaManagedAgentsStreamSessionEvents{sessionThreadStatusRescheduled=$sessionThreadStatusRescheduled}" sessionUpdated != null -> "BetaManagedAgentsStreamSessionEvents{sessionUpdated=$sessionUpdated}" + eventStart != null -> "BetaManagedAgentsStreamSessionEvents{eventStart=$eventStart}" + eventDelta != null -> "BetaManagedAgentsStreamSessionEvents{eventDelta=$eventDelta}" systemMessage != null -> "BetaManagedAgentsStreamSessionEvents{systemMessage=$systemMessage}" _json != null -> "BetaManagedAgentsStreamSessionEvents{_unknown=$_json}" @@ -1393,6 +1459,29 @@ private constructor( fun ofSessionUpdated(sessionUpdated: BetaManagedAgentsSessionUpdatedEvent) = BetaManagedAgentsStreamSessionEvents(sessionUpdated = sessionUpdated) + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. + * Followed by zero or more event_delta events with the same event id, normally concluded by + * the buffered event carrying that id. If the producing model request ends without that + * event (an error or interrupt mid-stream), its terminal span.model_request_end closes the + * preview. Only sent on stream connections that opt in via event_deltas; never appears in + * event history. + */ + @JvmStatic + fun ofEventStart(eventStart: BetaManagedAgentsStartEvent) = + BetaManagedAgentsStreamSessionEvents(eventStart = eventStart) + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort + * and may stop early; when the buffered event with id == event_id is produced it carries + * the complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + @JvmStatic + fun ofEventDelta(eventDelta: BetaManagedAgentsDeltaEvent) = + BetaManagedAgentsStreamSessionEvents(eventDelta = eventDelta) + /** * A mid-conversation system message event. Carries system-role content that is appended to * the session as a `role: "system"` turn. @@ -1595,6 +1684,25 @@ private constructor( */ fun visitSessionUpdated(sessionUpdated: BetaManagedAgentsSessionUpdatedEvent): T + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. + * Followed by zero or more event_delta events with the same event id, normally concluded by + * the buffered event carrying that id. If the producing model request ends without that + * event (an error or interrupt mid-stream), its terminal span.model_request_end closes the + * preview. Only sent on stream connections that opt in via event_deltas; never appears in + * event history. + */ + fun visitEventStart(eventStart: BetaManagedAgentsStartEvent): T + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort + * and may stop early; when the buffered event with id == event_id is produced it carries + * the complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + fun visitEventDelta(eventDelta: BetaManagedAgentsDeltaEvent): T + /** * A mid-conversation system message event. Carries system-role content that is appended to * the session as a `role: "system"` turn. @@ -1988,6 +2096,18 @@ private constructor( BetaManagedAgentsStreamSessionEvents(sessionUpdated = it, _json = json) } ?: BetaManagedAgentsStreamSessionEvents(_json = json) } + "event_start" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { + BetaManagedAgentsStreamSessionEvents(eventStart = it, _json = json) + } ?: BetaManagedAgentsStreamSessionEvents(_json = json) + } + "event_delta" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { + BetaManagedAgentsStreamSessionEvents(eventDelta = it, _json = json) + } ?: BetaManagedAgentsStreamSessionEvents(_json = json) + } "system.message" -> { return tryDeserialize( node, @@ -2065,6 +2185,8 @@ private constructor( value.sessionThreadStatusRescheduled != null -> generator.writeObject(value.sessionThreadStatusRescheduled) value.sessionUpdated != null -> generator.writeObject(value.sessionUpdated) + value.eventStart != null -> generator.writeObject(value.eventStart) + value.eventDelta != null -> generator.writeObject(value.eventDelta) value.systemMessage != null -> generator.writeObject(value.systemMessage) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid BetaManagedAgentsStreamSessionEvents") diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParams.kt index 87aab1377..5aaa1ae15 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParams.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParams.kt @@ -7,6 +7,7 @@ import com.anthropic.core.http.Headers import com.anthropic.core.http.QueryParams import com.anthropic.core.toImmutable import com.anthropic.models.beta.AnthropicBeta +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaType import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -15,6 +16,7 @@ import kotlin.jvm.optionals.getOrNull class EventStreamParams private constructor( private val sessionId: String?, + private val eventDeltas: List?, private val betas: List?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -22,6 +24,18 @@ private constructor( fun sessionId(): Optional = Optional.ofNullable(sessionId) + /** + * When set, this connection also receives streaming deltas (`event_start`, `event_delta`) while + * an event is being produced, before the event itself arrives. Deltas are best-effort; when the + * final event is produced it carries the complete content. A model request that ends early (an + * error or interrupt) produces no final event — its terminal `span.model_request_end` closes + * the preview. Accepts one or more event types to preview and may be repeated: `agent.message` + * streams `content_delta` fragments; `agent.thinking` is start-only — a signal that the agent + * has begun extended thinking, concluded by the `agent.thinking` event itself. Only previews of + * the requested event types are sent. + */ + fun eventDeltas(): Optional> = Optional.ofNullable(eventDeltas) + /** Optional header to specify the beta version(s) you want to use. */ fun betas(): Optional> = Optional.ofNullable(betas) @@ -45,6 +59,7 @@ private constructor( class Builder internal constructor() { private var sessionId: String? = null + private var eventDeltas: MutableList? = null private var betas: MutableList? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -52,6 +67,7 @@ private constructor( @JvmSynthetic internal fun from(eventStreamParams: EventStreamParams) = apply { sessionId = eventStreamParams.sessionId + eventDeltas = eventStreamParams.eventDeltas?.toMutableList() betas = eventStreamParams.betas?.toMutableList() additionalHeaders = eventStreamParams.additionalHeaders.toBuilder() additionalQueryParams = eventStreamParams.additionalQueryParams.toBuilder() @@ -62,6 +78,33 @@ private constructor( /** Alias for calling [Builder.sessionId] with `sessionId.orElse(null)`. */ fun sessionId(sessionId: Optional) = sessionId(sessionId.getOrNull()) + /** + * When set, this connection also receives streaming deltas (`event_start`, `event_delta`) + * while an event is being produced, before the event itself arrives. Deltas are + * best-effort; when the final event is produced it carries the complete content. A model + * request that ends early (an error or interrupt) produces no final event — its terminal + * `span.model_request_end` closes the preview. Accepts one or more event types to preview + * and may be repeated: `agent.message` streams `content_delta` fragments; `agent.thinking` + * is start-only — a signal that the agent has begun extended thinking, concluded by the + * `agent.thinking` event itself. Only previews of the requested event types are sent. + */ + fun eventDeltas(eventDeltas: List?) = apply { + this.eventDeltas = eventDeltas?.toMutableList() + } + + /** Alias for calling [Builder.eventDeltas] with `eventDeltas.orElse(null)`. */ + fun eventDeltas(eventDeltas: Optional>) = + eventDeltas(eventDeltas.getOrNull()) + + /** + * Adds a single [BetaManagedAgentsDeltaType] to [eventDeltas]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEventDelta(eventDelta: BetaManagedAgentsDeltaType) = apply { + eventDeltas = (eventDeltas ?: mutableListOf()).apply { add(eventDelta) } + } + /** Optional header to specify the beta version(s) you want to use. */ fun betas(betas: List?) = apply { this.betas = betas?.toMutableList() } @@ -192,6 +235,7 @@ private constructor( fun build(): EventStreamParams = EventStreamParams( sessionId, + eventDeltas?.toImmutable(), betas?.toImmutable(), additionalHeaders.build(), additionalQueryParams.build(), @@ -212,7 +256,13 @@ private constructor( } .build() - override fun _queryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + eventDeltas?.forEach { put("event_deltas[]", it.toString()) } + putAll(additionalQueryParams) + } + .build() override fun equals(other: Any?): Boolean { if (this === other) { @@ -221,14 +271,15 @@ private constructor( return other is EventStreamParams && sessionId == other.sessionId && + eventDeltas == other.eventDeltas && betas == other.betas && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } override fun hashCode(): Int = - Objects.hash(sessionId, betas, additionalHeaders, additionalQueryParams) + Objects.hash(sessionId, eventDeltas, betas, additionalHeaders, additionalQueryParams) override fun toString() = - "EventStreamParams{sessionId=$sessionId, betas=$betas, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "EventStreamParams{sessionId=$sessionId, eventDeltas=$eventDeltas, betas=$betas, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEvents.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEvents.kt index 4103b8be2..8aaa8f656 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEvents.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEvents.kt @@ -7,7 +7,9 @@ import com.anthropic.core.BaseSerializer import com.anthropic.core.JsonValue import com.anthropic.core.getOrThrow import com.anthropic.errors.AnthropicInvalidDataException +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionUpdatedEvent +import com.anthropic.models.beta.sessions.BetaManagedAgentsStartEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSystemMessageEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsUserToolResultEvent import com.anthropic.models.beta.sessions.events.BetaManagedAgentsAgentCustomToolUseEvent @@ -99,6 +101,8 @@ private constructor( BetaManagedAgentsSessionThreadStatusRescheduledEvent? = null, private val sessionUpdated: BetaManagedAgentsSessionUpdatedEvent? = null, + private val eventStart: BetaManagedAgentsStartEvent? = null, + private val eventDelta: BetaManagedAgentsDeltaEvent? = null, private val systemMessage: BetaManagedAgentsSystemMessageEvent? = null, private val _json: JsonValue? = null, ) { @@ -288,6 +292,24 @@ private constructor( fun sessionUpdated(): Optional = Optional.ofNullable(sessionUpdated) + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed + * by zero or more event_delta events with the same event id, normally concluded by the buffered + * event carrying that id. If the producing model request ends without that event (an error or + * interrupt mid-stream), its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + fun eventStart(): Optional = Optional.ofNullable(eventStart) + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort and + * may stop early; when the buffered event with id == event_id is produced it carries the + * complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on stream + * connections that opt in via event_deltas; never appears in event history. + */ + fun eventDelta(): Optional = Optional.ofNullable(eventDelta) + /** * A mid-conversation system message event. Carries system-role content that is appended to the * session as a `role: "system"` turn. @@ -361,6 +383,10 @@ private constructor( fun isSessionUpdated(): Boolean = sessionUpdated != null + fun isEventStart(): Boolean = eventStart != null + + fun isEventDelta(): Boolean = eventDelta != null + fun isSystemMessage(): Boolean = systemMessage != null /** A user message event in the session conversation. */ @@ -544,6 +570,24 @@ private constructor( fun asSessionUpdated(): BetaManagedAgentsSessionUpdatedEvent = sessionUpdated.getOrThrow("sessionUpdated") + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed + * by zero or more event_delta events with the same event id, normally concluded by the buffered + * event carrying that id. If the producing model request ends without that event (an error or + * interrupt mid-stream), its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + fun asEventStart(): BetaManagedAgentsStartEvent = eventStart.getOrThrow("eventStart") + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort and + * may stop early; when the buffered event with id == event_id is produced it carries the + * complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on stream + * connections that opt in via event_deltas; never appears in event history. + */ + fun asEventDelta(): BetaManagedAgentsDeltaEvent = eventDelta.getOrThrow("eventDelta") + /** * A mid-conversation system message event. Carries system-role content that is appended to the * session as a `role: "system"` turn. @@ -630,6 +674,8 @@ private constructor( sessionThreadStatusRescheduled != null -> visitor.visitSessionThreadStatusRescheduled(sessionThreadStatusRescheduled) sessionUpdated != null -> visitor.visitSessionUpdated(sessionUpdated) + eventStart != null -> visitor.visitEventStart(eventStart) + eventDelta != null -> visitor.visitEventDelta(eventDelta) systemMessage != null -> visitor.visitSystemMessage(systemMessage) else -> visitor.unknown(_json) } @@ -843,6 +889,14 @@ private constructor( sessionUpdated.validate() } + override fun visitEventStart(eventStart: BetaManagedAgentsStartEvent) { + eventStart.validate() + } + + override fun visitEventDelta(eventDelta: BetaManagedAgentsDeltaEvent) { + eventDelta.validate() + } + override fun visitSystemMessage( systemMessage: BetaManagedAgentsSystemMessageEvent ) { @@ -1000,6 +1054,12 @@ private constructor( sessionUpdated: BetaManagedAgentsSessionUpdatedEvent ) = sessionUpdated.validity() + override fun visitEventStart(eventStart: BetaManagedAgentsStartEvent) = + eventStart.validity() + + override fun visitEventDelta(eventDelta: BetaManagedAgentsDeltaEvent) = + eventDelta.validity() + override fun visitSystemMessage( systemMessage: BetaManagedAgentsSystemMessageEvent ) = systemMessage.validity() @@ -1047,6 +1107,8 @@ private constructor( userToolResult == other.userToolResult && sessionThreadStatusRescheduled == other.sessionThreadStatusRescheduled && sessionUpdated == other.sessionUpdated && + eventStart == other.eventStart && + eventDelta == other.eventDelta && systemMessage == other.systemMessage } @@ -1085,6 +1147,8 @@ private constructor( userToolResult, sessionThreadStatusRescheduled, sessionUpdated, + eventStart, + eventDelta, systemMessage, ) @@ -1156,6 +1220,10 @@ private constructor( "BetaManagedAgentsStreamSessionThreadEvents{sessionThreadStatusRescheduled=$sessionThreadStatusRescheduled}" sessionUpdated != null -> "BetaManagedAgentsStreamSessionThreadEvents{sessionUpdated=$sessionUpdated}" + eventStart != null -> + "BetaManagedAgentsStreamSessionThreadEvents{eventStart=$eventStart}" + eventDelta != null -> + "BetaManagedAgentsStreamSessionThreadEvents{eventDelta=$eventDelta}" systemMessage != null -> "BetaManagedAgentsStreamSessionThreadEvents{systemMessage=$systemMessage}" _json != null -> "BetaManagedAgentsStreamSessionThreadEvents{_unknown=$_json}" @@ -1438,6 +1506,29 @@ private constructor( fun ofSessionUpdated(sessionUpdated: BetaManagedAgentsSessionUpdatedEvent) = BetaManagedAgentsStreamSessionThreadEvents(sessionUpdated = sessionUpdated) + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. + * Followed by zero or more event_delta events with the same event id, normally concluded by + * the buffered event carrying that id. If the producing model request ends without that + * event (an error or interrupt mid-stream), its terminal span.model_request_end closes the + * preview. Only sent on stream connections that opt in via event_deltas; never appears in + * event history. + */ + @JvmStatic + fun ofEventStart(eventStart: BetaManagedAgentsStartEvent) = + BetaManagedAgentsStreamSessionThreadEvents(eventStart = eventStart) + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort + * and may stop early; when the buffered event with id == event_id is produced it carries + * the complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + @JvmStatic + fun ofEventDelta(eventDelta: BetaManagedAgentsDeltaEvent) = + BetaManagedAgentsStreamSessionThreadEvents(eventDelta = eventDelta) + /** * A mid-conversation system message event. Carries system-role content that is appended to * the session as a `role: "system"` turn. @@ -1640,6 +1731,25 @@ private constructor( */ fun visitSessionUpdated(sessionUpdated: BetaManagedAgentsSessionUpdatedEvent): T + /** + * Opens a preview of a buffered event. Carries the previewed event's type and id only. + * Followed by zero or more event_delta events with the same event id, normally concluded by + * the buffered event carrying that id. If the producing model request ends without that + * event (an error or interrupt mid-stream), its terminal span.model_request_end closes the + * preview. Only sent on stream connections that opt in via event_deltas; never appears in + * event history. + */ + fun visitEventStart(eventStart: BetaManagedAgentsStartEvent): T + + /** + * An incremental update to an event that is still being streamed. Deltas are best-effort + * and may stop early; when the buffered event with id == event_id is produced it carries + * the complete content. A model request that ends early (an error or interrupt) produces no + * buffered event — its terminal span.model_request_end closes the preview. Only sent on + * stream connections that opt in via event_deltas; never appears in event history. + */ + fun visitEventDelta(eventDelta: BetaManagedAgentsDeltaEvent): T + /** * A mid-conversation system message event. Carries system-role content that is appended to * the session as a `role: "system"` turn. @@ -2069,6 +2179,24 @@ private constructor( ) } ?: BetaManagedAgentsStreamSessionThreadEvents(_json = json) } + "event_start" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { + BetaManagedAgentsStreamSessionThreadEvents( + eventStart = it, + _json = json, + ) + } ?: BetaManagedAgentsStreamSessionThreadEvents(_json = json) + } + "event_delta" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { + BetaManagedAgentsStreamSessionThreadEvents( + eventDelta = it, + _json = json, + ) + } ?: BetaManagedAgentsStreamSessionThreadEvents(_json = json) + } "system.message" -> { return tryDeserialize( node, @@ -2149,6 +2277,8 @@ private constructor( value.sessionThreadStatusRescheduled != null -> generator.writeObject(value.sessionThreadStatusRescheduled) value.sessionUpdated != null -> generator.writeObject(value.sessionUpdated) + value.eventStart != null -> generator.writeObject(value.eventStart) + value.eventDelta != null -> generator.writeObject(value.eventDelta) value.systemMessage != null -> generator.writeObject(value.systemMessage) value._json != null -> generator.writeObject(value._json) else -> diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponse.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponse.kt index 6db90b2d7..fabb9d91b 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponse.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponse.kt @@ -32,6 +32,7 @@ import kotlin.jvm.optionals.getOrNull class BetaManagedAgentsEnvironmentVariableAuthResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val injectionLocation: JsonField, private val networking: JsonField, private val secretName: JsonField, private val type: JsonField, @@ -40,6 +41,9 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("injection_location") + @ExcludeMissing + injectionLocation: JsonField = JsonMissing.of(), @JsonProperty("networking") @ExcludeMissing networking: JsonField = JsonMissing.of(), @@ -47,7 +51,16 @@ private constructor( @ExcludeMissing secretName: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(networking, secretName, type, mutableMapOf()) + ) : this(injectionLocation, networking, secretName, type, mutableMapOf()) + + /** + * Where in the outbound request the secret value is substituted. + * + * @throws AnthropicInvalidDataException 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 injectionLocation(): BetaManagedAgentsInjectionLocationResponse = + injectionLocation.getRequired("injection_location") /** * Outbound hosts the secret value is substituted on. @@ -71,6 +84,17 @@ private constructor( */ fun type(): Type = type.getRequired("type") + /** + * Returns the raw JSON value of [injectionLocation]. + * + * Unlike [injectionLocation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("injection_location") + @ExcludeMissing + fun _injectionLocation(): JsonField = + injectionLocation + /** * Returns the raw JSON value of [networking]. * @@ -114,6 +138,7 @@ private constructor( * * The following fields are required: * ```java + * .injectionLocation() * .networking() * .secretName() * .type() @@ -125,6 +150,7 @@ private constructor( /** A builder for [BetaManagedAgentsEnvironmentVariableAuthResponse]. */ class Builder internal constructor() { + private var injectionLocation: JsonField? = null private var networking: JsonField? = null private var secretName: JsonField? = null private var type: JsonField? = null @@ -135,6 +161,7 @@ private constructor( betaManagedAgentsEnvironmentVariableAuthResponse: BetaManagedAgentsEnvironmentVariableAuthResponse ) = apply { + injectionLocation = betaManagedAgentsEnvironmentVariableAuthResponse.injectionLocation networking = betaManagedAgentsEnvironmentVariableAuthResponse.networking secretName = betaManagedAgentsEnvironmentVariableAuthResponse.secretName type = betaManagedAgentsEnvironmentVariableAuthResponse.type @@ -142,6 +169,21 @@ private constructor( betaManagedAgentsEnvironmentVariableAuthResponse.additionalProperties.toMutableMap() } + /** Where in the outbound request the secret value is substituted. */ + fun injectionLocation(injectionLocation: BetaManagedAgentsInjectionLocationResponse) = + injectionLocation(JsonField.of(injectionLocation)) + + /** + * Sets [Builder.injectionLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.injectionLocation] with a well-typed + * [BetaManagedAgentsInjectionLocationResponse] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun injectionLocation( + injectionLocation: JsonField + ) = apply { this.injectionLocation = injectionLocation } + /** Outbound hosts the secret value is substituted on. */ fun networking(networking: Networking) = networking(JsonField.of(networking)) @@ -227,6 +269,7 @@ private constructor( * * The following fields are required: * ```java + * .injectionLocation() * .networking() * .secretName() * .type() @@ -236,6 +279,7 @@ private constructor( */ fun build(): BetaManagedAgentsEnvironmentVariableAuthResponse = BetaManagedAgentsEnvironmentVariableAuthResponse( + checkRequired("injectionLocation", injectionLocation), checkRequired("networking", networking), checkRequired("secretName", secretName), checkRequired("type", type), @@ -258,6 +302,7 @@ private constructor( return@apply } + injectionLocation().validate() networking().validate() secretName() type().validate() @@ -279,7 +324,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (networking.asKnown().getOrNull()?.validity() ?: 0) + + (injectionLocation.asKnown().getOrNull()?.validity() ?: 0) + + (networking.asKnown().getOrNull()?.validity() ?: 0) + (if (secretName.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) @@ -675,6 +721,7 @@ private constructor( } return other is BetaManagedAgentsEnvironmentVariableAuthResponse && + injectionLocation == other.injectionLocation && networking == other.networking && secretName == other.secretName && type == other.type && @@ -682,11 +729,11 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(networking, secretName, type, additionalProperties) + Objects.hash(injectionLocation, networking, secretName, type, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "BetaManagedAgentsEnvironmentVariableAuthResponse{networking=$networking, secretName=$secretName, type=$type, additionalProperties=$additionalProperties}" + "BetaManagedAgentsEnvironmentVariableAuthResponse{injectionLocation=$injectionLocation, networking=$networking, secretName=$secretName, type=$type, additionalProperties=$additionalProperties}" } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParams.kt index 2e1fdfc58..fbc5fc9bb 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParams.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParams.kt @@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import java.util.Collections import java.util.Objects +import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Parameters for creating an environment variable credential. */ @@ -25,6 +26,7 @@ private constructor( private val secretName: JsonField, private val secretValue: JsonField, private val type: JsonField, + private val injectionLocation: JsonField, private val additionalProperties: MutableMap, ) { @@ -40,7 +42,10 @@ private constructor( @ExcludeMissing secretValue: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(networking, secretName, secretValue, type, mutableMapOf()) + @JsonProperty("injection_location") + @ExcludeMissing + injectionLocation: JsonField = JsonMissing.of(), + ) : this(networking, secretName, secretValue, type, injectionLocation, mutableMapOf()) /** * Outbound hosts the secret value is substituted on. @@ -73,6 +78,15 @@ private constructor( */ fun type(): Type = type.getRequired("type") + /** + * Where in the outbound request the secret value may be substituted. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun injectionLocation(): Optional = + injectionLocation.getOptional("injection_location") + /** * Returns the raw JSON value of [networking]. * @@ -105,6 +119,17 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [injectionLocation]. + * + * Unlike [injectionLocation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("injection_location") + @ExcludeMissing + fun _injectionLocation(): JsonField = + injectionLocation + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -141,6 +166,8 @@ private constructor( private var secretName: JsonField? = null private var secretValue: JsonField? = null private var type: JsonField? = null + private var injectionLocation: JsonField = + JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -152,6 +179,7 @@ private constructor( secretName = betaManagedAgentsEnvironmentVariableCreateParams.secretName secretValue = betaManagedAgentsEnvironmentVariableCreateParams.secretValue type = betaManagedAgentsEnvironmentVariableCreateParams.type + injectionLocation = betaManagedAgentsEnvironmentVariableCreateParams.injectionLocation additionalProperties = betaManagedAgentsEnvironmentVariableCreateParams.additionalProperties.toMutableMap() } @@ -236,6 +264,21 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** Where in the outbound request the secret value may be substituted. */ + fun injectionLocation(injectionLocation: BetaManagedAgentsInjectionLocationParams) = + injectionLocation(JsonField.of(injectionLocation)) + + /** + * Sets [Builder.injectionLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.injectionLocation] with a well-typed + * [BetaManagedAgentsInjectionLocationParams] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun injectionLocation( + injectionLocation: JsonField + ) = apply { this.injectionLocation = injectionLocation } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -276,6 +319,7 @@ private constructor( checkRequired("secretName", secretName), checkRequired("secretValue", secretValue), checkRequired("type", type), + injectionLocation, additionalProperties.toMutableMap(), ) } @@ -299,6 +343,7 @@ private constructor( secretName() secretValue() type().validate() + injectionLocation().ifPresent { it.validate() } validated = true } @@ -320,7 +365,8 @@ private constructor( (networking.asKnown().getOrNull()?.validity() ?: 0) + (if (secretName.asKnown().isPresent) 1 else 0) + (if (secretValue.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (injectionLocation.asKnown().getOrNull()?.validity() ?: 0) class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -462,15 +508,23 @@ private constructor( secretName == other.secretName && secretValue == other.secretValue && type == other.type && + injectionLocation == other.injectionLocation && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(networking, secretName, secretValue, type, additionalProperties) + Objects.hash( + networking, + secretName, + secretValue, + type, + injectionLocation, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "BetaManagedAgentsEnvironmentVariableCreateParams{networking=$networking, secretName=$secretName, secretValue=$secretValue, type=$type, additionalProperties=$additionalProperties}" + "BetaManagedAgentsEnvironmentVariableCreateParams{networking=$networking, secretName=$secretName, secretValue=$secretValue, type=$type, injectionLocation=$injectionLocation, additionalProperties=$additionalProperties}" } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParams.kt index d7165b123..f68196ae9 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParams.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParams.kt @@ -23,6 +23,7 @@ class BetaManagedAgentsEnvironmentVariableUpdateParams @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, + private val injectionLocation: JsonField, private val networking: JsonField, private val secretValue: JsonField, private val additionalProperties: MutableMap, @@ -31,13 +32,17 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("injection_location") + @ExcludeMissing + injectionLocation: JsonField = + JsonMissing.of(), @JsonProperty("networking") @ExcludeMissing networking: JsonField = JsonMissing.of(), @JsonProperty("secret_value") @ExcludeMissing secretValue: JsonField = JsonMissing.of(), - ) : this(type, networking, secretValue, mutableMapOf()) + ) : this(type, injectionLocation, networking, secretValue, mutableMapOf()) /** * @throws AnthropicInvalidDataException if the JSON field has an unexpected type or is @@ -45,6 +50,15 @@ private constructor( */ fun type(): Type = type.getRequired("type") + /** + * Updated injection location. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun injectionLocation(): Optional = + injectionLocation.getOptional("injection_location") + /** * Updated networking scope. Full replacement. * @@ -69,6 +83,17 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [injectionLocation]. + * + * Unlike [injectionLocation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("injection_location") + @ExcludeMissing + fun _injectionLocation(): JsonField = + injectionLocation + /** * Returns the raw JSON value of [networking]. * @@ -117,6 +142,8 @@ private constructor( class Builder internal constructor() { private var type: JsonField? = null + private var injectionLocation: JsonField = + JsonMissing.of() private var networking: JsonField = JsonMissing.of() private var secretValue: JsonField = JsonMissing.of() @@ -128,6 +155,7 @@ private constructor( BetaManagedAgentsEnvironmentVariableUpdateParams ) = apply { type = betaManagedAgentsEnvironmentVariableUpdateParams.type + injectionLocation = betaManagedAgentsEnvironmentVariableUpdateParams.injectionLocation networking = betaManagedAgentsEnvironmentVariableUpdateParams.networking secretValue = betaManagedAgentsEnvironmentVariableUpdateParams.secretValue additionalProperties = @@ -144,6 +172,21 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** Updated injection location. */ + fun injectionLocation(injectionLocation: BetaManagedAgentsInjectionLocationUpdateParams) = + injectionLocation(JsonField.of(injectionLocation)) + + /** + * Sets [Builder.injectionLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.injectionLocation] with a well-typed + * [BetaManagedAgentsInjectionLocationUpdateParams] value instead. This method is primarily + * for setting the field to an undocumented or not yet supported value. + */ + fun injectionLocation( + injectionLocation: JsonField + ) = apply { this.injectionLocation = injectionLocation } + /** Updated networking scope. Full replacement. */ fun networking(networking: BetaManagedAgentsCredentialNetworkingParams?) = networking(JsonField.ofNullable(networking)) @@ -243,6 +286,7 @@ private constructor( fun build(): BetaManagedAgentsEnvironmentVariableUpdateParams = BetaManagedAgentsEnvironmentVariableUpdateParams( checkRequired("type", type), + injectionLocation, networking, secretValue, additionalProperties.toMutableMap(), @@ -265,6 +309,7 @@ private constructor( } type().validate() + injectionLocation().ifPresent { it.validate() } networking().ifPresent { it.validate() } secretValue() validated = true @@ -286,6 +331,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (type.asKnown().getOrNull()?.validity() ?: 0) + + (injectionLocation.asKnown().getOrNull()?.validity() ?: 0) + (networking.asKnown().getOrNull()?.validity() ?: 0) + (if (secretValue.asKnown().isPresent) 1 else 0) @@ -426,17 +472,18 @@ private constructor( return other is BetaManagedAgentsEnvironmentVariableUpdateParams && type == other.type && + injectionLocation == other.injectionLocation && networking == other.networking && secretValue == other.secretValue && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(type, networking, secretValue, additionalProperties) + Objects.hash(type, injectionLocation, networking, secretValue, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "BetaManagedAgentsEnvironmentVariableUpdateParams{type=$type, networking=$networking, secretValue=$secretValue, additionalProperties=$additionalProperties}" + "BetaManagedAgentsEnvironmentVariableUpdateParams{type=$type, injectionLocation=$injectionLocation, networking=$networking, secretValue=$secretValue, additionalProperties=$additionalProperties}" } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationParams.kt new file mode 100644 index 000000000..beed4eb9d --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationParams.kt @@ -0,0 +1,209 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.vaults.credentials + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects +import java.util.Optional + +/** Where in the outbound request the secret value may be substituted. */ +class BetaManagedAgentsInjectionLocationParams +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val body: JsonField, + private val header: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("body") @ExcludeMissing body: JsonField = JsonMissing.of(), + @JsonProperty("header") @ExcludeMissing header: JsonField = JsonMissing.of(), + ) : this(body, header, mutableMapOf()) + + /** + * Substitute when the placeholder appears in the request body. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun body(): Optional = body.getOptional("body") + + /** + * Substitute when the placeholder appears in a request header value. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun header(): Optional = header.getOptional("header") + + /** + * Returns the raw JSON value of [body]. + * + * Unlike [body], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("body") @ExcludeMissing fun _body(): JsonField = body + + /** + * Returns the raw JSON value of [header]. + * + * Unlike [header], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("header") @ExcludeMissing fun _header(): JsonField = header + + @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 + * [BetaManagedAgentsInjectionLocationParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsInjectionLocationParams]. */ + class Builder internal constructor() { + + private var body: JsonField = JsonMissing.of() + private var header: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaManagedAgentsInjectionLocationParams: BetaManagedAgentsInjectionLocationParams + ) = apply { + body = betaManagedAgentsInjectionLocationParams.body + header = betaManagedAgentsInjectionLocationParams.header + additionalProperties = + betaManagedAgentsInjectionLocationParams.additionalProperties.toMutableMap() + } + + /** Substitute when the placeholder appears in the request body. */ + fun body(body: Boolean) = body(JsonField.of(body)) + + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun body(body: JsonField) = apply { this.body = body } + + /** Substitute when the placeholder appears in a request header value. */ + fun header(header: Boolean) = header(JsonField.of(header)) + + /** + * Sets [Builder.header] to an arbitrary JSON value. + * + * You should usually call [Builder.header] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun header(header: JsonField) = apply { this.header = header } + + 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 [BetaManagedAgentsInjectionLocationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BetaManagedAgentsInjectionLocationParams = + BetaManagedAgentsInjectionLocationParams( + body, + header, + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsInjectionLocationParams = apply { + if (validated) { + return@apply + } + + body() + header() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 (body.asKnown().isPresent) 1 else 0) + (if (header.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaManagedAgentsInjectionLocationParams && + body == other.body && + header == other.header && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(body, header, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsInjectionLocationParams{body=$body, header=$header, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationResponse.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationResponse.kt new file mode 100644 index 000000000..3fef66066 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationResponse.kt @@ -0,0 +1,223 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.vaults.credentials + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +/** Where in the outbound request the secret value is substituted. */ +class BetaManagedAgentsInjectionLocationResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val body: JsonField, + private val header: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("body") @ExcludeMissing body: JsonField = JsonMissing.of(), + @JsonProperty("header") @ExcludeMissing header: JsonField = JsonMissing.of(), + ) : this(body, header, mutableMapOf()) + + /** + * Whether the placeholder is substituted in the request body. + * + * @throws AnthropicInvalidDataException 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 body(): Boolean = body.getRequired("body") + + /** + * Whether the placeholder is substituted in request header values. + * + * @throws AnthropicInvalidDataException 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 header(): Boolean = header.getRequired("header") + + /** + * Returns the raw JSON value of [body]. + * + * Unlike [body], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("body") @ExcludeMissing fun _body(): JsonField = body + + /** + * Returns the raw JSON value of [header]. + * + * Unlike [header], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("header") @ExcludeMissing fun _header(): JsonField = header + + @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 + * [BetaManagedAgentsInjectionLocationResponse]. + * + * The following fields are required: + * ```java + * .body() + * .header() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsInjectionLocationResponse]. */ + class Builder internal constructor() { + + private var body: JsonField? = null + private var header: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaManagedAgentsInjectionLocationResponse: BetaManagedAgentsInjectionLocationResponse + ) = apply { + body = betaManagedAgentsInjectionLocationResponse.body + header = betaManagedAgentsInjectionLocationResponse.header + additionalProperties = + betaManagedAgentsInjectionLocationResponse.additionalProperties.toMutableMap() + } + + /** Whether the placeholder is substituted in the request body. */ + fun body(body: Boolean) = body(JsonField.of(body)) + + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun body(body: JsonField) = apply { this.body = body } + + /** Whether the placeholder is substituted in request header values. */ + fun header(header: Boolean) = header(JsonField.of(header)) + + /** + * Sets [Builder.header] to an arbitrary JSON value. + * + * You should usually call [Builder.header] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun header(header: JsonField) = apply { this.header = header } + + 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 [BetaManagedAgentsInjectionLocationResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .body() + * .header() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaManagedAgentsInjectionLocationResponse = + BetaManagedAgentsInjectionLocationResponse( + checkRequired("body", body), + checkRequired("header", header), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsInjectionLocationResponse = apply { + if (validated) { + return@apply + } + + body() + header() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 (body.asKnown().isPresent) 1 else 0) + (if (header.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaManagedAgentsInjectionLocationResponse && + body == other.body && + header == other.header && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(body, header, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsInjectionLocationResponse{body=$body, header=$header, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationUpdateParams.kt new file mode 100644 index 000000000..7d46ccba8 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationUpdateParams.kt @@ -0,0 +1,210 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.vaults.credentials + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects +import java.util.Optional + +/** Updated injection location. */ +class BetaManagedAgentsInjectionLocationUpdateParams +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val body: JsonField, + private val header: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("body") @ExcludeMissing body: JsonField = JsonMissing.of(), + @JsonProperty("header") @ExcludeMissing header: JsonField = JsonMissing.of(), + ) : this(body, header, mutableMapOf()) + + /** + * Substitute when the placeholder appears in the request body. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun body(): Optional = body.getOptional("body") + + /** + * Substitute when the placeholder appears in a request header value. + * + * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun header(): Optional = header.getOptional("header") + + /** + * Returns the raw JSON value of [body]. + * + * Unlike [body], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("body") @ExcludeMissing fun _body(): JsonField = body + + /** + * Returns the raw JSON value of [header]. + * + * Unlike [header], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("header") @ExcludeMissing fun _header(): JsonField = header + + @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 + * [BetaManagedAgentsInjectionLocationUpdateParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaManagedAgentsInjectionLocationUpdateParams]. */ + class Builder internal constructor() { + + private var body: JsonField = JsonMissing.of() + private var header: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaManagedAgentsInjectionLocationUpdateParams: + BetaManagedAgentsInjectionLocationUpdateParams + ) = apply { + body = betaManagedAgentsInjectionLocationUpdateParams.body + header = betaManagedAgentsInjectionLocationUpdateParams.header + additionalProperties = + betaManagedAgentsInjectionLocationUpdateParams.additionalProperties.toMutableMap() + } + + /** Substitute when the placeholder appears in the request body. */ + fun body(body: Boolean) = body(JsonField.of(body)) + + /** + * Sets [Builder.body] to an arbitrary JSON value. + * + * You should usually call [Builder.body] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun body(body: JsonField) = apply { this.body = body } + + /** Substitute when the placeholder appears in a request header value. */ + fun header(header: Boolean) = header(JsonField.of(header)) + + /** + * Sets [Builder.header] to an arbitrary JSON value. + * + * You should usually call [Builder.header] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun header(header: JsonField) = apply { this.header = header } + + 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 [BetaManagedAgentsInjectionLocationUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BetaManagedAgentsInjectionLocationUpdateParams = + BetaManagedAgentsInjectionLocationUpdateParams( + body, + header, + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaManagedAgentsInjectionLocationUpdateParams = apply { + if (validated) { + return@apply + } + + body() + header() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 (body.asKnown().isPresent) 1 else 0) + (if (header.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaManagedAgentsInjectionLocationUpdateParams && + body == other.body && + header == other.header && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(body, header, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaManagedAgentsInjectionLocationUpdateParams{body=$body, header=$header, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentArchivedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentArchivedEventData.kt new file mode 100644 index 000000000..59245c1e2 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentArchivedEventData.kt @@ -0,0 +1,303 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookAgentArchivedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the agent that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("agent.archived") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookAgentArchivedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookAgentArchivedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("agent.archived") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaWebhookAgentArchivedEventData: BetaWebhookAgentArchivedEventData) = + apply { + id = betaWebhookAgentArchivedEventData.id + organizationId = betaWebhookAgentArchivedEventData.organizationId + type = betaWebhookAgentArchivedEventData.type + workspaceId = betaWebhookAgentArchivedEventData.workspaceId + additionalProperties = + betaWebhookAgentArchivedEventData.additionalProperties.toMutableMap() + } + + /** ID of the agent that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("agent.archived") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookAgentArchivedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookAgentArchivedEventData = + BetaWebhookAgentArchivedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookAgentArchivedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("agent.archived")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("agent.archived")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookAgentArchivedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookAgentArchivedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentCreatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentCreatedEventData.kt new file mode 100644 index 000000000..50c294e18 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentCreatedEventData.kt @@ -0,0 +1,303 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookAgentCreatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the agent that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("agent.created") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookAgentCreatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookAgentCreatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("agent.created") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaWebhookAgentCreatedEventData: BetaWebhookAgentCreatedEventData) = + apply { + id = betaWebhookAgentCreatedEventData.id + organizationId = betaWebhookAgentCreatedEventData.organizationId + type = betaWebhookAgentCreatedEventData.type + workspaceId = betaWebhookAgentCreatedEventData.workspaceId + additionalProperties = + betaWebhookAgentCreatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the agent that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("agent.created") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookAgentCreatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookAgentCreatedEventData = + BetaWebhookAgentCreatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookAgentCreatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("agent.created")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("agent.created")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookAgentCreatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookAgentCreatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentDeletedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentDeletedEventData.kt new file mode 100644 index 000000000..7f13868e8 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentDeletedEventData.kt @@ -0,0 +1,303 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookAgentDeletedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the agent that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("agent.deleted") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookAgentDeletedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookAgentDeletedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("agent.deleted") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaWebhookAgentDeletedEventData: BetaWebhookAgentDeletedEventData) = + apply { + id = betaWebhookAgentDeletedEventData.id + organizationId = betaWebhookAgentDeletedEventData.organizationId + type = betaWebhookAgentDeletedEventData.type + workspaceId = betaWebhookAgentDeletedEventData.workspaceId + additionalProperties = + betaWebhookAgentDeletedEventData.additionalProperties.toMutableMap() + } + + /** ID of the agent that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("agent.deleted") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookAgentDeletedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookAgentDeletedEventData = + BetaWebhookAgentDeletedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookAgentDeletedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("agent.deleted")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("agent.deleted")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookAgentDeletedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookAgentDeletedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentUpdatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentUpdatedEventData.kt new file mode 100644 index 000000000..dc9892905 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentUpdatedEventData.kt @@ -0,0 +1,303 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookAgentUpdatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the agent that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("agent.updated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookAgentUpdatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookAgentUpdatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("agent.updated") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(betaWebhookAgentUpdatedEventData: BetaWebhookAgentUpdatedEventData) = + apply { + id = betaWebhookAgentUpdatedEventData.id + organizationId = betaWebhookAgentUpdatedEventData.organizationId + type = betaWebhookAgentUpdatedEventData.type + workspaceId = betaWebhookAgentUpdatedEventData.workspaceId + additionalProperties = + betaWebhookAgentUpdatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the agent that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("agent.updated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookAgentUpdatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookAgentUpdatedEventData = + BetaWebhookAgentUpdatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookAgentUpdatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("agent.updated")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("agent.updated")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookAgentUpdatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookAgentUpdatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentArchivedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentArchivedEventData.kt new file mode 100644 index 000000000..2fc633b80 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentArchivedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentArchivedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment.archived") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentArchivedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentArchivedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment.archived") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentArchivedEventData: BetaWebhookDeploymentArchivedEventData + ) = apply { + id = betaWebhookDeploymentArchivedEventData.id + organizationId = betaWebhookDeploymentArchivedEventData.organizationId + type = betaWebhookDeploymentArchivedEventData.type + workspaceId = betaWebhookDeploymentArchivedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentArchivedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment.archived") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentArchivedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentArchivedEventData = + BetaWebhookDeploymentArchivedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentArchivedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment.archived")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment.archived")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentArchivedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentArchivedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentCreatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentCreatedEventData.kt new file mode 100644 index 000000000..70ac9f563 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentCreatedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentCreatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment.created") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentCreatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentCreatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment.created") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentCreatedEventData: BetaWebhookDeploymentCreatedEventData + ) = apply { + id = betaWebhookDeploymentCreatedEventData.id + organizationId = betaWebhookDeploymentCreatedEventData.organizationId + type = betaWebhookDeploymentCreatedEventData.type + workspaceId = betaWebhookDeploymentCreatedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentCreatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment.created") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentCreatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentCreatedEventData = + BetaWebhookDeploymentCreatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentCreatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment.created")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment.created")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentCreatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentCreatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentDeletedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentDeletedEventData.kt new file mode 100644 index 000000000..9e8266909 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentDeletedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentDeletedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment.deleted") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentDeletedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentDeletedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment.deleted") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentDeletedEventData: BetaWebhookDeploymentDeletedEventData + ) = apply { + id = betaWebhookDeploymentDeletedEventData.id + organizationId = betaWebhookDeploymentDeletedEventData.organizationId + type = betaWebhookDeploymentDeletedEventData.type + workspaceId = betaWebhookDeploymentDeletedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentDeletedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment.deleted") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentDeletedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentDeletedEventData = + BetaWebhookDeploymentDeletedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentDeletedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment.deleted")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment.deleted")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentDeletedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentDeletedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentPausedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentPausedEventData.kt new file mode 100644 index 000000000..32c106d94 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentPausedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentPausedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment.paused") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentPausedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentPausedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment.paused") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentPausedEventData: BetaWebhookDeploymentPausedEventData + ) = apply { + id = betaWebhookDeploymentPausedEventData.id + organizationId = betaWebhookDeploymentPausedEventData.organizationId + type = betaWebhookDeploymentPausedEventData.type + workspaceId = betaWebhookDeploymentPausedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentPausedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment.paused") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentPausedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentPausedEventData = + BetaWebhookDeploymentPausedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentPausedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment.paused")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment.paused")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentPausedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentPausedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunFailedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunFailedEventData.kt new file mode 100644 index 000000000..39e2f25c3 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunFailedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentRunFailedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment run that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment_run.failed") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentRunFailedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentRunFailedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment_run.failed") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentRunFailedEventData: BetaWebhookDeploymentRunFailedEventData + ) = apply { + id = betaWebhookDeploymentRunFailedEventData.id + organizationId = betaWebhookDeploymentRunFailedEventData.organizationId + type = betaWebhookDeploymentRunFailedEventData.type + workspaceId = betaWebhookDeploymentRunFailedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentRunFailedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment run that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment_run.failed") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentRunFailedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentRunFailedEventData = + BetaWebhookDeploymentRunFailedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentRunFailedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment_run.failed")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment_run.failed")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentRunFailedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentRunFailedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunStartedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunStartedEventData.kt new file mode 100644 index 000000000..56a7901a6 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunStartedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentRunStartedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment run that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment_run.started") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentRunStartedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentRunStartedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment_run.started") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentRunStartedEventData: BetaWebhookDeploymentRunStartedEventData + ) = apply { + id = betaWebhookDeploymentRunStartedEventData.id + organizationId = betaWebhookDeploymentRunStartedEventData.organizationId + type = betaWebhookDeploymentRunStartedEventData.type + workspaceId = betaWebhookDeploymentRunStartedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentRunStartedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment run that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment_run.started") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentRunStartedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentRunStartedEventData = + BetaWebhookDeploymentRunStartedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentRunStartedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment_run.started")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment_run.started")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentRunStartedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentRunStartedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunSucceededEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunSucceededEventData.kt new file mode 100644 index 000000000..c0c5a1788 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunSucceededEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentRunSucceededEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment run that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment_run.succeeded") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentRunSucceededEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentRunSucceededEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment_run.succeeded") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentRunSucceededEventData: BetaWebhookDeploymentRunSucceededEventData + ) = apply { + id = betaWebhookDeploymentRunSucceededEventData.id + organizationId = betaWebhookDeploymentRunSucceededEventData.organizationId + type = betaWebhookDeploymentRunSucceededEventData.type + workspaceId = betaWebhookDeploymentRunSucceededEventData.workspaceId + additionalProperties = + betaWebhookDeploymentRunSucceededEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment run that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment_run.succeeded") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentRunSucceededEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentRunSucceededEventData = + BetaWebhookDeploymentRunSucceededEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentRunSucceededEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment_run.succeeded")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment_run.succeeded")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentRunSucceededEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentRunSucceededEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUnpausedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUnpausedEventData.kt new file mode 100644 index 000000000..024fdd3d2 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUnpausedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentUnpausedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment.unpaused") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentUnpausedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentUnpausedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment.unpaused") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentUnpausedEventData: BetaWebhookDeploymentUnpausedEventData + ) = apply { + id = betaWebhookDeploymentUnpausedEventData.id + organizationId = betaWebhookDeploymentUnpausedEventData.organizationId + type = betaWebhookDeploymentUnpausedEventData.type + workspaceId = betaWebhookDeploymentUnpausedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentUnpausedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment.unpaused") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentUnpausedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentUnpausedEventData = + BetaWebhookDeploymentUnpausedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentUnpausedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment.unpaused")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment.unpaused")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentUnpausedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentUnpausedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUpdatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUpdatedEventData.kt new file mode 100644 index 000000000..878726edc --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUpdatedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookDeploymentUpdatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the deployment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("deployment.updated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookDeploymentUpdatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookDeploymentUpdatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("deployment.updated") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookDeploymentUpdatedEventData: BetaWebhookDeploymentUpdatedEventData + ) = apply { + id = betaWebhookDeploymentUpdatedEventData.id + organizationId = betaWebhookDeploymentUpdatedEventData.organizationId + type = betaWebhookDeploymentUpdatedEventData.type + workspaceId = betaWebhookDeploymentUpdatedEventData.workspaceId + additionalProperties = + betaWebhookDeploymentUpdatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the deployment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("deployment.updated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookDeploymentUpdatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookDeploymentUpdatedEventData = + BetaWebhookDeploymentUpdatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookDeploymentUpdatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("deployment.updated")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("deployment.updated")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookDeploymentUpdatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookDeploymentUpdatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentArchivedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentArchivedEventData.kt new file mode 100644 index 000000000..d0229556a --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentArchivedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookEnvironmentArchivedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the environment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("environment.archived") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookEnvironmentArchivedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookEnvironmentArchivedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("environment.archived") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookEnvironmentArchivedEventData: BetaWebhookEnvironmentArchivedEventData + ) = apply { + id = betaWebhookEnvironmentArchivedEventData.id + organizationId = betaWebhookEnvironmentArchivedEventData.organizationId + type = betaWebhookEnvironmentArchivedEventData.type + workspaceId = betaWebhookEnvironmentArchivedEventData.workspaceId + additionalProperties = + betaWebhookEnvironmentArchivedEventData.additionalProperties.toMutableMap() + } + + /** ID of the environment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("environment.archived") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookEnvironmentArchivedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookEnvironmentArchivedEventData = + BetaWebhookEnvironmentArchivedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookEnvironmentArchivedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("environment.archived")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("environment.archived")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookEnvironmentArchivedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookEnvironmentArchivedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentCreatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentCreatedEventData.kt new file mode 100644 index 000000000..4ce80fbe8 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentCreatedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookEnvironmentCreatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the environment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("environment.created") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookEnvironmentCreatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookEnvironmentCreatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("environment.created") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookEnvironmentCreatedEventData: BetaWebhookEnvironmentCreatedEventData + ) = apply { + id = betaWebhookEnvironmentCreatedEventData.id + organizationId = betaWebhookEnvironmentCreatedEventData.organizationId + type = betaWebhookEnvironmentCreatedEventData.type + workspaceId = betaWebhookEnvironmentCreatedEventData.workspaceId + additionalProperties = + betaWebhookEnvironmentCreatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the environment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("environment.created") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookEnvironmentCreatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookEnvironmentCreatedEventData = + BetaWebhookEnvironmentCreatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookEnvironmentCreatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("environment.created")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("environment.created")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookEnvironmentCreatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookEnvironmentCreatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventData.kt new file mode 100644 index 000000000..2a898a6ec --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventData.kt @@ -0,0 +1,308 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class BetaWebhookEnvironmentDeletedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the environment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * @throws AnthropicInvalidDataException 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(): BetaWebhookEnvironmentDeletedEventType = type.getRequired("type") + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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 + + /** + * 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) { + 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 + * [BetaWebhookEnvironmentDeletedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookEnvironmentDeletedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookEnvironmentDeletedEventData: BetaWebhookEnvironmentDeletedEventData + ) = apply { + id = betaWebhookEnvironmentDeletedEventData.id + organizationId = betaWebhookEnvironmentDeletedEventData.organizationId + type = betaWebhookEnvironmentDeletedEventData.type + workspaceId = betaWebhookEnvironmentDeletedEventData.workspaceId + additionalProperties = + betaWebhookEnvironmentDeletedEventData.additionalProperties.toMutableMap() + } + + /** ID of the environment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + fun type(type: BetaWebhookEnvironmentDeletedEventType) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [BetaWebhookEnvironmentDeletedEventType] 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 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() + 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 [BetaWebhookEnvironmentDeletedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookEnvironmentDeletedEventData = + BetaWebhookEnvironmentDeletedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookEnvironmentDeletedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + type().validate() + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookEnvironmentDeletedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookEnvironmentDeletedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventType.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventType.kt new file mode 100644 index 000000000..e354b861e --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventType.kt @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.Enum +import com.anthropic.core.JsonField +import com.anthropic.errors.AnthropicInvalidDataException +import com.fasterxml.jackson.annotation.JsonCreator + +class BetaWebhookEnvironmentDeletedEventType +@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 ENVIRONMENT_DELETED = of("environment.deleted") + + @JvmStatic + fun of(value: String) = BetaWebhookEnvironmentDeletedEventType(JsonField.of(value)) + } + + /** An enum containing [BetaWebhookEnvironmentDeletedEventType]'s known values. */ + enum class Known { + ENVIRONMENT_DELETED + } + + /** + * An enum containing [BetaWebhookEnvironmentDeletedEventType]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [BetaWebhookEnvironmentDeletedEventType] 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 { + ENVIRONMENT_DELETED, + /** + * An enum member indicating that [BetaWebhookEnvironmentDeletedEventType] 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) { + ENVIRONMENT_DELETED -> Value.ENVIRONMENT_DELETED + 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 AnthropicInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + ENVIRONMENT_DELETED -> Known.ENVIRONMENT_DELETED + else -> + throw AnthropicInvalidDataException( + "Unknown BetaWebhookEnvironmentDeletedEventType: $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 AnthropicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { AnthropicInvalidDataException("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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookEnvironmentDeletedEventType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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 BetaWebhookEnvironmentDeletedEventType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentUpdatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentUpdatedEventData.kt new file mode 100644 index 000000000..881386cab --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentUpdatedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookEnvironmentUpdatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the environment that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("environment.updated") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookEnvironmentUpdatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookEnvironmentUpdatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("environment.updated") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookEnvironmentUpdatedEventData: BetaWebhookEnvironmentUpdatedEventData + ) = apply { + id = betaWebhookEnvironmentUpdatedEventData.id + organizationId = betaWebhookEnvironmentUpdatedEventData.organizationId + type = betaWebhookEnvironmentUpdatedEventData.type + workspaceId = betaWebhookEnvironmentUpdatedEventData.workspaceId + additionalProperties = + betaWebhookEnvironmentUpdatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the environment that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("environment.updated") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookEnvironmentUpdatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookEnvironmentUpdatedEventData = + BetaWebhookEnvironmentUpdatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookEnvironmentUpdatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("environment.updated")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("environment.updated")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookEnvironmentUpdatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookEnvironmentUpdatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEvent.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEvent.kt index f7094041a..c8a0e8353 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEvent.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEvent.kt @@ -321,6 +321,134 @@ private constructor( fun data(sessionUpdated: BetaWebhookSessionUpdatedEventData) = data(BetaWebhookEventData.ofSessionUpdated(sessionUpdated)) + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentCreated(agentCreated)`. */ + fun data(agentCreated: BetaWebhookAgentCreatedEventData) = + data(BetaWebhookEventData.ofAgentCreated(agentCreated)) + + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentArchived(agentArchived)`. */ + fun data(agentArchived: BetaWebhookAgentArchivedEventData) = + data(BetaWebhookEventData.ofAgentArchived(agentArchived)) + + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentDeleted(agentDeleted)`. */ + fun data(agentDeleted: BetaWebhookAgentDeletedEventData) = + data(BetaWebhookEventData.ofAgentDeleted(agentDeleted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentPaused(deploymentPaused)`. + */ + fun data(deploymentPaused: BetaWebhookDeploymentPausedEventData) = + data(BetaWebhookEventData.ofDeploymentPaused(deploymentPaused)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentRunFailed(deploymentRunFailed)`. + */ + fun data(deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData) = + data(BetaWebhookEventData.ofDeploymentRunFailed(deploymentRunFailed)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentCreated(deploymentCreated)`. + */ + fun data(deploymentCreated: BetaWebhookDeploymentCreatedEventData) = + data(BetaWebhookEventData.ofDeploymentCreated(deploymentCreated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentUpdated(deploymentUpdated)`. + */ + fun data(deploymentUpdated: BetaWebhookDeploymentUpdatedEventData) = + data(BetaWebhookEventData.ofDeploymentUpdated(deploymentUpdated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentUnpaused(deploymentUnpaused)`. + */ + fun data(deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData) = + data(BetaWebhookEventData.ofDeploymentUnpaused(deploymentUnpaused)) + + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentUpdated(agentUpdated)`. */ + fun data(agentUpdated: BetaWebhookAgentUpdatedEventData) = + data(BetaWebhookEventData.ofAgentUpdated(agentUpdated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentArchived(deploymentArchived)`. + */ + fun data(deploymentArchived: BetaWebhookDeploymentArchivedEventData) = + data(BetaWebhookEventData.ofDeploymentArchived(deploymentArchived)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentRunStarted(deploymentRunStarted)`. + */ + fun data(deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData) = + data(BetaWebhookEventData.ofDeploymentRunStarted(deploymentRunStarted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentDeleted(deploymentDeleted)`. + */ + fun data(deploymentDeleted: BetaWebhookDeploymentDeletedEventData) = + data(BetaWebhookEventData.ofDeploymentDeleted(deploymentDeleted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentRunSucceeded(deploymentRunSucceeded)`. + */ + fun data(deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData) = + data(BetaWebhookEventData.ofDeploymentRunSucceeded(deploymentRunSucceeded)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentCreated(environmentCreated)`. + */ + fun data(environmentCreated: BetaWebhookEnvironmentCreatedEventData) = + data(BetaWebhookEventData.ofEnvironmentCreated(environmentCreated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentUpdated(environmentUpdated)`. + */ + fun data(environmentUpdated: BetaWebhookEnvironmentUpdatedEventData) = + data(BetaWebhookEventData.ofEnvironmentUpdated(environmentUpdated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentArchived(environmentArchived)`. + */ + fun data(environmentArchived: BetaWebhookEnvironmentArchivedEventData) = + data(BetaWebhookEventData.ofEnvironmentArchived(environmentArchived)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentDeleted(environmentDeleted)`. + */ + fun data(environmentDeleted: BetaWebhookEnvironmentDeletedEventData) = + data(BetaWebhookEventData.ofEnvironmentDeleted(environmentDeleted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofMemoryStoreCreated(memoryStoreCreated)`. + */ + fun data(memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData) = + data(BetaWebhookEventData.ofMemoryStoreCreated(memoryStoreCreated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofMemoryStoreArchived(memoryStoreArchived)`. + */ + fun data(memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData) = + data(BetaWebhookEventData.ofMemoryStoreArchived(memoryStoreArchived)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofMemoryStoreDeleted(memoryStoreDeleted)`. + */ + fun data(memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData) = + data(BetaWebhookEventData.ofMemoryStoreDeleted(memoryStoreDeleted)) + /** * Sets the field to an arbitrary JSON value. * diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventData.kt index 1c95894c9..6b8ef15cb 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventData.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventData.kt @@ -47,6 +47,26 @@ private constructor( private val vaultCredentialRefreshFailed: BetaWebhookVaultCredentialRefreshFailedEventData? = null, private val sessionUpdated: BetaWebhookSessionUpdatedEventData? = null, + private val agentCreated: BetaWebhookAgentCreatedEventData? = null, + private val agentArchived: BetaWebhookAgentArchivedEventData? = null, + private val agentDeleted: BetaWebhookAgentDeletedEventData? = null, + private val deploymentPaused: BetaWebhookDeploymentPausedEventData? = null, + private val deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData? = null, + private val deploymentCreated: BetaWebhookDeploymentCreatedEventData? = null, + private val deploymentUpdated: BetaWebhookDeploymentUpdatedEventData? = null, + private val deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData? = null, + private val agentUpdated: BetaWebhookAgentUpdatedEventData? = null, + private val deploymentArchived: BetaWebhookDeploymentArchivedEventData? = null, + private val deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData? = null, + private val deploymentDeleted: BetaWebhookDeploymentDeletedEventData? = null, + private val deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData? = null, + private val environmentCreated: BetaWebhookEnvironmentCreatedEventData? = null, + private val environmentUpdated: BetaWebhookEnvironmentUpdatedEventData? = null, + private val environmentArchived: BetaWebhookEnvironmentArchivedEventData? = null, + private val environmentDeleted: BetaWebhookEnvironmentDeletedEventData? = null, + private val memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData? = null, + private val memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData? = null, + private val memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData? = null, private val _json: JsonValue? = null, ) { @@ -120,6 +140,66 @@ private constructor( fun sessionUpdated(): Optional = Optional.ofNullable(sessionUpdated) + fun agentCreated(): Optional = + Optional.ofNullable(agentCreated) + + fun agentArchived(): Optional = + Optional.ofNullable(agentArchived) + + fun agentDeleted(): Optional = + Optional.ofNullable(agentDeleted) + + fun deploymentPaused(): Optional = + Optional.ofNullable(deploymentPaused) + + fun deploymentRunFailed(): Optional = + Optional.ofNullable(deploymentRunFailed) + + fun deploymentCreated(): Optional = + Optional.ofNullable(deploymentCreated) + + fun deploymentUpdated(): Optional = + Optional.ofNullable(deploymentUpdated) + + fun deploymentUnpaused(): Optional = + Optional.ofNullable(deploymentUnpaused) + + fun agentUpdated(): Optional = + Optional.ofNullable(agentUpdated) + + fun deploymentArchived(): Optional = + Optional.ofNullable(deploymentArchived) + + fun deploymentRunStarted(): Optional = + Optional.ofNullable(deploymentRunStarted) + + fun deploymentDeleted(): Optional = + Optional.ofNullable(deploymentDeleted) + + fun deploymentRunSucceeded(): Optional = + Optional.ofNullable(deploymentRunSucceeded) + + fun environmentCreated(): Optional = + Optional.ofNullable(environmentCreated) + + fun environmentUpdated(): Optional = + Optional.ofNullable(environmentUpdated) + + fun environmentArchived(): Optional = + Optional.ofNullable(environmentArchived) + + fun environmentDeleted(): Optional = + Optional.ofNullable(environmentDeleted) + + fun memoryStoreCreated(): Optional = + Optional.ofNullable(memoryStoreCreated) + + fun memoryStoreArchived(): Optional = + Optional.ofNullable(memoryStoreArchived) + + fun memoryStoreDeleted(): Optional = + Optional.ofNullable(memoryStoreDeleted) + fun isSessionCreated(): Boolean = sessionCreated != null fun isSessionPending(): Boolean = sessionPending != null @@ -166,6 +246,46 @@ private constructor( fun isSessionUpdated(): Boolean = sessionUpdated != null + fun isAgentCreated(): Boolean = agentCreated != null + + fun isAgentArchived(): Boolean = agentArchived != null + + fun isAgentDeleted(): Boolean = agentDeleted != null + + fun isDeploymentPaused(): Boolean = deploymentPaused != null + + fun isDeploymentRunFailed(): Boolean = deploymentRunFailed != null + + fun isDeploymentCreated(): Boolean = deploymentCreated != null + + fun isDeploymentUpdated(): Boolean = deploymentUpdated != null + + fun isDeploymentUnpaused(): Boolean = deploymentUnpaused != null + + fun isAgentUpdated(): Boolean = agentUpdated != null + + fun isDeploymentArchived(): Boolean = deploymentArchived != null + + fun isDeploymentRunStarted(): Boolean = deploymentRunStarted != null + + fun isDeploymentDeleted(): Boolean = deploymentDeleted != null + + fun isDeploymentRunSucceeded(): Boolean = deploymentRunSucceeded != null + + fun isEnvironmentCreated(): Boolean = environmentCreated != null + + fun isEnvironmentUpdated(): Boolean = environmentUpdated != null + + fun isEnvironmentArchived(): Boolean = environmentArchived != null + + fun isEnvironmentDeleted(): Boolean = environmentDeleted != null + + fun isMemoryStoreCreated(): Boolean = memoryStoreCreated != null + + fun isMemoryStoreArchived(): Boolean = memoryStoreArchived != null + + fun isMemoryStoreDeleted(): Boolean = memoryStoreDeleted != null + fun asSessionCreated(): BetaWebhookSessionCreatedEventData = sessionCreated.getOrThrow("sessionCreated") @@ -232,6 +352,63 @@ private constructor( fun asSessionUpdated(): BetaWebhookSessionUpdatedEventData = sessionUpdated.getOrThrow("sessionUpdated") + fun asAgentCreated(): BetaWebhookAgentCreatedEventData = agentCreated.getOrThrow("agentCreated") + + fun asAgentArchived(): BetaWebhookAgentArchivedEventData = + agentArchived.getOrThrow("agentArchived") + + fun asAgentDeleted(): BetaWebhookAgentDeletedEventData = agentDeleted.getOrThrow("agentDeleted") + + fun asDeploymentPaused(): BetaWebhookDeploymentPausedEventData = + deploymentPaused.getOrThrow("deploymentPaused") + + fun asDeploymentRunFailed(): BetaWebhookDeploymentRunFailedEventData = + deploymentRunFailed.getOrThrow("deploymentRunFailed") + + fun asDeploymentCreated(): BetaWebhookDeploymentCreatedEventData = + deploymentCreated.getOrThrow("deploymentCreated") + + fun asDeploymentUpdated(): BetaWebhookDeploymentUpdatedEventData = + deploymentUpdated.getOrThrow("deploymentUpdated") + + fun asDeploymentUnpaused(): BetaWebhookDeploymentUnpausedEventData = + deploymentUnpaused.getOrThrow("deploymentUnpaused") + + fun asAgentUpdated(): BetaWebhookAgentUpdatedEventData = agentUpdated.getOrThrow("agentUpdated") + + fun asDeploymentArchived(): BetaWebhookDeploymentArchivedEventData = + deploymentArchived.getOrThrow("deploymentArchived") + + fun asDeploymentRunStarted(): BetaWebhookDeploymentRunStartedEventData = + deploymentRunStarted.getOrThrow("deploymentRunStarted") + + fun asDeploymentDeleted(): BetaWebhookDeploymentDeletedEventData = + deploymentDeleted.getOrThrow("deploymentDeleted") + + fun asDeploymentRunSucceeded(): BetaWebhookDeploymentRunSucceededEventData = + deploymentRunSucceeded.getOrThrow("deploymentRunSucceeded") + + fun asEnvironmentCreated(): BetaWebhookEnvironmentCreatedEventData = + environmentCreated.getOrThrow("environmentCreated") + + fun asEnvironmentUpdated(): BetaWebhookEnvironmentUpdatedEventData = + environmentUpdated.getOrThrow("environmentUpdated") + + fun asEnvironmentArchived(): BetaWebhookEnvironmentArchivedEventData = + environmentArchived.getOrThrow("environmentArchived") + + fun asEnvironmentDeleted(): BetaWebhookEnvironmentDeletedEventData = + environmentDeleted.getOrThrow("environmentDeleted") + + fun asMemoryStoreCreated(): BetaWebhookMemoryStoreCreatedEventData = + memoryStoreCreated.getOrThrow("memoryStoreCreated") + + fun asMemoryStoreArchived(): BetaWebhookMemoryStoreArchivedEventData = + memoryStoreArchived.getOrThrow("memoryStoreArchived") + + fun asMemoryStoreDeleted(): BetaWebhookMemoryStoreDeletedEventData = + memoryStoreDeleted.getOrThrow("memoryStoreDeleted") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -298,6 +475,27 @@ private constructor( vaultCredentialRefreshFailed != null -> visitor.visitVaultCredentialRefreshFailed(vaultCredentialRefreshFailed) sessionUpdated != null -> visitor.visitSessionUpdated(sessionUpdated) + agentCreated != null -> visitor.visitAgentCreated(agentCreated) + agentArchived != null -> visitor.visitAgentArchived(agentArchived) + agentDeleted != null -> visitor.visitAgentDeleted(agentDeleted) + deploymentPaused != null -> visitor.visitDeploymentPaused(deploymentPaused) + deploymentRunFailed != null -> visitor.visitDeploymentRunFailed(deploymentRunFailed) + deploymentCreated != null -> visitor.visitDeploymentCreated(deploymentCreated) + deploymentUpdated != null -> visitor.visitDeploymentUpdated(deploymentUpdated) + deploymentUnpaused != null -> visitor.visitDeploymentUnpaused(deploymentUnpaused) + agentUpdated != null -> visitor.visitAgentUpdated(agentUpdated) + deploymentArchived != null -> visitor.visitDeploymentArchived(deploymentArchived) + deploymentRunStarted != null -> visitor.visitDeploymentRunStarted(deploymentRunStarted) + deploymentDeleted != null -> visitor.visitDeploymentDeleted(deploymentDeleted) + deploymentRunSucceeded != null -> + visitor.visitDeploymentRunSucceeded(deploymentRunSucceeded) + environmentCreated != null -> visitor.visitEnvironmentCreated(environmentCreated) + environmentUpdated != null -> visitor.visitEnvironmentUpdated(environmentUpdated) + environmentArchived != null -> visitor.visitEnvironmentArchived(environmentArchived) + environmentDeleted != null -> visitor.visitEnvironmentDeleted(environmentDeleted) + memoryStoreCreated != null -> visitor.visitMemoryStoreCreated(memoryStoreCreated) + memoryStoreArchived != null -> visitor.visitMemoryStoreArchived(memoryStoreArchived) + memoryStoreDeleted != null -> visitor.visitMemoryStoreDeleted(memoryStoreDeleted) else -> visitor.unknown(_json) } @@ -447,6 +645,118 @@ private constructor( ) { sessionUpdated.validate() } + + override fun visitAgentCreated(agentCreated: BetaWebhookAgentCreatedEventData) { + agentCreated.validate() + } + + override fun visitAgentArchived(agentArchived: BetaWebhookAgentArchivedEventData) { + agentArchived.validate() + } + + override fun visitAgentDeleted(agentDeleted: BetaWebhookAgentDeletedEventData) { + agentDeleted.validate() + } + + override fun visitDeploymentPaused( + deploymentPaused: BetaWebhookDeploymentPausedEventData + ) { + deploymentPaused.validate() + } + + override fun visitDeploymentRunFailed( + deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData + ) { + deploymentRunFailed.validate() + } + + override fun visitDeploymentCreated( + deploymentCreated: BetaWebhookDeploymentCreatedEventData + ) { + deploymentCreated.validate() + } + + override fun visitDeploymentUpdated( + deploymentUpdated: BetaWebhookDeploymentUpdatedEventData + ) { + deploymentUpdated.validate() + } + + override fun visitDeploymentUnpaused( + deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData + ) { + deploymentUnpaused.validate() + } + + override fun visitAgentUpdated(agentUpdated: BetaWebhookAgentUpdatedEventData) { + agentUpdated.validate() + } + + override fun visitDeploymentArchived( + deploymentArchived: BetaWebhookDeploymentArchivedEventData + ) { + deploymentArchived.validate() + } + + override fun visitDeploymentRunStarted( + deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData + ) { + deploymentRunStarted.validate() + } + + override fun visitDeploymentDeleted( + deploymentDeleted: BetaWebhookDeploymentDeletedEventData + ) { + deploymentDeleted.validate() + } + + override fun visitDeploymentRunSucceeded( + deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData + ) { + deploymentRunSucceeded.validate() + } + + override fun visitEnvironmentCreated( + environmentCreated: BetaWebhookEnvironmentCreatedEventData + ) { + environmentCreated.validate() + } + + override fun visitEnvironmentUpdated( + environmentUpdated: BetaWebhookEnvironmentUpdatedEventData + ) { + environmentUpdated.validate() + } + + override fun visitEnvironmentArchived( + environmentArchived: BetaWebhookEnvironmentArchivedEventData + ) { + environmentArchived.validate() + } + + override fun visitEnvironmentDeleted( + environmentDeleted: BetaWebhookEnvironmentDeletedEventData + ) { + environmentDeleted.validate() + } + + override fun visitMemoryStoreCreated( + memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData + ) { + memoryStoreCreated.validate() + } + + override fun visitMemoryStoreArchived( + memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData + ) { + memoryStoreArchived.validate() + } + + override fun visitMemoryStoreDeleted( + memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData + ) { + memoryStoreDeleted.validate() + } } ) validated = true @@ -557,6 +867,82 @@ private constructor( sessionUpdated: BetaWebhookSessionUpdatedEventData ) = sessionUpdated.validity() + override fun visitAgentCreated(agentCreated: BetaWebhookAgentCreatedEventData) = + agentCreated.validity() + + override fun visitAgentArchived(agentArchived: BetaWebhookAgentArchivedEventData) = + agentArchived.validity() + + override fun visitAgentDeleted(agentDeleted: BetaWebhookAgentDeletedEventData) = + agentDeleted.validity() + + override fun visitDeploymentPaused( + deploymentPaused: BetaWebhookDeploymentPausedEventData + ) = deploymentPaused.validity() + + override fun visitDeploymentRunFailed( + deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData + ) = deploymentRunFailed.validity() + + override fun visitDeploymentCreated( + deploymentCreated: BetaWebhookDeploymentCreatedEventData + ) = deploymentCreated.validity() + + override fun visitDeploymentUpdated( + deploymentUpdated: BetaWebhookDeploymentUpdatedEventData + ) = deploymentUpdated.validity() + + override fun visitDeploymentUnpaused( + deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData + ) = deploymentUnpaused.validity() + + override fun visitAgentUpdated(agentUpdated: BetaWebhookAgentUpdatedEventData) = + agentUpdated.validity() + + override fun visitDeploymentArchived( + deploymentArchived: BetaWebhookDeploymentArchivedEventData + ) = deploymentArchived.validity() + + override fun visitDeploymentRunStarted( + deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData + ) = deploymentRunStarted.validity() + + override fun visitDeploymentDeleted( + deploymentDeleted: BetaWebhookDeploymentDeletedEventData + ) = deploymentDeleted.validity() + + override fun visitDeploymentRunSucceeded( + deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData + ) = deploymentRunSucceeded.validity() + + override fun visitEnvironmentCreated( + environmentCreated: BetaWebhookEnvironmentCreatedEventData + ) = environmentCreated.validity() + + override fun visitEnvironmentUpdated( + environmentUpdated: BetaWebhookEnvironmentUpdatedEventData + ) = environmentUpdated.validity() + + override fun visitEnvironmentArchived( + environmentArchived: BetaWebhookEnvironmentArchivedEventData + ) = environmentArchived.validity() + + override fun visitEnvironmentDeleted( + environmentDeleted: BetaWebhookEnvironmentDeletedEventData + ) = environmentDeleted.validity() + + override fun visitMemoryStoreCreated( + memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData + ) = memoryStoreCreated.validity() + + override fun visitMemoryStoreArchived( + memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData + ) = memoryStoreArchived.validity() + + override fun visitMemoryStoreDeleted( + memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData + ) = memoryStoreDeleted.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -589,7 +975,27 @@ private constructor( vaultCredentialArchived == other.vaultCredentialArchived && vaultCredentialDeleted == other.vaultCredentialDeleted && vaultCredentialRefreshFailed == other.vaultCredentialRefreshFailed && - sessionUpdated == other.sessionUpdated + sessionUpdated == other.sessionUpdated && + agentCreated == other.agentCreated && + agentArchived == other.agentArchived && + agentDeleted == other.agentDeleted && + deploymentPaused == other.deploymentPaused && + deploymentRunFailed == other.deploymentRunFailed && + deploymentCreated == other.deploymentCreated && + deploymentUpdated == other.deploymentUpdated && + deploymentUnpaused == other.deploymentUnpaused && + agentUpdated == other.agentUpdated && + deploymentArchived == other.deploymentArchived && + deploymentRunStarted == other.deploymentRunStarted && + deploymentDeleted == other.deploymentDeleted && + deploymentRunSucceeded == other.deploymentRunSucceeded && + environmentCreated == other.environmentCreated && + environmentUpdated == other.environmentUpdated && + environmentArchived == other.environmentArchived && + environmentDeleted == other.environmentDeleted && + memoryStoreCreated == other.memoryStoreCreated && + memoryStoreArchived == other.memoryStoreArchived && + memoryStoreDeleted == other.memoryStoreDeleted } override fun hashCode(): Int = @@ -617,6 +1023,26 @@ private constructor( vaultCredentialDeleted, vaultCredentialRefreshFailed, sessionUpdated, + agentCreated, + agentArchived, + agentDeleted, + deploymentPaused, + deploymentRunFailed, + deploymentCreated, + deploymentUpdated, + deploymentUnpaused, + agentUpdated, + deploymentArchived, + deploymentRunStarted, + deploymentDeleted, + deploymentRunSucceeded, + environmentCreated, + environmentUpdated, + environmentArchived, + environmentDeleted, + memoryStoreCreated, + memoryStoreArchived, + memoryStoreDeleted, ) override fun toString(): String = @@ -657,6 +1083,41 @@ private constructor( vaultCredentialRefreshFailed != null -> "BetaWebhookEventData{vaultCredentialRefreshFailed=$vaultCredentialRefreshFailed}" sessionUpdated != null -> "BetaWebhookEventData{sessionUpdated=$sessionUpdated}" + agentCreated != null -> "BetaWebhookEventData{agentCreated=$agentCreated}" + agentArchived != null -> "BetaWebhookEventData{agentArchived=$agentArchived}" + agentDeleted != null -> "BetaWebhookEventData{agentDeleted=$agentDeleted}" + deploymentPaused != null -> "BetaWebhookEventData{deploymentPaused=$deploymentPaused}" + deploymentRunFailed != null -> + "BetaWebhookEventData{deploymentRunFailed=$deploymentRunFailed}" + deploymentCreated != null -> + "BetaWebhookEventData{deploymentCreated=$deploymentCreated}" + deploymentUpdated != null -> + "BetaWebhookEventData{deploymentUpdated=$deploymentUpdated}" + deploymentUnpaused != null -> + "BetaWebhookEventData{deploymentUnpaused=$deploymentUnpaused}" + agentUpdated != null -> "BetaWebhookEventData{agentUpdated=$agentUpdated}" + deploymentArchived != null -> + "BetaWebhookEventData{deploymentArchived=$deploymentArchived}" + deploymentRunStarted != null -> + "BetaWebhookEventData{deploymentRunStarted=$deploymentRunStarted}" + deploymentDeleted != null -> + "BetaWebhookEventData{deploymentDeleted=$deploymentDeleted}" + deploymentRunSucceeded != null -> + "BetaWebhookEventData{deploymentRunSucceeded=$deploymentRunSucceeded}" + environmentCreated != null -> + "BetaWebhookEventData{environmentCreated=$environmentCreated}" + environmentUpdated != null -> + "BetaWebhookEventData{environmentUpdated=$environmentUpdated}" + environmentArchived != null -> + "BetaWebhookEventData{environmentArchived=$environmentArchived}" + environmentDeleted != null -> + "BetaWebhookEventData{environmentDeleted=$environmentDeleted}" + memoryStoreCreated != null -> + "BetaWebhookEventData{memoryStoreCreated=$memoryStoreCreated}" + memoryStoreArchived != null -> + "BetaWebhookEventData{memoryStoreArchived=$memoryStoreArchived}" + memoryStoreDeleted != null -> + "BetaWebhookEventData{memoryStoreDeleted=$memoryStoreDeleted}" _json != null -> "BetaWebhookEventData{_unknown=$_json}" else -> throw IllegalStateException("Invalid BetaWebhookEventData") } @@ -764,6 +1225,87 @@ private constructor( @JvmStatic fun ofSessionUpdated(sessionUpdated: BetaWebhookSessionUpdatedEventData) = BetaWebhookEventData(sessionUpdated = sessionUpdated) + + @JvmStatic + fun ofAgentCreated(agentCreated: BetaWebhookAgentCreatedEventData) = + BetaWebhookEventData(agentCreated = agentCreated) + + @JvmStatic + fun ofAgentArchived(agentArchived: BetaWebhookAgentArchivedEventData) = + BetaWebhookEventData(agentArchived = agentArchived) + + @JvmStatic + fun ofAgentDeleted(agentDeleted: BetaWebhookAgentDeletedEventData) = + BetaWebhookEventData(agentDeleted = agentDeleted) + + @JvmStatic + fun ofDeploymentPaused(deploymentPaused: BetaWebhookDeploymentPausedEventData) = + BetaWebhookEventData(deploymentPaused = deploymentPaused) + + @JvmStatic + fun ofDeploymentRunFailed(deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData) = + BetaWebhookEventData(deploymentRunFailed = deploymentRunFailed) + + @JvmStatic + fun ofDeploymentCreated(deploymentCreated: BetaWebhookDeploymentCreatedEventData) = + BetaWebhookEventData(deploymentCreated = deploymentCreated) + + @JvmStatic + fun ofDeploymentUpdated(deploymentUpdated: BetaWebhookDeploymentUpdatedEventData) = + BetaWebhookEventData(deploymentUpdated = deploymentUpdated) + + @JvmStatic + fun ofDeploymentUnpaused(deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData) = + BetaWebhookEventData(deploymentUnpaused = deploymentUnpaused) + + @JvmStatic + fun ofAgentUpdated(agentUpdated: BetaWebhookAgentUpdatedEventData) = + BetaWebhookEventData(agentUpdated = agentUpdated) + + @JvmStatic + fun ofDeploymentArchived(deploymentArchived: BetaWebhookDeploymentArchivedEventData) = + BetaWebhookEventData(deploymentArchived = deploymentArchived) + + @JvmStatic + fun ofDeploymentRunStarted(deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData) = + BetaWebhookEventData(deploymentRunStarted = deploymentRunStarted) + + @JvmStatic + fun ofDeploymentDeleted(deploymentDeleted: BetaWebhookDeploymentDeletedEventData) = + BetaWebhookEventData(deploymentDeleted = deploymentDeleted) + + @JvmStatic + fun ofDeploymentRunSucceeded( + deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData + ) = BetaWebhookEventData(deploymentRunSucceeded = deploymentRunSucceeded) + + @JvmStatic + fun ofEnvironmentCreated(environmentCreated: BetaWebhookEnvironmentCreatedEventData) = + BetaWebhookEventData(environmentCreated = environmentCreated) + + @JvmStatic + fun ofEnvironmentUpdated(environmentUpdated: BetaWebhookEnvironmentUpdatedEventData) = + BetaWebhookEventData(environmentUpdated = environmentUpdated) + + @JvmStatic + fun ofEnvironmentArchived(environmentArchived: BetaWebhookEnvironmentArchivedEventData) = + BetaWebhookEventData(environmentArchived = environmentArchived) + + @JvmStatic + fun ofEnvironmentDeleted(environmentDeleted: BetaWebhookEnvironmentDeletedEventData) = + BetaWebhookEventData(environmentDeleted = environmentDeleted) + + @JvmStatic + fun ofMemoryStoreCreated(memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData) = + BetaWebhookEventData(memoryStoreCreated = memoryStoreCreated) + + @JvmStatic + fun ofMemoryStoreArchived(memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData) = + BetaWebhookEventData(memoryStoreArchived = memoryStoreArchived) + + @JvmStatic + fun ofMemoryStoreDeleted(memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData) = + BetaWebhookEventData(memoryStoreDeleted = memoryStoreDeleted) } /** @@ -840,6 +1382,56 @@ private constructor( fun visitSessionUpdated(sessionUpdated: BetaWebhookSessionUpdatedEventData): T + fun visitAgentCreated(agentCreated: BetaWebhookAgentCreatedEventData): T + + fun visitAgentArchived(agentArchived: BetaWebhookAgentArchivedEventData): T + + fun visitAgentDeleted(agentDeleted: BetaWebhookAgentDeletedEventData): T + + fun visitDeploymentPaused(deploymentPaused: BetaWebhookDeploymentPausedEventData): T + + fun visitDeploymentRunFailed( + deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData + ): T + + fun visitDeploymentCreated(deploymentCreated: BetaWebhookDeploymentCreatedEventData): T + + fun visitDeploymentUpdated(deploymentUpdated: BetaWebhookDeploymentUpdatedEventData): T + + fun visitDeploymentUnpaused(deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData): T + + fun visitAgentUpdated(agentUpdated: BetaWebhookAgentUpdatedEventData): T + + fun visitDeploymentArchived(deploymentArchived: BetaWebhookDeploymentArchivedEventData): T + + fun visitDeploymentRunStarted( + deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData + ): T + + fun visitDeploymentDeleted(deploymentDeleted: BetaWebhookDeploymentDeletedEventData): T + + fun visitDeploymentRunSucceeded( + deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData + ): T + + fun visitEnvironmentCreated(environmentCreated: BetaWebhookEnvironmentCreatedEventData): T + + fun visitEnvironmentUpdated(environmentUpdated: BetaWebhookEnvironmentUpdatedEventData): T + + fun visitEnvironmentArchived( + environmentArchived: BetaWebhookEnvironmentArchivedEventData + ): T + + fun visitEnvironmentDeleted(environmentDeleted: BetaWebhookEnvironmentDeletedEventData): T + + fun visitMemoryStoreCreated(memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData): T + + fun visitMemoryStoreArchived( + memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData + ): T + + fun visitMemoryStoreDeleted(memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData): T + /** * Maps an unknown variant of [BetaWebhookEventData] to a value of type [T]. * @@ -1037,6 +1629,154 @@ private constructor( ?.let { BetaWebhookEventData(sessionUpdated = it, _json = json) } ?: BetaWebhookEventData(_json = json) } + "agent.created" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { BetaWebhookEventData(agentCreated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "agent.archived" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { BetaWebhookEventData(agentArchived = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "agent.deleted" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { BetaWebhookEventData(agentDeleted = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment.paused" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentPaused = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment_run.failed" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentRunFailed = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment.created" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentCreated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment.updated" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentUpdated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment.unpaused" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentUnpaused = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "agent.updated" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { BetaWebhookEventData(agentUpdated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment.archived" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentArchived = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment_run.started" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentRunStarted = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment.deleted" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentDeleted = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "deployment_run.succeeded" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(deploymentRunSucceeded = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "environment.created" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(environmentCreated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "environment.updated" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(environmentUpdated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "environment.archived" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(environmentArchived = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "environment.deleted" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(environmentDeleted = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "memory_store.created" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(memoryStoreCreated = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "memory_store.archived" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(memoryStoreArchived = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } + "memory_store.deleted" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { BetaWebhookEventData(memoryStoreDeleted = it, _json = json) } + ?: BetaWebhookEventData(_json = json) + } } return BetaWebhookEventData(_json = json) @@ -1085,6 +1825,31 @@ private constructor( value.vaultCredentialRefreshFailed != null -> generator.writeObject(value.vaultCredentialRefreshFailed) value.sessionUpdated != null -> generator.writeObject(value.sessionUpdated) + value.agentCreated != null -> generator.writeObject(value.agentCreated) + value.agentArchived != null -> generator.writeObject(value.agentArchived) + value.agentDeleted != null -> generator.writeObject(value.agentDeleted) + value.deploymentPaused != null -> generator.writeObject(value.deploymentPaused) + value.deploymentRunFailed != null -> + generator.writeObject(value.deploymentRunFailed) + value.deploymentCreated != null -> generator.writeObject(value.deploymentCreated) + value.deploymentUpdated != null -> generator.writeObject(value.deploymentUpdated) + value.deploymentUnpaused != null -> generator.writeObject(value.deploymentUnpaused) + value.agentUpdated != null -> generator.writeObject(value.agentUpdated) + value.deploymentArchived != null -> generator.writeObject(value.deploymentArchived) + value.deploymentRunStarted != null -> + generator.writeObject(value.deploymentRunStarted) + value.deploymentDeleted != null -> generator.writeObject(value.deploymentDeleted) + value.deploymentRunSucceeded != null -> + generator.writeObject(value.deploymentRunSucceeded) + value.environmentCreated != null -> generator.writeObject(value.environmentCreated) + value.environmentUpdated != null -> generator.writeObject(value.environmentUpdated) + value.environmentArchived != null -> + generator.writeObject(value.environmentArchived) + value.environmentDeleted != null -> generator.writeObject(value.environmentDeleted) + value.memoryStoreCreated != null -> generator.writeObject(value.memoryStoreCreated) + value.memoryStoreArchived != null -> + generator.writeObject(value.memoryStoreArchived) + value.memoryStoreDeleted != null -> generator.writeObject(value.memoryStoreDeleted) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid BetaWebhookEventData") } diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreArchivedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreArchivedEventData.kt new file mode 100644 index 000000000..983e708c8 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreArchivedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookMemoryStoreArchivedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the memory store that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("memory_store.archived") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookMemoryStoreArchivedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookMemoryStoreArchivedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("memory_store.archived") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookMemoryStoreArchivedEventData: BetaWebhookMemoryStoreArchivedEventData + ) = apply { + id = betaWebhookMemoryStoreArchivedEventData.id + organizationId = betaWebhookMemoryStoreArchivedEventData.organizationId + type = betaWebhookMemoryStoreArchivedEventData.type + workspaceId = betaWebhookMemoryStoreArchivedEventData.workspaceId + additionalProperties = + betaWebhookMemoryStoreArchivedEventData.additionalProperties.toMutableMap() + } + + /** ID of the memory store that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("memory_store.archived") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookMemoryStoreArchivedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookMemoryStoreArchivedEventData = + BetaWebhookMemoryStoreArchivedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookMemoryStoreArchivedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("memory_store.archived")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("memory_store.archived")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookMemoryStoreArchivedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookMemoryStoreArchivedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreCreatedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreCreatedEventData.kt new file mode 100644 index 000000000..486696d66 --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreCreatedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookMemoryStoreCreatedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the memory store that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("memory_store.created") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookMemoryStoreCreatedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookMemoryStoreCreatedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("memory_store.created") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookMemoryStoreCreatedEventData: BetaWebhookMemoryStoreCreatedEventData + ) = apply { + id = betaWebhookMemoryStoreCreatedEventData.id + organizationId = betaWebhookMemoryStoreCreatedEventData.organizationId + type = betaWebhookMemoryStoreCreatedEventData.type + workspaceId = betaWebhookMemoryStoreCreatedEventData.workspaceId + additionalProperties = + betaWebhookMemoryStoreCreatedEventData.additionalProperties.toMutableMap() + } + + /** ID of the memory store that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("memory_store.created") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookMemoryStoreCreatedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookMemoryStoreCreatedEventData = + BetaWebhookMemoryStoreCreatedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookMemoryStoreCreatedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("memory_store.created")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("memory_store.created")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookMemoryStoreCreatedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookMemoryStoreCreatedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreDeletedEventData.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreDeletedEventData.kt new file mode 100644 index 000000000..cdabfd2ce --- /dev/null +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreDeletedEventData.kt @@ -0,0 +1,304 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.ExcludeMissing +import com.anthropic.core.JsonField +import com.anthropic.core.JsonMissing +import com.anthropic.core.JsonValue +import com.anthropic.core.checkRequired +import com.anthropic.errors.AnthropicInvalidDataException +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 java.util.Collections +import java.util.Objects + +class BetaWebhookMemoryStoreDeletedEventData +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val organizationId: JsonField, + private val type: JsonValue, + private val workspaceId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("organization_id") + @ExcludeMissing + organizationId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("workspace_id") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + ) : this(id, organizationId, type, workspaceId, mutableMapOf()) + + /** + * ID of the memory store that triggered the event. + * + * @throws AnthropicInvalidDataException 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") + + /** + * @throws AnthropicInvalidDataException 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 organizationId(): String = organizationId.getRequired("organization_id") + + /** + * Expected to always return the following: + * ```java + * JsonValue.from("memory_store.deleted") + * ``` + * + * However, this method can be useful for debugging and logging (e.g. if the server responded + * with an unexpected value). + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + + /** + * @throws AnthropicInvalidDataException 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 workspaceId(): String = workspaceId.getRequired("workspace_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 + + /** + * Returns the raw JSON value of [organizationId]. + * + * Unlike [organizationId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("organization_id") + @ExcludeMissing + fun _organizationId(): JsonField = organizationId + + /** + * 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) { + 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 + * [BetaWebhookMemoryStoreDeletedEventData]. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BetaWebhookMemoryStoreDeletedEventData]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var organizationId: JsonField? = null + private var type: JsonValue = JsonValue.from("memory_store.deleted") + private var workspaceId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + betaWebhookMemoryStoreDeletedEventData: BetaWebhookMemoryStoreDeletedEventData + ) = apply { + id = betaWebhookMemoryStoreDeletedEventData.id + organizationId = betaWebhookMemoryStoreDeletedEventData.organizationId + type = betaWebhookMemoryStoreDeletedEventData.type + workspaceId = betaWebhookMemoryStoreDeletedEventData.workspaceId + additionalProperties = + betaWebhookMemoryStoreDeletedEventData.additionalProperties.toMutableMap() + } + + /** ID of the memory store that triggered the event. */ + 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 } + + fun organizationId(organizationId: String) = organizationId(JsonField.of(organizationId)) + + /** + * Sets [Builder.organizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.organizationId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun organizationId(organizationId: JsonField) = apply { + this.organizationId = organizationId + } + + /** + * 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("memory_store.deleted") + * ``` + * + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonValue) = apply { this.type = type } + + 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() + 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 [BetaWebhookMemoryStoreDeletedEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .organizationId() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BetaWebhookMemoryStoreDeletedEventData = + BetaWebhookMemoryStoreDeletedEventData( + checkRequired("id", id), + checkRequired("organizationId", organizationId), + type, + checkRequired("workspaceId", workspaceId), + 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 AnthropicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BetaWebhookMemoryStoreDeletedEventData = apply { + if (validated) { + return@apply + } + + id() + organizationId() + _type().let { + if (it != JsonValue.from("memory_store.deleted")) { + throw AnthropicInvalidDataException("'type' is invalid, received $it") + } + } + workspaceId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: AnthropicInvalidDataException) { + 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) + + (if (organizationId.asKnown().isPresent) 1 else 0) + + type.let { if (it == JsonValue.from("memory_store.deleted")) 1 else 0 } + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BetaWebhookMemoryStoreDeletedEventData && + id == other.id && + organizationId == other.organizationId && + type == other.type && + workspaceId == other.workspaceId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, organizationId, type, workspaceId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BetaWebhookMemoryStoreDeletedEventData{id=$id, organizationId=$organizationId, type=$type, workspaceId=$workspaceId, additionalProperties=$additionalProperties}" +} diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/UnwrapWebhookEvent.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/UnwrapWebhookEvent.kt index aafb5e544..6656b234f 100644 --- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/UnwrapWebhookEvent.kt +++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/webhooks/UnwrapWebhookEvent.kt @@ -321,6 +321,134 @@ private constructor( fun data(sessionUpdated: BetaWebhookSessionUpdatedEventData) = data(BetaWebhookEventData.ofSessionUpdated(sessionUpdated)) + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentCreated(agentCreated)`. */ + fun data(agentCreated: BetaWebhookAgentCreatedEventData) = + data(BetaWebhookEventData.ofAgentCreated(agentCreated)) + + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentArchived(agentArchived)`. */ + fun data(agentArchived: BetaWebhookAgentArchivedEventData) = + data(BetaWebhookEventData.ofAgentArchived(agentArchived)) + + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentDeleted(agentDeleted)`. */ + fun data(agentDeleted: BetaWebhookAgentDeletedEventData) = + data(BetaWebhookEventData.ofAgentDeleted(agentDeleted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentPaused(deploymentPaused)`. + */ + fun data(deploymentPaused: BetaWebhookDeploymentPausedEventData) = + data(BetaWebhookEventData.ofDeploymentPaused(deploymentPaused)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentRunFailed(deploymentRunFailed)`. + */ + fun data(deploymentRunFailed: BetaWebhookDeploymentRunFailedEventData) = + data(BetaWebhookEventData.ofDeploymentRunFailed(deploymentRunFailed)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentCreated(deploymentCreated)`. + */ + fun data(deploymentCreated: BetaWebhookDeploymentCreatedEventData) = + data(BetaWebhookEventData.ofDeploymentCreated(deploymentCreated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentUpdated(deploymentUpdated)`. + */ + fun data(deploymentUpdated: BetaWebhookDeploymentUpdatedEventData) = + data(BetaWebhookEventData.ofDeploymentUpdated(deploymentUpdated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentUnpaused(deploymentUnpaused)`. + */ + fun data(deploymentUnpaused: BetaWebhookDeploymentUnpausedEventData) = + data(BetaWebhookEventData.ofDeploymentUnpaused(deploymentUnpaused)) + + /** Alias for calling [data] with `BetaWebhookEventData.ofAgentUpdated(agentUpdated)`. */ + fun data(agentUpdated: BetaWebhookAgentUpdatedEventData) = + data(BetaWebhookEventData.ofAgentUpdated(agentUpdated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentArchived(deploymentArchived)`. + */ + fun data(deploymentArchived: BetaWebhookDeploymentArchivedEventData) = + data(BetaWebhookEventData.ofDeploymentArchived(deploymentArchived)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentRunStarted(deploymentRunStarted)`. + */ + fun data(deploymentRunStarted: BetaWebhookDeploymentRunStartedEventData) = + data(BetaWebhookEventData.ofDeploymentRunStarted(deploymentRunStarted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentDeleted(deploymentDeleted)`. + */ + fun data(deploymentDeleted: BetaWebhookDeploymentDeletedEventData) = + data(BetaWebhookEventData.ofDeploymentDeleted(deploymentDeleted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofDeploymentRunSucceeded(deploymentRunSucceeded)`. + */ + fun data(deploymentRunSucceeded: BetaWebhookDeploymentRunSucceededEventData) = + data(BetaWebhookEventData.ofDeploymentRunSucceeded(deploymentRunSucceeded)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentCreated(environmentCreated)`. + */ + fun data(environmentCreated: BetaWebhookEnvironmentCreatedEventData) = + data(BetaWebhookEventData.ofEnvironmentCreated(environmentCreated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentUpdated(environmentUpdated)`. + */ + fun data(environmentUpdated: BetaWebhookEnvironmentUpdatedEventData) = + data(BetaWebhookEventData.ofEnvironmentUpdated(environmentUpdated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentArchived(environmentArchived)`. + */ + fun data(environmentArchived: BetaWebhookEnvironmentArchivedEventData) = + data(BetaWebhookEventData.ofEnvironmentArchived(environmentArchived)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofEnvironmentDeleted(environmentDeleted)`. + */ + fun data(environmentDeleted: BetaWebhookEnvironmentDeletedEventData) = + data(BetaWebhookEventData.ofEnvironmentDeleted(environmentDeleted)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofMemoryStoreCreated(memoryStoreCreated)`. + */ + fun data(memoryStoreCreated: BetaWebhookMemoryStoreCreatedEventData) = + data(BetaWebhookEventData.ofMemoryStoreCreated(memoryStoreCreated)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofMemoryStoreArchived(memoryStoreArchived)`. + */ + fun data(memoryStoreArchived: BetaWebhookMemoryStoreArchivedEventData) = + data(BetaWebhookEventData.ofMemoryStoreArchived(memoryStoreArchived)) + + /** + * Alias for calling [data] with + * `BetaWebhookEventData.ofMemoryStoreDeleted(memoryStoreDeleted)`. + */ + fun data(memoryStoreDeleted: BetaWebhookMemoryStoreDeletedEventData) = + data(BetaWebhookEventData.ofMemoryStoreDeleted(memoryStoreDeleted)) + /** * Sets the field to an arbitrary JSON value. * diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkListResponseTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkListResponseTest.kt index 39aacb42a..3fe087665 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkListResponseTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkListResponseTest.kt @@ -27,6 +27,7 @@ internal class BetaSelfHostedWorkListResponseTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .secret("secret") .startedAt("started_at") .state(BetaSelfHostedWork.State.QUEUED) .stopRequestedAt("stop_requested_at") @@ -50,6 +51,7 @@ internal class BetaSelfHostedWorkListResponseTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .secret("secret") .startedAt("started_at") .state(BetaSelfHostedWork.State.QUEUED) .stopRequestedAt("stop_requested_at") @@ -77,6 +79,7 @@ internal class BetaSelfHostedWorkListResponseTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .secret("secret") .startedAt("started_at") .state(BetaSelfHostedWork.State.QUEUED) .stopRequestedAt("stop_requested_at") diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkTest.kt index c15cb5908..a5789f596 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/environments/work/BetaSelfHostedWorkTest.kt @@ -25,6 +25,7 @@ internal class BetaSelfHostedWorkTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .secret("secret") .startedAt("started_at") .state(BetaSelfHostedWork.State.QUEUED) .stopRequestedAt("stop_requested_at") @@ -44,6 +45,7 @@ internal class BetaSelfHostedWorkTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(betaSelfHostedWork.secret()).contains("secret") assertThat(betaSelfHostedWork.startedAt()).contains("started_at") assertThat(betaSelfHostedWork.state()).isEqualTo(BetaSelfHostedWork.State.QUEUED) assertThat(betaSelfHostedWork.stopRequestedAt()).contains("stop_requested_at") @@ -66,6 +68,7 @@ internal class BetaSelfHostedWorkTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .secret("secret") .startedAt("started_at") .state(BetaSelfHostedWork.State.QUEUED) .stopRequestedAt("stop_requested_at") diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentMessagePreviewTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentMessagePreviewTest.kt new file mode 100644 index 000000000..0db30859f --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentMessagePreviewTest.kt @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsAgentMessagePreviewTest { + + @Test + fun create() { + val betaManagedAgentsAgentMessagePreview = + BetaManagedAgentsAgentMessagePreview.builder() + .id("id") + .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + .build() + + assertThat(betaManagedAgentsAgentMessagePreview.id()).isEqualTo("id") + assertThat(betaManagedAgentsAgentMessagePreview.type()) + .isEqualTo(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsAgentMessagePreview = + BetaManagedAgentsAgentMessagePreview.builder() + .id("id") + .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + .build() + + val roundtrippedBetaManagedAgentsAgentMessagePreview = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsAgentMessagePreview), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsAgentMessagePreview) + .isEqualTo(betaManagedAgentsAgentMessagePreview) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentThinkingPreviewTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentThinkingPreviewTest.kt new file mode 100644 index 000000000..014e2ff21 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentThinkingPreviewTest.kt @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsAgentThinkingPreviewTest { + + @Test + fun create() { + val betaManagedAgentsAgentThinkingPreview = + BetaManagedAgentsAgentThinkingPreview.builder() + .id("id") + .type(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + .build() + + assertThat(betaManagedAgentsAgentThinkingPreview.id()).isEqualTo("id") + assertThat(betaManagedAgentsAgentThinkingPreview.type()) + .isEqualTo(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsAgentThinkingPreview = + BetaManagedAgentsAgentThinkingPreview.builder() + .id("id") + .type(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + .build() + + val roundtrippedBetaManagedAgentsAgentThinkingPreview = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsAgentThinkingPreview), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsAgentThinkingPreview) + .isEqualTo(betaManagedAgentsAgentThinkingPreview) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentWithOverridesParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentWithOverridesParamsTest.kt new file mode 100644 index 000000000..c30397699 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsAgentWithOverridesParamsTest.kt @@ -0,0 +1,329 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.jsonMapper +import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolConfigParams +import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset20260401Params +import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolsetDefaultConfigParams +import com.anthropic.models.beta.agents.BetaManagedAgentsAlwaysAllowPolicy +import com.anthropic.models.beta.agents.BetaManagedAgentsAnthropicSkillParams +import com.anthropic.models.beta.agents.BetaManagedAgentsModel +import com.anthropic.models.beta.agents.BetaManagedAgentsModelConfigParams +import com.anthropic.models.beta.agents.BetaManagedAgentsSkillParams +import com.anthropic.models.beta.agents.BetaManagedAgentsUrlMcpServerParams +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsAgentWithOverridesParamsTest { + + @Test + fun create() { + val betaManagedAgentsAgentWithOverridesParams = + BetaManagedAgentsAgentWithOverridesParams.builder() + .id("x") + .type(BetaManagedAgentsAgentWithOverridesParams.Type.AGENT_WITH_OVERRIDES) + .addMcpServer( + BetaManagedAgentsUrlMcpServerParams.builder() + .name("example-mcp") + .type(BetaManagedAgentsUrlMcpServerParams.Type.URL) + .url("https://example-server.modelcontextprotocol.io/sse") + .build() + ) + .model( + BetaManagedAgentsModelConfigParams.builder() + .id(BetaManagedAgentsModel.CLAUDE_OPUS_4_6) + .speed(BetaManagedAgentsModelConfigParams.Speed.STANDARD) + .build() + ) + .addSkill( + BetaManagedAgentsAnthropicSkillParams.builder() + .skillId("xlsx") + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .version("1") + .build() + ) + .system("system") + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type( + BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401 + ) + .addConfig( + BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.BASH) + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .build() + ) + .version(0) + .build() + + assertThat(betaManagedAgentsAgentWithOverridesParams.id()).isEqualTo("x") + assertThat(betaManagedAgentsAgentWithOverridesParams.type()) + .isEqualTo(BetaManagedAgentsAgentWithOverridesParams.Type.AGENT_WITH_OVERRIDES) + assertThat(betaManagedAgentsAgentWithOverridesParams.mcpServers().getOrNull()) + .containsExactly( + BetaManagedAgentsUrlMcpServerParams.builder() + .name("example-mcp") + .type(BetaManagedAgentsUrlMcpServerParams.Type.URL) + .url("https://example-server.modelcontextprotocol.io/sse") + .build() + ) + assertThat(betaManagedAgentsAgentWithOverridesParams.model()) + .contains( + BetaManagedAgentsAgentWithOverridesParams.Model + .ofBetaManagedAgentsModelConfigParams( + BetaManagedAgentsModelConfigParams.builder() + .id(BetaManagedAgentsModel.CLAUDE_OPUS_4_6) + .speed(BetaManagedAgentsModelConfigParams.Speed.STANDARD) + .build() + ) + ) + assertThat(betaManagedAgentsAgentWithOverridesParams.skills().getOrNull()) + .containsExactly( + BetaManagedAgentsSkillParams.ofAnthropic( + BetaManagedAgentsAnthropicSkillParams.builder() + .skillId("xlsx") + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .version("1") + .build() + ) + ) + assertThat(betaManagedAgentsAgentWithOverridesParams.system()).contains("system") + assertThat(betaManagedAgentsAgentWithOverridesParams.tools().getOrNull()) + .containsExactly( + BetaManagedAgentsAgentWithOverridesParams.Tool.ofAgentToolset20260401( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type( + BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401 + ) + .addConfig( + BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.BASH) + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .build() + ) + ) + assertThat(betaManagedAgentsAgentWithOverridesParams.version()).contains(0) + } + + @Test + fun addToUnsetListsOnToBuilder() { + val baseBetaManagedAgentsAgentWithOverridesParams = + BetaManagedAgentsAgentWithOverridesParams.builder() + .id("x") + .type(BetaManagedAgentsAgentWithOverridesParams.Type.AGENT_WITH_OVERRIDES) + .build() + + val betaManagedAgentsAgentWithOverridesParams = + baseBetaManagedAgentsAgentWithOverridesParams + .toBuilder() + .addMcpServer( + BetaManagedAgentsUrlMcpServerParams.builder() + .name("example-mcp") + .type(BetaManagedAgentsUrlMcpServerParams.Type.URL) + .url("https://example-server.modelcontextprotocol.io/sse") + .build() + ) + .addSkill( + BetaManagedAgentsSkillParams.ofAnthropic( + BetaManagedAgentsAnthropicSkillParams.builder() + .skillId("xlsx") + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .version("1") + .build() + ) + ) + .addTool( + BetaManagedAgentsAgentWithOverridesParams.Tool.ofAgentToolset20260401( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type( + BetaManagedAgentsAgentToolset20260401Params.Type + .AGENT_TOOLSET_20260401 + ) + .addConfig( + BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.BASH) + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type( + BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW + ) + .build() + ) + .build() + ) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type( + BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW + ) + .build() + ) + .build() + ) + .build() + ) + ) + .build() + + assertThat(betaManagedAgentsAgentWithOverridesParams.mcpServers().getOrNull()) + .containsExactly( + BetaManagedAgentsUrlMcpServerParams.builder() + .name("example-mcp") + .type(BetaManagedAgentsUrlMcpServerParams.Type.URL) + .url("https://example-server.modelcontextprotocol.io/sse") + .build() + ) + assertThat(betaManagedAgentsAgentWithOverridesParams.skills().getOrNull()) + .containsExactly( + BetaManagedAgentsSkillParams.ofAnthropic( + BetaManagedAgentsAnthropicSkillParams.builder() + .skillId("xlsx") + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .version("1") + .build() + ) + ) + assertThat(betaManagedAgentsAgentWithOverridesParams.tools().getOrNull()) + .containsExactly( + BetaManagedAgentsAgentWithOverridesParams.Tool.ofAgentToolset20260401( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type( + BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401 + ) + .addConfig( + BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.BASH) + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .build() + ) + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsAgentWithOverridesParams = + BetaManagedAgentsAgentWithOverridesParams.builder() + .id("x") + .type(BetaManagedAgentsAgentWithOverridesParams.Type.AGENT_WITH_OVERRIDES) + .addMcpServer( + BetaManagedAgentsUrlMcpServerParams.builder() + .name("example-mcp") + .type(BetaManagedAgentsUrlMcpServerParams.Type.URL) + .url("https://example-server.modelcontextprotocol.io/sse") + .build() + ) + .model( + BetaManagedAgentsModelConfigParams.builder() + .id(BetaManagedAgentsModel.CLAUDE_OPUS_4_6) + .speed(BetaManagedAgentsModelConfigParams.Speed.STANDARD) + .build() + ) + .addSkill( + BetaManagedAgentsAnthropicSkillParams.builder() + .skillId("xlsx") + .type(BetaManagedAgentsAnthropicSkillParams.Type.ANTHROPIC) + .version("1") + .build() + ) + .system("system") + .addTool( + BetaManagedAgentsAgentToolset20260401Params.builder() + .type( + BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401 + ) + .addConfig( + BetaManagedAgentsAgentToolConfigParams.builder() + .name(BetaManagedAgentsAgentToolConfigParams.Name.BASH) + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .defaultConfig( + BetaManagedAgentsAgentToolsetDefaultConfigParams.builder() + .enabled(true) + .permissionPolicy( + BetaManagedAgentsAlwaysAllowPolicy.builder() + .type(BetaManagedAgentsAlwaysAllowPolicy.Type.ALWAYS_ALLOW) + .build() + ) + .build() + ) + .build() + ) + .version(0) + .build() + + val roundtrippedBetaManagedAgentsAgentWithOverridesParams = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsAgentWithOverridesParams), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsAgentWithOverridesParams) + .isEqualTo(betaManagedAgentsAgentWithOverridesParams) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaContentTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaContentTest.kt new file mode 100644 index 000000000..715e75a5f --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaContentTest.kt @@ -0,0 +1,63 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.jsonMapper +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsDeltaContentTest { + + @Test + fun create() { + val betaManagedAgentsDeltaContent = + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + + assertThat(betaManagedAgentsDeltaContent.content()) + .isEqualTo( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + assertThat(betaManagedAgentsDeltaContent.type()) + .isEqualTo(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + assertThat(betaManagedAgentsDeltaContent.index()).contains(0L) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsDeltaContent = + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + + val roundtrippedBetaManagedAgentsDeltaContent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsDeltaContent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsDeltaContent) + .isEqualTo(betaManagedAgentsDeltaContent) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaEventTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaEventTest.kt new file mode 100644 index 000000000..5c54a5f43 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsDeltaEventTest.kt @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.jsonMapper +import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsDeltaEventTest { + + @Test + fun create() { + val betaManagedAgentsDeltaEvent = + BetaManagedAgentsDeltaEvent.builder() + .delta( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + .eventId("event_id") + .type(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + .build() + + assertThat(betaManagedAgentsDeltaEvent.delta()) + .isEqualTo( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + assertThat(betaManagedAgentsDeltaEvent.eventId()).isEqualTo("event_id") + assertThat(betaManagedAgentsDeltaEvent.type()) + .isEqualTo(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsDeltaEvent = + BetaManagedAgentsDeltaEvent.builder() + .delta( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + .eventId("event_id") + .type(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + .build() + + val roundtrippedBetaManagedAgentsDeltaEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsDeltaEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsDeltaEvent).isEqualTo(betaManagedAgentsDeltaEvent) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventPreviewTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventPreviewTest.kt new file mode 100644 index 000000000..493f8a2e1 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventPreviewTest.kt @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.JsonValue +import com.anthropic.core.jsonMapper +import com.anthropic.errors.AnthropicInvalidDataException +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource + +internal class BetaManagedAgentsStartEventPreviewTest { + + @Test + fun ofAgentMessage() { + val agentMessage = + BetaManagedAgentsAgentMessagePreview.builder() + .id("id") + .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + .build() + + val betaManagedAgentsStartEventPreview = + BetaManagedAgentsStartEventPreview.ofAgentMessage(agentMessage) + + assertThat(betaManagedAgentsStartEventPreview.agentMessage()).contains(agentMessage) + assertThat(betaManagedAgentsStartEventPreview.agentThinking()).isEmpty + } + + @Test + fun ofAgentMessageRoundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStartEventPreview = + BetaManagedAgentsStartEventPreview.ofAgentMessage( + BetaManagedAgentsAgentMessagePreview.builder() + .id("id") + .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + .build() + ) + + val roundtrippedBetaManagedAgentsStartEventPreview = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStartEventPreview), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStartEventPreview) + .isEqualTo(betaManagedAgentsStartEventPreview) + } + + @Test + fun ofAgentThinking() { + val agentThinking = + BetaManagedAgentsAgentThinkingPreview.builder() + .id("id") + .type(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + .build() + + val betaManagedAgentsStartEventPreview = + BetaManagedAgentsStartEventPreview.ofAgentThinking(agentThinking) + + assertThat(betaManagedAgentsStartEventPreview.agentMessage()).isEmpty + assertThat(betaManagedAgentsStartEventPreview.agentThinking()).contains(agentThinking) + } + + @Test + fun ofAgentThinkingRoundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStartEventPreview = + BetaManagedAgentsStartEventPreview.ofAgentThinking( + BetaManagedAgentsAgentThinkingPreview.builder() + .id("id") + .type(BetaManagedAgentsAgentThinkingPreview.Type.AGENT_THINKING) + .build() + ) + + val roundtrippedBetaManagedAgentsStartEventPreview = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStartEventPreview), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStartEventPreview) + .isEqualTo(betaManagedAgentsStartEventPreview) + } + + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { + BOOLEAN(JsonValue.from(false)), + STRING(JsonValue.from("invalid")), + INTEGER(JsonValue.from(-1)), + FLOAT(JsonValue.from(3.14)), + ARRAY(JsonValue.from(listOf("invalid", "array"))), + } + + @ParameterizedTest + @EnumSource + fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { + val betaManagedAgentsStartEventPreview = + jsonMapper() + .convertValue(testCase.value, jacksonTypeRef()) + + val e = + assertThrows { + betaManagedAgentsStartEventPreview.validate() + } + assertThat(e).hasMessageStartingWith("Unknown ") + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventTest.kt new file mode 100644 index 000000000..9d4aa828c --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/BetaManagedAgentsStartEventTest.kt @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.sessions + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsStartEventTest { + + @Test + fun create() { + val betaManagedAgentsStartEvent = + BetaManagedAgentsStartEvent.builder() + .agentMessageEvent("id") + .type(BetaManagedAgentsStartEvent.Type.EVENT_START) + .build() + + assertThat(betaManagedAgentsStartEvent.event()) + .isEqualTo( + BetaManagedAgentsStartEventPreview.ofAgentMessage( + BetaManagedAgentsAgentMessagePreview.builder() + .id("id") + .type(BetaManagedAgentsAgentMessagePreview.Type.AGENT_MESSAGE) + .build() + ) + ) + assertThat(betaManagedAgentsStartEvent.type()) + .isEqualTo(BetaManagedAgentsStartEvent.Type.EVENT_START) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStartEvent = + BetaManagedAgentsStartEvent.builder() + .agentMessageEvent("id") + .type(BetaManagedAgentsStartEvent.Type.EVENT_START) + .build() + + val roundtrippedBetaManagedAgentsStartEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStartEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStartEvent).isEqualTo(betaManagedAgentsStartEvent) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponseTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponseTest.kt index 67d900705..3e9e0b4f3 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponseTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/SessionListPageResponseTest.kt @@ -277,6 +277,7 @@ internal class SessionListPageResponseTest { .build() ) .nextPage("page_MjAyNS0wNS0xNFQwMDowMDowMFo=") + .prevPage("page_MjAyNS0wNS0xM1QwMDowMDowMFo=") .build() assertThat(sessionListPageResponse.data().getOrNull()) @@ -517,6 +518,7 @@ internal class SessionListPageResponseTest { .build() ) assertThat(sessionListPageResponse.nextPage()).contains("page_MjAyNS0wNS0xNFQwMDowMDowMFo=") + assertThat(sessionListPageResponse.prevPage()).contains("page_MjAyNS0wNS0xM1QwMDowMDowMFo=") } @Test @@ -1269,6 +1271,7 @@ internal class SessionListPageResponseTest { .build() ) .nextPage("page_MjAyNS0wNS0xNFQwMDowMDowMFo=") + .prevPage("page_MjAyNS0wNS0xM1QwMDowMDowMFo=") .build() val roundtrippedSessionListPageResponse = diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEventsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEventsTest.kt index 0d52e1ab4..e977648aa 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEventsTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/BetaManagedAgentsStreamSessionEventsTest.kt @@ -16,9 +16,12 @@ import com.anthropic.models.beta.agents.BetaManagedAgentsMcpServerUrlDefinition import com.anthropic.models.beta.agents.BetaManagedAgentsModel import com.anthropic.models.beta.agents.BetaManagedAgentsModelConfig import com.anthropic.models.beta.agents.BetaManagedAgentsSessionThreadAgent +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaContent +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionAgent import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionMultiagentCoordinator import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionUpdatedEvent +import com.anthropic.models.beta.sessions.BetaManagedAgentsStartEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSystemMessageEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsUserToolResultEvent import com.fasterxml.jackson.module.kotlin.jacksonTypeRef @@ -77,6 +80,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -149,6 +154,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -225,6 +232,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -304,6 +313,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -386,6 +397,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -469,6 +482,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -545,6 +560,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -626,6 +643,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -711,6 +730,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -792,6 +813,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -875,6 +898,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -957,6 +982,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1037,6 +1064,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1118,6 +1147,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1202,6 +1233,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1288,6 +1321,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1362,6 +1397,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1438,6 +1475,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1514,6 +1553,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1589,6 +1630,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1669,6 +1712,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1763,6 +1808,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1851,6 +1898,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -1933,6 +1982,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2022,6 +2073,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2102,6 +2155,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2176,6 +2231,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2254,6 +2311,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2337,6 +2396,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2425,6 +2486,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2504,6 +2567,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).contains(userToolResult) assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2586,6 +2651,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()) .contains(sessionThreadStatusRescheduled) assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -2828,6 +2895,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).contains(sessionUpdated) + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty } @@ -3027,6 +3096,170 @@ internal class BetaManagedAgentsStreamSessionEventsTest { .isEqualTo(betaManagedAgentsStreamSessionEvents) } + @Test + fun ofEventStart() { + val eventStart = + BetaManagedAgentsStartEvent.builder() + .agentMessageEvent("id") + .type(BetaManagedAgentsStartEvent.Type.EVENT_START) + .build() + + val betaManagedAgentsStreamSessionEvents = + BetaManagedAgentsStreamSessionEvents.ofEventStart(eventStart) + + assertThat(betaManagedAgentsStreamSessionEvents.userMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userInterrupt()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userToolConfirmation()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userCustomToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentCustomToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThinking()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentMcpToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentMcpToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThreadMessageReceived()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThreadMessageSent()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThreadContextCompacted()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionError()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusRescheduled()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusTerminated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadCreated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanOutcomeEvaluationStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanOutcomeEvaluationEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanModelRequestStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanModelRequestEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanOutcomeEvaluationOngoing()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userDefineOutcome()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionDeleted()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusTerminated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).contains(eventStart) + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty + } + + @Test + fun ofEventStartRoundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStreamSessionEvents = + BetaManagedAgentsStreamSessionEvents.ofEventStart( + BetaManagedAgentsStartEvent.builder() + .agentMessageEvent("id") + .type(BetaManagedAgentsStartEvent.Type.EVENT_START) + .build() + ) + + val roundtrippedBetaManagedAgentsStreamSessionEvents = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStreamSessionEvents), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStreamSessionEvents) + .isEqualTo(betaManagedAgentsStreamSessionEvents) + } + + @Test + fun ofEventDelta() { + val eventDelta = + BetaManagedAgentsDeltaEvent.builder() + .delta( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + .eventId("event_id") + .type(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + .build() + + val betaManagedAgentsStreamSessionEvents = + BetaManagedAgentsStreamSessionEvents.ofEventDelta(eventDelta) + + assertThat(betaManagedAgentsStreamSessionEvents.userMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userInterrupt()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userToolConfirmation()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userCustomToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentCustomToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThinking()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentMcpToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentMcpToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThreadMessageReceived()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThreadMessageSent()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.agentThreadContextCompacted()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionError()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusRescheduled()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionStatusTerminated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadCreated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanOutcomeEvaluationStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanOutcomeEvaluationEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanModelRequestStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanModelRequestEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.spanOutcomeEvaluationOngoing()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userDefineOutcome()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionDeleted()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusTerminated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).contains(eventDelta) + assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).isEmpty + } + + @Test + fun ofEventDeltaRoundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStreamSessionEvents = + BetaManagedAgentsStreamSessionEvents.ofEventDelta( + BetaManagedAgentsDeltaEvent.builder() + .delta( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + .eventId("event_id") + .type(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + .build() + ) + + val roundtrippedBetaManagedAgentsStreamSessionEvents = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStreamSessionEvents), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStreamSessionEvents) + .isEqualTo(betaManagedAgentsStreamSessionEvents) + } + @Test fun ofSystemMessage() { val systemMessage = @@ -3073,6 +3306,8 @@ internal class BetaManagedAgentsStreamSessionEventsTest { assertThat(betaManagedAgentsStreamSessionEvents.userToolResult()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionThreadStatusRescheduled()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionEvents.systemMessage()).contains(systemMessage) } diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParamsTest.kt index 36e30e7b8..bf9bbb90b 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParamsTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/events/EventStreamParamsTest.kt @@ -3,7 +3,9 @@ package com.anthropic.models.beta.sessions.events import com.anthropic.core.http.Headers +import com.anthropic.core.http.QueryParams import com.anthropic.models.beta.AnthropicBeta +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaType import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -13,6 +15,7 @@ internal class EventStreamParamsTest { fun create() { EventStreamParams.builder() .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addEventDelta(BetaManagedAgentsDeltaType.AGENT_MESSAGE) .addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24) .build() } @@ -31,6 +34,7 @@ internal class EventStreamParamsTest { val params = EventStreamParams.builder() .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addEventDelta(BetaManagedAgentsDeltaType.AGENT_MESSAGE) .addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24) .build() @@ -50,4 +54,28 @@ internal class EventStreamParamsTest { assertThat(headers).isEqualTo(Headers.builder().build()) } + + @Test + fun queryParams() { + val params = + EventStreamParams.builder() + .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addEventDelta(BetaManagedAgentsDeltaType.AGENT_MESSAGE) + .addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("event_deltas[]", "agent.message").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = EventStreamParams.builder().sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } } diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEventsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEventsTest.kt index 2d97c561a..6c47edfc3 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEventsTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/sessions/threads/BetaManagedAgentsStreamSessionThreadEventsTest.kt @@ -16,9 +16,12 @@ import com.anthropic.models.beta.agents.BetaManagedAgentsMcpServerUrlDefinition import com.anthropic.models.beta.agents.BetaManagedAgentsModel import com.anthropic.models.beta.agents.BetaManagedAgentsModelConfig import com.anthropic.models.beta.agents.BetaManagedAgentsSessionThreadAgent +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaContent +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionAgent import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionMultiagentCoordinator import com.anthropic.models.beta.sessions.BetaManagedAgentsSessionUpdatedEvent +import com.anthropic.models.beta.sessions.BetaManagedAgentsStartEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsSystemMessageEvent import com.anthropic.models.beta.sessions.BetaManagedAgentsUserToolResultEvent import com.anthropic.models.beta.sessions.events.BetaManagedAgentsAgentCustomToolUseEvent @@ -116,6 +119,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -192,6 +197,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -271,6 +278,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -353,6 +362,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -438,6 +449,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -524,6 +537,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -604,6 +619,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -689,6 +706,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -777,6 +796,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -861,6 +882,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -948,6 +971,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1033,6 +1058,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1118,6 +1145,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1202,6 +1231,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1289,6 +1320,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1378,6 +1411,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1455,6 +1490,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1534,6 +1571,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1615,6 +1654,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1693,6 +1734,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1776,6 +1819,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1873,6 +1918,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -1966,6 +2013,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2051,6 +2100,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2142,6 +2193,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2225,6 +2278,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2303,6 +2358,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2384,6 +2441,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2472,6 +2531,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2562,6 +2623,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2645,6 +2708,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2729,6 +2794,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .contains(sessionThreadStatusRescheduled) assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -2975,6 +3042,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()) .contains(sessionUpdated) + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty } @@ -3174,6 +3243,176 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { .isEqualTo(betaManagedAgentsStreamSessionThreadEvents) } + @Test + fun ofEventStart() { + val eventStart = + BetaManagedAgentsStartEvent.builder() + .agentMessageEvent("id") + .type(BetaManagedAgentsStartEvent.Type.EVENT_START) + .build() + + val betaManagedAgentsStreamSessionThreadEvents = + BetaManagedAgentsStreamSessionThreadEvents.ofEventStart(eventStart) + + assertThat(betaManagedAgentsStreamSessionThreadEvents.userMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userInterrupt()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userToolConfirmation()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userCustomToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentCustomToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThinking()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentMcpToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentMcpToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThreadMessageReceived()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThreadMessageSent()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThreadContextCompacted()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionError()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusRescheduled()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusTerminated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadCreated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanOutcomeEvaluationStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanOutcomeEvaluationEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanModelRequestStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanModelRequestEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanOutcomeEvaluationOngoing()) + .isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userDefineOutcome()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionDeleted()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusTerminated()) + .isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) + .isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).contains(eventStart) + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty + } + + @Test + fun ofEventStartRoundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStreamSessionThreadEvents = + BetaManagedAgentsStreamSessionThreadEvents.ofEventStart( + BetaManagedAgentsStartEvent.builder() + .agentMessageEvent("id") + .type(BetaManagedAgentsStartEvent.Type.EVENT_START) + .build() + ) + + val roundtrippedBetaManagedAgentsStreamSessionThreadEvents = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStreamSessionThreadEvents), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStreamSessionThreadEvents) + .isEqualTo(betaManagedAgentsStreamSessionThreadEvents) + } + + @Test + fun ofEventDelta() { + val eventDelta = + BetaManagedAgentsDeltaEvent.builder() + .delta( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + .eventId("event_id") + .type(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + .build() + + val betaManagedAgentsStreamSessionThreadEvents = + BetaManagedAgentsStreamSessionThreadEvents.ofEventDelta(eventDelta) + + assertThat(betaManagedAgentsStreamSessionThreadEvents.userMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userInterrupt()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userToolConfirmation()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userCustomToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentCustomToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentMessage()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThinking()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentMcpToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentMcpToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentToolUse()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThreadMessageReceived()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThreadMessageSent()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.agentThreadContextCompacted()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionError()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusRescheduled()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionStatusTerminated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadCreated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanOutcomeEvaluationStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanOutcomeEvaluationEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanModelRequestStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanModelRequestEnd()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.spanOutcomeEvaluationOngoing()) + .isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userDefineOutcome()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionDeleted()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRunning()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusIdle()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusTerminated()) + .isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.userToolResult()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) + .isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).contains(eventDelta) + assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()).isEmpty + } + + @Test + fun ofEventDeltaRoundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsStreamSessionThreadEvents = + BetaManagedAgentsStreamSessionThreadEvents.ofEventDelta( + BetaManagedAgentsDeltaEvent.builder() + .delta( + BetaManagedAgentsDeltaContent.builder() + .content( + BetaManagedAgentsTextBlock.builder() + .text("Where is my order #1234?") + .type(BetaManagedAgentsTextBlock.Type.TEXT) + .build() + ) + .type(BetaManagedAgentsDeltaContent.Type.CONTENT_DELTA) + .index(0L) + .build() + ) + .eventId("event_id") + .type(BetaManagedAgentsDeltaEvent.Type.EVENT_DELTA) + .build() + ) + + val roundtrippedBetaManagedAgentsStreamSessionThreadEvents = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsStreamSessionThreadEvents), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsStreamSessionThreadEvents) + .isEqualTo(betaManagedAgentsStreamSessionThreadEvents) + } + @Test fun ofSystemMessage() { val systemMessage = @@ -3223,6 +3462,8 @@ internal class BetaManagedAgentsStreamSessionThreadEventsTest { assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionThreadStatusRescheduled()) .isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.sessionUpdated()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventStart()).isEmpty + assertThat(betaManagedAgentsStreamSessionThreadEvents.eventDelta()).isEmpty assertThat(betaManagedAgentsStreamSessionThreadEvents.systemMessage()) .contains(systemMessage) } diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponseTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponseTest.kt index 05670462e..76677a4dd 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponseTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableAuthResponseTest.kt @@ -13,6 +13,12 @@ internal class BetaManagedAgentsEnvironmentVariableAuthResponseTest { fun create() { val betaManagedAgentsEnvironmentVariableAuthResponse = BetaManagedAgentsEnvironmentVariableAuthResponse.builder() + .injectionLocation( + BetaManagedAgentsInjectionLocationResponse.builder() + .body(true) + .header(true) + .build() + ) .networking( BetaManagedAgentsUnrestrictedCredentialNetworkingResponse.builder() .type( @@ -25,6 +31,10 @@ internal class BetaManagedAgentsEnvironmentVariableAuthResponseTest { .type(BetaManagedAgentsEnvironmentVariableAuthResponse.Type.ENVIRONMENT_VARIABLE) .build() + assertThat(betaManagedAgentsEnvironmentVariableAuthResponse.injectionLocation()) + .isEqualTo( + BetaManagedAgentsInjectionLocationResponse.builder().body(true).header(true).build() + ) assertThat(betaManagedAgentsEnvironmentVariableAuthResponse.networking()) .isEqualTo( BetaManagedAgentsEnvironmentVariableAuthResponse.Networking.ofUnrestricted( @@ -47,6 +57,12 @@ internal class BetaManagedAgentsEnvironmentVariableAuthResponseTest { val jsonMapper = jsonMapper() val betaManagedAgentsEnvironmentVariableAuthResponse = BetaManagedAgentsEnvironmentVariableAuthResponse.builder() + .injectionLocation( + BetaManagedAgentsInjectionLocationResponse.builder() + .body(true) + .header(true) + .build() + ) .networking( BetaManagedAgentsUnrestrictedCredentialNetworkingResponse.builder() .type( diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParamsTest.kt index cfe5b606d..0576568a2 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParamsTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableCreateParamsTest.kt @@ -24,6 +24,12 @@ internal class BetaManagedAgentsEnvironmentVariableCreateParamsTest { .secretName("x") .secretValue("x") .type(BetaManagedAgentsEnvironmentVariableCreateParams.Type.ENVIRONMENT_VARIABLE) + .injectionLocation( + BetaManagedAgentsInjectionLocationParams.builder() + .body(true) + .header(true) + .build() + ) .build() assertThat(betaManagedAgentsEnvironmentVariableCreateParams.networking()) @@ -41,6 +47,10 @@ internal class BetaManagedAgentsEnvironmentVariableCreateParamsTest { assertThat(betaManagedAgentsEnvironmentVariableCreateParams.secretValue()).isEqualTo("x") assertThat(betaManagedAgentsEnvironmentVariableCreateParams.type()) .isEqualTo(BetaManagedAgentsEnvironmentVariableCreateParams.Type.ENVIRONMENT_VARIABLE) + assertThat(betaManagedAgentsEnvironmentVariableCreateParams.injectionLocation()) + .contains( + BetaManagedAgentsInjectionLocationParams.builder().body(true).header(true).build() + ) } @Test @@ -59,6 +69,12 @@ internal class BetaManagedAgentsEnvironmentVariableCreateParamsTest { .secretName("x") .secretValue("x") .type(BetaManagedAgentsEnvironmentVariableCreateParams.Type.ENVIRONMENT_VARIABLE) + .injectionLocation( + BetaManagedAgentsInjectionLocationParams.builder() + .body(true) + .header(true) + .build() + ) .build() val roundtrippedBetaManagedAgentsEnvironmentVariableCreateParams = diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParamsTest.kt index 4a98d6d4e..06b9f1cb9 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParamsTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsEnvironmentVariableUpdateParamsTest.kt @@ -14,6 +14,12 @@ internal class BetaManagedAgentsEnvironmentVariableUpdateParamsTest { val betaManagedAgentsEnvironmentVariableUpdateParams = BetaManagedAgentsEnvironmentVariableUpdateParams.builder() .type(BetaManagedAgentsEnvironmentVariableUpdateParams.Type.ENVIRONMENT_VARIABLE) + .injectionLocation( + BetaManagedAgentsInjectionLocationUpdateParams.builder() + .body(true) + .header(true) + .build() + ) .networking( BetaManagedAgentsUnrestrictedCredentialNetworkingParams.builder() .type( @@ -27,6 +33,13 @@ internal class BetaManagedAgentsEnvironmentVariableUpdateParamsTest { assertThat(betaManagedAgentsEnvironmentVariableUpdateParams.type()) .isEqualTo(BetaManagedAgentsEnvironmentVariableUpdateParams.Type.ENVIRONMENT_VARIABLE) + assertThat(betaManagedAgentsEnvironmentVariableUpdateParams.injectionLocation()) + .contains( + BetaManagedAgentsInjectionLocationUpdateParams.builder() + .body(true) + .header(true) + .build() + ) assertThat(betaManagedAgentsEnvironmentVariableUpdateParams.networking()) .contains( BetaManagedAgentsCredentialNetworkingParams.ofUnrestricted( @@ -47,6 +60,12 @@ internal class BetaManagedAgentsEnvironmentVariableUpdateParamsTest { val betaManagedAgentsEnvironmentVariableUpdateParams = BetaManagedAgentsEnvironmentVariableUpdateParams.builder() .type(BetaManagedAgentsEnvironmentVariableUpdateParams.Type.ENVIRONMENT_VARIABLE) + .injectionLocation( + BetaManagedAgentsInjectionLocationUpdateParams.builder() + .body(true) + .header(true) + .build() + ) .networking( BetaManagedAgentsUnrestrictedCredentialNetworkingParams.builder() .type( diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationParamsTest.kt new file mode 100644 index 000000000..68cae6798 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationParamsTest.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.vaults.credentials + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsInjectionLocationParamsTest { + + @Test + fun create() { + val betaManagedAgentsInjectionLocationParams = + BetaManagedAgentsInjectionLocationParams.builder().body(true).header(true).build() + + assertThat(betaManagedAgentsInjectionLocationParams.body()).contains(true) + assertThat(betaManagedAgentsInjectionLocationParams.header()).contains(true) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsInjectionLocationParams = + BetaManagedAgentsInjectionLocationParams.builder().body(true).header(true).build() + + val roundtrippedBetaManagedAgentsInjectionLocationParams = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsInjectionLocationParams), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsInjectionLocationParams) + .isEqualTo(betaManagedAgentsInjectionLocationParams) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationResponseTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationResponseTest.kt new file mode 100644 index 000000000..d8fdc263c --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationResponseTest.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.vaults.credentials + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsInjectionLocationResponseTest { + + @Test + fun create() { + val betaManagedAgentsInjectionLocationResponse = + BetaManagedAgentsInjectionLocationResponse.builder().body(true).header(true).build() + + assertThat(betaManagedAgentsInjectionLocationResponse.body()).isEqualTo(true) + assertThat(betaManagedAgentsInjectionLocationResponse.header()).isEqualTo(true) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsInjectionLocationResponse = + BetaManagedAgentsInjectionLocationResponse.builder().body(true).header(true).build() + + val roundtrippedBetaManagedAgentsInjectionLocationResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsInjectionLocationResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsInjectionLocationResponse) + .isEqualTo(betaManagedAgentsInjectionLocationResponse) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationUpdateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationUpdateParamsTest.kt new file mode 100644 index 000000000..0dcc47915 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/vaults/credentials/BetaManagedAgentsInjectionLocationUpdateParamsTest.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.vaults.credentials + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaManagedAgentsInjectionLocationUpdateParamsTest { + + @Test + fun create() { + val betaManagedAgentsInjectionLocationUpdateParams = + BetaManagedAgentsInjectionLocationUpdateParams.builder().body(true).header(true).build() + + assertThat(betaManagedAgentsInjectionLocationUpdateParams.body()).contains(true) + assertThat(betaManagedAgentsInjectionLocationUpdateParams.header()).contains(true) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaManagedAgentsInjectionLocationUpdateParams = + BetaManagedAgentsInjectionLocationUpdateParams.builder().body(true).header(true).build() + + val roundtrippedBetaManagedAgentsInjectionLocationUpdateParams = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaManagedAgentsInjectionLocationUpdateParams), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaManagedAgentsInjectionLocationUpdateParams) + .isEqualTo(betaManagedAgentsInjectionLocationUpdateParams) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentArchivedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentArchivedEventDataTest.kt new file mode 100644 index 000000000..40f2b5455 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentArchivedEventDataTest.kt @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookAgentArchivedEventDataTest { + + @Test + fun create() { + val betaWebhookAgentArchivedEventData = + BetaWebhookAgentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookAgentArchivedEventData.id()).isEqualTo("id") + assertThat(betaWebhookAgentArchivedEventData.organizationId()).isEqualTo("organization_id") + assertThat(betaWebhookAgentArchivedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookAgentArchivedEventData = + BetaWebhookAgentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookAgentArchivedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookAgentArchivedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookAgentArchivedEventData) + .isEqualTo(betaWebhookAgentArchivedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentCreatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentCreatedEventDataTest.kt new file mode 100644 index 000000000..fc948d6e8 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentCreatedEventDataTest.kt @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookAgentCreatedEventDataTest { + + @Test + fun create() { + val betaWebhookAgentCreatedEventData = + BetaWebhookAgentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookAgentCreatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookAgentCreatedEventData.organizationId()).isEqualTo("organization_id") + assertThat(betaWebhookAgentCreatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookAgentCreatedEventData = + BetaWebhookAgentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookAgentCreatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookAgentCreatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookAgentCreatedEventData) + .isEqualTo(betaWebhookAgentCreatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentDeletedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentDeletedEventDataTest.kt new file mode 100644 index 000000000..2f02ec875 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentDeletedEventDataTest.kt @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookAgentDeletedEventDataTest { + + @Test + fun create() { + val betaWebhookAgentDeletedEventData = + BetaWebhookAgentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookAgentDeletedEventData.id()).isEqualTo("id") + assertThat(betaWebhookAgentDeletedEventData.organizationId()).isEqualTo("organization_id") + assertThat(betaWebhookAgentDeletedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookAgentDeletedEventData = + BetaWebhookAgentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookAgentDeletedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookAgentDeletedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookAgentDeletedEventData) + .isEqualTo(betaWebhookAgentDeletedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentUpdatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentUpdatedEventDataTest.kt new file mode 100644 index 000000000..bf02bbc95 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookAgentUpdatedEventDataTest.kt @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookAgentUpdatedEventDataTest { + + @Test + fun create() { + val betaWebhookAgentUpdatedEventData = + BetaWebhookAgentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookAgentUpdatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookAgentUpdatedEventData.organizationId()).isEqualTo("organization_id") + assertThat(betaWebhookAgentUpdatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookAgentUpdatedEventData = + BetaWebhookAgentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookAgentUpdatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookAgentUpdatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookAgentUpdatedEventData) + .isEqualTo(betaWebhookAgentUpdatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentArchivedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentArchivedEventDataTest.kt new file mode 100644 index 000000000..b88f61a45 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentArchivedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentArchivedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentArchivedEventData = + BetaWebhookDeploymentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentArchivedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentArchivedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentArchivedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentArchivedEventData = + BetaWebhookDeploymentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentArchivedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentArchivedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentArchivedEventData) + .isEqualTo(betaWebhookDeploymentArchivedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentCreatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentCreatedEventDataTest.kt new file mode 100644 index 000000000..7bb8caf56 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentCreatedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentCreatedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentCreatedEventData = + BetaWebhookDeploymentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentCreatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentCreatedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentCreatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentCreatedEventData = + BetaWebhookDeploymentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentCreatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentCreatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentCreatedEventData) + .isEqualTo(betaWebhookDeploymentCreatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentDeletedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentDeletedEventDataTest.kt new file mode 100644 index 000000000..0b9545b7e --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentDeletedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentDeletedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentDeletedEventData = + BetaWebhookDeploymentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentDeletedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentDeletedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentDeletedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentDeletedEventData = + BetaWebhookDeploymentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentDeletedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentDeletedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentDeletedEventData) + .isEqualTo(betaWebhookDeploymentDeletedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentPausedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentPausedEventDataTest.kt new file mode 100644 index 000000000..880bb26a4 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentPausedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentPausedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentPausedEventData = + BetaWebhookDeploymentPausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentPausedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentPausedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentPausedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentPausedEventData = + BetaWebhookDeploymentPausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentPausedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentPausedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentPausedEventData) + .isEqualTo(betaWebhookDeploymentPausedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunFailedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunFailedEventDataTest.kt new file mode 100644 index 000000000..904e12638 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunFailedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentRunFailedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentRunFailedEventData = + BetaWebhookDeploymentRunFailedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentRunFailedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentRunFailedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentRunFailedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentRunFailedEventData = + BetaWebhookDeploymentRunFailedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentRunFailedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentRunFailedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentRunFailedEventData) + .isEqualTo(betaWebhookDeploymentRunFailedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunStartedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunStartedEventDataTest.kt new file mode 100644 index 000000000..8f9da1f10 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunStartedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentRunStartedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentRunStartedEventData = + BetaWebhookDeploymentRunStartedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentRunStartedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentRunStartedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentRunStartedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentRunStartedEventData = + BetaWebhookDeploymentRunStartedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentRunStartedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentRunStartedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentRunStartedEventData) + .isEqualTo(betaWebhookDeploymentRunStartedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunSucceededEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunSucceededEventDataTest.kt new file mode 100644 index 000000000..877784f1b --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentRunSucceededEventDataTest.kt @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentRunSucceededEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentRunSucceededEventData = + BetaWebhookDeploymentRunSucceededEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentRunSucceededEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentRunSucceededEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentRunSucceededEventData.workspaceId()) + .isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentRunSucceededEventData = + BetaWebhookDeploymentRunSucceededEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentRunSucceededEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentRunSucceededEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentRunSucceededEventData) + .isEqualTo(betaWebhookDeploymentRunSucceededEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUnpausedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUnpausedEventDataTest.kt new file mode 100644 index 000000000..3b84466ff --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUnpausedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentUnpausedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentUnpausedEventData = + BetaWebhookDeploymentUnpausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentUnpausedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentUnpausedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentUnpausedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentUnpausedEventData = + BetaWebhookDeploymentUnpausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentUnpausedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentUnpausedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentUnpausedEventData) + .isEqualTo(betaWebhookDeploymentUnpausedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUpdatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUpdatedEventDataTest.kt new file mode 100644 index 000000000..480780549 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookDeploymentUpdatedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookDeploymentUpdatedEventDataTest { + + @Test + fun create() { + val betaWebhookDeploymentUpdatedEventData = + BetaWebhookDeploymentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookDeploymentUpdatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookDeploymentUpdatedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookDeploymentUpdatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookDeploymentUpdatedEventData = + BetaWebhookDeploymentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookDeploymentUpdatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookDeploymentUpdatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookDeploymentUpdatedEventData) + .isEqualTo(betaWebhookDeploymentUpdatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentArchivedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentArchivedEventDataTest.kt new file mode 100644 index 000000000..0a25685d0 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentArchivedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookEnvironmentArchivedEventDataTest { + + @Test + fun create() { + val betaWebhookEnvironmentArchivedEventData = + BetaWebhookEnvironmentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookEnvironmentArchivedEventData.id()).isEqualTo("id") + assertThat(betaWebhookEnvironmentArchivedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookEnvironmentArchivedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEnvironmentArchivedEventData = + BetaWebhookEnvironmentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookEnvironmentArchivedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEnvironmentArchivedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEnvironmentArchivedEventData) + .isEqualTo(betaWebhookEnvironmentArchivedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentCreatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentCreatedEventDataTest.kt new file mode 100644 index 000000000..047de2d43 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentCreatedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookEnvironmentCreatedEventDataTest { + + @Test + fun create() { + val betaWebhookEnvironmentCreatedEventData = + BetaWebhookEnvironmentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookEnvironmentCreatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookEnvironmentCreatedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookEnvironmentCreatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEnvironmentCreatedEventData = + BetaWebhookEnvironmentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookEnvironmentCreatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEnvironmentCreatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEnvironmentCreatedEventData) + .isEqualTo(betaWebhookEnvironmentCreatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventDataTest.kt new file mode 100644 index 000000000..982963906 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentDeletedEventDataTest.kt @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookEnvironmentDeletedEventDataTest { + + @Test + fun create() { + val betaWebhookEnvironmentDeletedEventData = + BetaWebhookEnvironmentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .type(BetaWebhookEnvironmentDeletedEventType.ENVIRONMENT_DELETED) + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookEnvironmentDeletedEventData.id()).isEqualTo("id") + assertThat(betaWebhookEnvironmentDeletedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookEnvironmentDeletedEventData.type()) + .isEqualTo(BetaWebhookEnvironmentDeletedEventType.ENVIRONMENT_DELETED) + assertThat(betaWebhookEnvironmentDeletedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEnvironmentDeletedEventData = + BetaWebhookEnvironmentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .type(BetaWebhookEnvironmentDeletedEventType.ENVIRONMENT_DELETED) + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookEnvironmentDeletedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEnvironmentDeletedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEnvironmentDeletedEventData) + .isEqualTo(betaWebhookEnvironmentDeletedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentUpdatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentUpdatedEventDataTest.kt new file mode 100644 index 000000000..7d86a08e6 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEnvironmentUpdatedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookEnvironmentUpdatedEventDataTest { + + @Test + fun create() { + val betaWebhookEnvironmentUpdatedEventData = + BetaWebhookEnvironmentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookEnvironmentUpdatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookEnvironmentUpdatedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookEnvironmentUpdatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEnvironmentUpdatedEventData = + BetaWebhookEnvironmentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookEnvironmentUpdatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEnvironmentUpdatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEnvironmentUpdatedEventData) + .isEqualTo(betaWebhookEnvironmentUpdatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventDataTest.kt index e364b18b7..812d60bac 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventDataTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookEventDataTest.kt @@ -48,6 +48,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -105,6 +125,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -162,6 +202,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -219,6 +279,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -277,6 +357,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -334,6 +434,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -391,6 +511,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -450,6 +590,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -508,6 +668,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -565,6 +745,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -623,6 +823,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -681,6 +901,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -740,6 +980,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -800,6 +1060,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -860,6 +1140,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -917,6 +1217,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -974,6 +1294,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1031,6 +1371,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1090,6 +1450,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1150,6 +1530,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1210,6 +1610,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).contains(vaultCredentialDeleted) assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1271,6 +1691,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()) .contains(vaultCredentialRefreshFailed) assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1329,6 +1769,26 @@ internal class BetaWebhookEventDataTest { assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty assertThat(betaWebhookEventData.sessionUpdated()).contains(sessionUpdated) + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty } @Test @@ -1352,6 +1812,1549 @@ internal class BetaWebhookEventDataTest { assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) } + @Test + fun ofAgentCreated() { + val agentCreated = + BetaWebhookAgentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofAgentCreated(agentCreated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).contains(agentCreated) + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofAgentCreatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofAgentCreated( + BetaWebhookAgentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofAgentArchived() { + val agentArchived = + BetaWebhookAgentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofAgentArchived(agentArchived) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).contains(agentArchived) + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofAgentArchivedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofAgentArchived( + BetaWebhookAgentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofAgentDeleted() { + val agentDeleted = + BetaWebhookAgentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofAgentDeleted(agentDeleted) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).contains(agentDeleted) + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofAgentDeletedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofAgentDeleted( + BetaWebhookAgentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentPaused() { + val deploymentPaused = + BetaWebhookDeploymentPausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentPaused(deploymentPaused) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).contains(deploymentPaused) + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentPausedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentPaused( + BetaWebhookDeploymentPausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentRunFailed() { + val deploymentRunFailed = + BetaWebhookDeploymentRunFailedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentRunFailed(deploymentRunFailed) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).contains(deploymentRunFailed) + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentRunFailedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentRunFailed( + BetaWebhookDeploymentRunFailedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentCreated() { + val deploymentCreated = + BetaWebhookDeploymentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentCreated(deploymentCreated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).contains(deploymentCreated) + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentCreatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentCreated( + BetaWebhookDeploymentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentUpdated() { + val deploymentUpdated = + BetaWebhookDeploymentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentUpdated(deploymentUpdated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).contains(deploymentUpdated) + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentUpdatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentUpdated( + BetaWebhookDeploymentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentUnpaused() { + val deploymentUnpaused = + BetaWebhookDeploymentUnpausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentUnpaused(deploymentUnpaused) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).contains(deploymentUnpaused) + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentUnpausedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentUnpaused( + BetaWebhookDeploymentUnpausedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofAgentUpdated() { + val agentUpdated = + BetaWebhookAgentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofAgentUpdated(agentUpdated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).contains(agentUpdated) + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofAgentUpdatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofAgentUpdated( + BetaWebhookAgentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentArchived() { + val deploymentArchived = + BetaWebhookDeploymentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentArchived(deploymentArchived) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).contains(deploymentArchived) + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentArchivedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentArchived( + BetaWebhookDeploymentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentRunStarted() { + val deploymentRunStarted = + BetaWebhookDeploymentRunStartedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentRunStarted(deploymentRunStarted) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).contains(deploymentRunStarted) + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentRunStartedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentRunStarted( + BetaWebhookDeploymentRunStartedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentDeleted() { + val deploymentDeleted = + BetaWebhookDeploymentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofDeploymentDeleted(deploymentDeleted) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).contains(deploymentDeleted) + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentDeletedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentDeleted( + BetaWebhookDeploymentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofDeploymentRunSucceeded() { + val deploymentRunSucceeded = + BetaWebhookDeploymentRunSucceededEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentRunSucceeded(deploymentRunSucceeded) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).contains(deploymentRunSucceeded) + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofDeploymentRunSucceededRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofDeploymentRunSucceeded( + BetaWebhookDeploymentRunSucceededEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofEnvironmentCreated() { + val environmentCreated = + BetaWebhookEnvironmentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofEnvironmentCreated(environmentCreated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).contains(environmentCreated) + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofEnvironmentCreatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofEnvironmentCreated( + BetaWebhookEnvironmentCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofEnvironmentUpdated() { + val environmentUpdated = + BetaWebhookEnvironmentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofEnvironmentUpdated(environmentUpdated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).contains(environmentUpdated) + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofEnvironmentUpdatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofEnvironmentUpdated( + BetaWebhookEnvironmentUpdatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofEnvironmentArchived() { + val environmentArchived = + BetaWebhookEnvironmentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofEnvironmentArchived(environmentArchived) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).contains(environmentArchived) + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofEnvironmentArchivedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofEnvironmentArchived( + BetaWebhookEnvironmentArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofEnvironmentDeleted() { + val environmentDeleted = + BetaWebhookEnvironmentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .type(BetaWebhookEnvironmentDeletedEventType.ENVIRONMENT_DELETED) + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofEnvironmentDeleted(environmentDeleted) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).contains(environmentDeleted) + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofEnvironmentDeletedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofEnvironmentDeleted( + BetaWebhookEnvironmentDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .type(BetaWebhookEnvironmentDeletedEventType.ENVIRONMENT_DELETED) + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofMemoryStoreCreated() { + val memoryStoreCreated = + BetaWebhookMemoryStoreCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofMemoryStoreCreated(memoryStoreCreated) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).contains(memoryStoreCreated) + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofMemoryStoreCreatedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofMemoryStoreCreated( + BetaWebhookMemoryStoreCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofMemoryStoreArchived() { + val memoryStoreArchived = + BetaWebhookMemoryStoreArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofMemoryStoreArchived(memoryStoreArchived) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).contains(memoryStoreArchived) + assertThat(betaWebhookEventData.memoryStoreDeleted()).isEmpty + } + + @Test + fun ofMemoryStoreArchivedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofMemoryStoreArchived( + BetaWebhookMemoryStoreArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + + @Test + fun ofMemoryStoreDeleted() { + val memoryStoreDeleted = + BetaWebhookMemoryStoreDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val betaWebhookEventData = BetaWebhookEventData.ofMemoryStoreDeleted(memoryStoreDeleted) + + assertThat(betaWebhookEventData.sessionCreated()).isEmpty + assertThat(betaWebhookEventData.sessionPending()).isEmpty + assertThat(betaWebhookEventData.sessionRunning()).isEmpty + assertThat(betaWebhookEventData.sessionIdled()).isEmpty + assertThat(betaWebhookEventData.sessionRequiresAction()).isEmpty + assertThat(betaWebhookEventData.sessionArchived()).isEmpty + assertThat(betaWebhookEventData.sessionDeleted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRescheduled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusRunStarted()).isEmpty + assertThat(betaWebhookEventData.sessionStatusIdled()).isEmpty + assertThat(betaWebhookEventData.sessionStatusTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadCreated()).isEmpty + assertThat(betaWebhookEventData.sessionThreadIdled()).isEmpty + assertThat(betaWebhookEventData.sessionThreadTerminated()).isEmpty + assertThat(betaWebhookEventData.sessionOutcomeEvaluationEnded()).isEmpty + assertThat(betaWebhookEventData.vaultCreated()).isEmpty + assertThat(betaWebhookEventData.vaultArchived()).isEmpty + assertThat(betaWebhookEventData.vaultDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialCreated()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialArchived()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialDeleted()).isEmpty + assertThat(betaWebhookEventData.vaultCredentialRefreshFailed()).isEmpty + assertThat(betaWebhookEventData.sessionUpdated()).isEmpty + assertThat(betaWebhookEventData.agentCreated()).isEmpty + assertThat(betaWebhookEventData.agentArchived()).isEmpty + assertThat(betaWebhookEventData.agentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentPaused()).isEmpty + assertThat(betaWebhookEventData.deploymentRunFailed()).isEmpty + assertThat(betaWebhookEventData.deploymentCreated()).isEmpty + assertThat(betaWebhookEventData.deploymentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentUnpaused()).isEmpty + assertThat(betaWebhookEventData.agentUpdated()).isEmpty + assertThat(betaWebhookEventData.deploymentArchived()).isEmpty + assertThat(betaWebhookEventData.deploymentRunStarted()).isEmpty + assertThat(betaWebhookEventData.deploymentDeleted()).isEmpty + assertThat(betaWebhookEventData.deploymentRunSucceeded()).isEmpty + assertThat(betaWebhookEventData.environmentCreated()).isEmpty + assertThat(betaWebhookEventData.environmentUpdated()).isEmpty + assertThat(betaWebhookEventData.environmentArchived()).isEmpty + assertThat(betaWebhookEventData.environmentDeleted()).isEmpty + assertThat(betaWebhookEventData.memoryStoreCreated()).isEmpty + assertThat(betaWebhookEventData.memoryStoreArchived()).isEmpty + assertThat(betaWebhookEventData.memoryStoreDeleted()).contains(memoryStoreDeleted) + } + + @Test + fun ofMemoryStoreDeletedRoundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookEventData = + BetaWebhookEventData.ofMemoryStoreDeleted( + BetaWebhookMemoryStoreDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + ) + + val roundtrippedBetaWebhookEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookEventData).isEqualTo(betaWebhookEventData) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreArchivedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreArchivedEventDataTest.kt new file mode 100644 index 000000000..cdcaa36fc --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreArchivedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookMemoryStoreArchivedEventDataTest { + + @Test + fun create() { + val betaWebhookMemoryStoreArchivedEventData = + BetaWebhookMemoryStoreArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookMemoryStoreArchivedEventData.id()).isEqualTo("id") + assertThat(betaWebhookMemoryStoreArchivedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookMemoryStoreArchivedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookMemoryStoreArchivedEventData = + BetaWebhookMemoryStoreArchivedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookMemoryStoreArchivedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookMemoryStoreArchivedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookMemoryStoreArchivedEventData) + .isEqualTo(betaWebhookMemoryStoreArchivedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreCreatedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreCreatedEventDataTest.kt new file mode 100644 index 000000000..cfc4ad701 --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreCreatedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookMemoryStoreCreatedEventDataTest { + + @Test + fun create() { + val betaWebhookMemoryStoreCreatedEventData = + BetaWebhookMemoryStoreCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookMemoryStoreCreatedEventData.id()).isEqualTo("id") + assertThat(betaWebhookMemoryStoreCreatedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookMemoryStoreCreatedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookMemoryStoreCreatedEventData = + BetaWebhookMemoryStoreCreatedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookMemoryStoreCreatedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookMemoryStoreCreatedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookMemoryStoreCreatedEventData) + .isEqualTo(betaWebhookMemoryStoreCreatedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreDeletedEventDataTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreDeletedEventDataTest.kt new file mode 100644 index 000000000..9dbe5ff8c --- /dev/null +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/webhooks/BetaWebhookMemoryStoreDeletedEventDataTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.anthropic.models.beta.webhooks + +import com.anthropic.core.jsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BetaWebhookMemoryStoreDeletedEventDataTest { + + @Test + fun create() { + val betaWebhookMemoryStoreDeletedEventData = + BetaWebhookMemoryStoreDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + assertThat(betaWebhookMemoryStoreDeletedEventData.id()).isEqualTo("id") + assertThat(betaWebhookMemoryStoreDeletedEventData.organizationId()) + .isEqualTo("organization_id") + assertThat(betaWebhookMemoryStoreDeletedEventData.workspaceId()).isEqualTo("workspace_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val betaWebhookMemoryStoreDeletedEventData = + BetaWebhookMemoryStoreDeletedEventData.builder() + .id("id") + .organizationId("organization_id") + .workspaceId("workspace_id") + .build() + + val roundtrippedBetaWebhookMemoryStoreDeletedEventData = + jsonMapper.readValue( + jsonMapper.writeValueAsString(betaWebhookMemoryStoreDeletedEventData), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBetaWebhookMemoryStoreDeletedEventData) + .isEqualTo(betaWebhookMemoryStoreDeletedEventData) + } +} diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/sessions/EventServiceAsyncTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/sessions/EventServiceAsyncTest.kt index 64fb7ee7f..df524acd2 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/sessions/EventServiceAsyncTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/sessions/EventServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.anthropic.services.async.beta.sessions import com.anthropic.TestServerExtension import com.anthropic.client.okhttp.AnthropicOkHttpClientAsync import com.anthropic.models.beta.AnthropicBeta +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaType import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams import com.anthropic.models.beta.sessions.events.EventSendParams @@ -76,6 +77,7 @@ internal class EventServiceAsyncTest { eventServiceAsync.streamStreaming( EventStreamParams.builder() .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addEventDelta(BetaManagedAgentsDeltaType.AGENT_MESSAGE) .addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24) .build() ) diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/sessions/EventServiceTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/sessions/EventServiceTest.kt index 89c6adedf..4e2a32a77 100644 --- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/sessions/EventServiceTest.kt +++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/sessions/EventServiceTest.kt @@ -5,6 +5,7 @@ package com.anthropic.services.blocking.beta.sessions import com.anthropic.TestServerExtension import com.anthropic.client.okhttp.AnthropicOkHttpClient import com.anthropic.models.beta.AnthropicBeta +import com.anthropic.models.beta.sessions.BetaManagedAgentsDeltaType import com.anthropic.models.beta.sessions.events.BetaManagedAgentsTextBlock import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams import com.anthropic.models.beta.sessions.events.EventSendParams @@ -74,6 +75,7 @@ internal class EventServiceTest { eventService.streamStreaming( EventStreamParams.builder() .sessionId("sesn_011CZkZAtmR3yMPDzynEDxu7") + .addEventDelta(BetaManagedAgentsDeltaType.AGENT_MESSAGE) .addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24) .build() ) diff --git a/build.gradle.kts b/build.gradle.kts index 025a5580b..5425576c9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.anthropic" - version = "2.46.0" // x-release-please-version + version = "2.47.0" // x-release-please-version }