diff --git a/.stats.yml b/.stats.yml index abb82a2b..fb939f93 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 96 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/manugoyal%2Fbraintrust-sdk-938d5abfeeda9e7cb58c9ad6df1cd7bb663715a79310601559b12230fca1cced.yml +configured_endpoints: 97 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/manugoyal%2Fbraintrust-sdk-35ca662bf69021273747db3b70d40b924819af0f6e01b38001c7c1ae2f8a4712.yml diff --git a/README.md b/README.md index 4bef23db..51dc35d9 100755 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ if (field.isMissing()) { Sometimes, the server response may include additional properties that are not yet available in this library's types. You can access them using the model's `_additionalProperties` method: ```kotlin -val secret = acl._additionalProperties().get("secret_field") +val secret = aISecret._additionalProperties().get("secret_field") ``` --- diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClient.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClient.kt index b4053a50..f48c8d01 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClient.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClient.kt @@ -41,5 +41,5 @@ interface BraintrustClient { fun apiKeyResource(): ApiKeyResourceService - fun orgSecret(): OrgSecretService + fun aiSecret(): AiSecretService } diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsync.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsync.kt index dc12199a..a5873b1e 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsync.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsync.kt @@ -41,5 +41,5 @@ interface BraintrustClientAsync { fun apiKeyResource(): ApiKeyResourceServiceAsync - fun orgSecret(): OrgSecretServiceAsync + fun aiSecret(): AiSecretServiceAsync } diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsyncImpl.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsyncImpl.kt index 556b4e18..113a10da 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsyncImpl.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsyncImpl.kt @@ -58,9 +58,7 @@ constructor( ApiKeyResourceServiceAsyncImpl(clientOptions) } - private val orgSecret: OrgSecretServiceAsync by lazy { - OrgSecretServiceAsyncImpl(clientOptions) - } + private val aiSecret: AiSecretServiceAsync by lazy { AiSecretServiceAsyncImpl(clientOptions) } override fun sync(): BraintrustClient = sync @@ -94,5 +92,5 @@ constructor( override fun apiKeyResource(): ApiKeyResourceServiceAsync = apiKeyResource - override fun orgSecret(): OrgSecretServiceAsync = orgSecret + override fun aiSecret(): AiSecretServiceAsync = aiSecret } diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientImpl.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientImpl.kt index 700ede21..c0d3cbe1 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientImpl.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientImpl.kt @@ -50,7 +50,7 @@ constructor( ApiKeyResourceServiceImpl(clientOptions) } - private val orgSecret: OrgSecretService by lazy { OrgSecretServiceImpl(clientOptions) } + private val aiSecret: AiSecretService by lazy { AiSecretServiceImpl(clientOptions) } override fun async(): BraintrustClientAsync = async @@ -84,5 +84,5 @@ constructor( override fun apiKeyResource(): ApiKeyResourceService = apiKeyResource - override fun orgSecret(): OrgSecretService = orgSecret + override fun aiSecret(): AiSecretService = aiSecret } diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecret.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecret.kt old mode 100755 new mode 100644 similarity index 86% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecret.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecret.kt index d6dccc5f..6931612a --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecret.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecret.kt @@ -15,9 +15,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.time.OffsetDateTime import java.util.Objects -@JsonDeserialize(builder = OrgSecret.Builder::class) +@JsonDeserialize(builder = AISecret.Builder::class) @NoAutoDetect -class OrgSecret +class AISecret private constructor( private val id: JsonField, private val created: JsonField, @@ -33,16 +33,16 @@ private constructor( private var hashCode: Int = 0 - /** Unique identifier for the org secret */ + /** Unique identifier for the AI secret */ fun id(): String = id.getRequired("id") - /** Date of org secret creation */ + /** Date of AI secret creation */ fun created(): OffsetDateTime? = created.getNullable("created") /** Unique identifier for the organization */ fun orgId(): String = orgId.getRequired("org_id") - /** Name of the org secret */ + /** Name of the AI secret */ fun name(): String = name.getRequired("name") fun type(): String? = type.getNullable("type") @@ -51,16 +51,16 @@ private constructor( fun previewSecret(): String? = previewSecret.getNullable("preview_secret") - /** Unique identifier for the org secret */ + /** Unique identifier for the AI secret */ @JsonProperty("id") @ExcludeMissing fun _id() = id - /** Date of org secret creation */ + /** Date of AI secret creation */ @JsonProperty("created") @ExcludeMissing fun _created() = created /** Unique identifier for the organization */ @JsonProperty("org_id") @ExcludeMissing fun _orgId() = orgId - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("type") @ExcludeMissing fun _type() = type @@ -73,7 +73,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): OrgSecret = apply { + fun validate(): AISecret = apply { if (!validated) { id() created() @@ -93,7 +93,7 @@ private constructor( return true } - return other is OrgSecret && + return other is AISecret && this.id == other.id && this.created == other.created && this.orgId == other.orgId && @@ -122,7 +122,7 @@ private constructor( } override fun toString() = - "OrgSecret{id=$id, created=$created, orgId=$orgId, name=$name, type=$type, metadata=$metadata, previewSecret=$previewSecret, additionalProperties=$additionalProperties}" + "AISecret{id=$id, created=$created, orgId=$orgId, name=$name, type=$type, metadata=$metadata, previewSecret=$previewSecret, additionalProperties=$additionalProperties}" companion object { @@ -140,27 +140,27 @@ private constructor( private var previewSecret: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(orgSecret: OrgSecret) = apply { - this.id = orgSecret.id - this.created = orgSecret.created - this.orgId = orgSecret.orgId - this.name = orgSecret.name - this.type = orgSecret.type - this.metadata = orgSecret.metadata - this.previewSecret = orgSecret.previewSecret - additionalProperties(orgSecret.additionalProperties) + internal fun from(aiSecret: AISecret) = apply { + this.id = aiSecret.id + this.created = aiSecret.created + this.orgId = aiSecret.orgId + this.name = aiSecret.name + this.type = aiSecret.type + this.metadata = aiSecret.metadata + this.previewSecret = aiSecret.previewSecret + additionalProperties(aiSecret.additionalProperties) } - /** Unique identifier for the org secret */ + /** Unique identifier for the AI secret */ fun id(id: String) = id(JsonField.of(id)) - /** Unique identifier for the org secret */ + /** Unique identifier for the AI secret */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** Date of org secret creation */ + /** Date of AI secret creation */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) - /** Date of org secret creation */ + /** Date of AI secret creation */ @JsonProperty("created") @ExcludeMissing fun created(created: JsonField) = apply { this.created = created } @@ -173,10 +173,10 @@ private constructor( @ExcludeMissing fun orgId(orgId: JsonField) = apply { this.orgId = orgId } - /** Name of the org secret */ + /** Name of the AI secret */ fun name(name: String) = name(JsonField.of(name)) - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } @@ -215,8 +215,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): OrgSecret = - OrgSecret( + fun build(): AISecret = + AISecret( id, created, orgId, diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretReplaceParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt old mode 100755 new mode 100644 similarity index 85% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretReplaceParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt index bd7b6143..c6360608 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretReplaceParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretCreateParams.kt @@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.util.Objects -class OrgSecretReplaceParams +class AiSecretCreateParams constructor( private val name: String, private val metadata: Metadata?, @@ -35,8 +35,8 @@ constructor( fun type(): String? = type - internal fun getBody(): OrgSecretReplaceBody { - return OrgSecretReplaceBody( + internal fun getBody(): AiSecretCreateBody { + return AiSecretCreateBody( name, metadata, orgName, @@ -50,9 +50,9 @@ constructor( internal fun getHeaders(): Map> = additionalHeaders - @JsonDeserialize(builder = OrgSecretReplaceBody.Builder::class) + @JsonDeserialize(builder = AiSecretCreateBody.Builder::class) @NoAutoDetect - class OrgSecretReplaceBody + class AiSecretCreateBody internal constructor( private val name: String?, private val metadata: Metadata?, @@ -64,7 +64,7 @@ constructor( private var hashCode: Int = 0 - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(): String? = name @JsonProperty("metadata") fun metadata(): Metadata? = metadata @@ -72,7 +72,7 @@ constructor( /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ @JsonProperty("org_name") fun orgName(): String? = orgName @@ -95,7 +95,7 @@ constructor( return true } - return other is OrgSecretReplaceBody && + return other is AiSecretCreateBody && this.name == other.name && this.metadata == other.metadata && this.orgName == other.orgName && @@ -120,7 +120,7 @@ constructor( } override fun toString() = - "OrgSecretReplaceBody{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalProperties=$additionalProperties}" + "AiSecretCreateBody{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -136,16 +136,16 @@ constructor( private var type: String? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretReplaceBody: OrgSecretReplaceBody) = apply { - this.name = orgSecretReplaceBody.name - this.metadata = orgSecretReplaceBody.metadata - this.orgName = orgSecretReplaceBody.orgName - this.secret = orgSecretReplaceBody.secret - this.type = orgSecretReplaceBody.type - additionalProperties(orgSecretReplaceBody.additionalProperties) + internal fun from(aiSecretCreateBody: AiSecretCreateBody) = apply { + this.name = aiSecretCreateBody.name + this.metadata = aiSecretCreateBody.metadata + this.orgName = aiSecretCreateBody.orgName + this.secret = aiSecretCreateBody.secret + this.type = aiSecretCreateBody.type + additionalProperties(aiSecretCreateBody.additionalProperties) } - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(name: String) = apply { this.name = name } @JsonProperty("metadata") @@ -154,7 +154,7 @@ constructor( /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ @JsonProperty("org_name") fun orgName(orgName: String) = apply { this.orgName = orgName } @@ -181,8 +181,8 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): OrgSecretReplaceBody = - OrgSecretReplaceBody( + fun build(): AiSecretCreateBody = + AiSecretCreateBody( checkNotNull(name) { "`name` is required but was not set" }, metadata, orgName, @@ -204,7 +204,7 @@ constructor( return true } - return other is OrgSecretReplaceParams && + return other is AiSecretCreateParams && this.name == other.name && this.metadata == other.metadata && this.orgName == other.orgName && @@ -229,7 +229,7 @@ constructor( } override fun toString() = - "OrgSecretReplaceParams{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AiSecretCreateParams{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -250,18 +250,18 @@ constructor( private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretReplaceParams: OrgSecretReplaceParams) = apply { - this.name = orgSecretReplaceParams.name - this.metadata = orgSecretReplaceParams.metadata - this.orgName = orgSecretReplaceParams.orgName - this.secret = orgSecretReplaceParams.secret - this.type = orgSecretReplaceParams.type - additionalQueryParams(orgSecretReplaceParams.additionalQueryParams) - additionalHeaders(orgSecretReplaceParams.additionalHeaders) - additionalBodyProperties(orgSecretReplaceParams.additionalBodyProperties) + internal fun from(aiSecretCreateParams: AiSecretCreateParams) = apply { + this.name = aiSecretCreateParams.name + this.metadata = aiSecretCreateParams.metadata + this.orgName = aiSecretCreateParams.orgName + this.secret = aiSecretCreateParams.secret + this.type = aiSecretCreateParams.type + additionalQueryParams(aiSecretCreateParams.additionalQueryParams) + additionalHeaders(aiSecretCreateParams.additionalHeaders) + additionalBodyProperties(aiSecretCreateParams.additionalBodyProperties) } - /** Name of the org secret */ + /** Name of the AI secret */ fun name(name: String) = apply { this.name = name } fun metadata(metadata: Metadata) = apply { this.metadata = metadata } @@ -269,7 +269,7 @@ constructor( /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ fun orgName(orgName: String) = apply { this.orgName = orgName } @@ -335,8 +335,8 @@ constructor( this.additionalBodyProperties.putAll(additionalBodyProperties) } - fun build(): OrgSecretReplaceParams = - OrgSecretReplaceParams( + fun build(): AiSecretCreateParams = + AiSecretCreateParams( checkNotNull(name) { "`name` is required but was not set" }, metadata, orgName, diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretDeleteParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretDeleteParams.kt old mode 100755 new mode 100644 similarity index 79% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretDeleteParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretDeleteParams.kt index 02880990..56cf0fd0 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretDeleteParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretDeleteParams.kt @@ -8,15 +8,15 @@ import com.braintrustdata.api.core.toUnmodifiable import com.braintrustdata.api.models.* import java.util.Objects -class OrgSecretDeleteParams +class AiSecretDeleteParams constructor( - private val orgSecretId: String, + private val aiSecretId: String, private val additionalQueryParams: Map>, private val additionalHeaders: Map>, private val additionalBodyProperties: Map, ) { - fun orgSecretId(): String = orgSecretId + fun aiSecretId(): String = aiSecretId internal fun getBody(): Map? { return additionalBodyProperties.ifEmpty { null } @@ -28,7 +28,7 @@ constructor( fun getPathParam(index: Int): String { return when (index) { - 0 -> orgSecretId + 0 -> aiSecretId else -> "" } } @@ -44,8 +44,8 @@ constructor( return true } - return other is OrgSecretDeleteParams && - this.orgSecretId == other.orgSecretId && + return other is AiSecretDeleteParams && + this.aiSecretId == other.aiSecretId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties @@ -53,7 +53,7 @@ constructor( override fun hashCode(): Int { return Objects.hash( - orgSecretId, + aiSecretId, additionalQueryParams, additionalHeaders, additionalBodyProperties, @@ -61,7 +61,7 @@ constructor( } override fun toString() = - "OrgSecretDeleteParams{orgSecretId=$orgSecretId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AiSecretDeleteParams{aiSecretId=$aiSecretId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -73,20 +73,20 @@ constructor( @NoAutoDetect class Builder { - private var orgSecretId: String? = null + private var aiSecretId: String? = null private var additionalQueryParams: MutableMap> = mutableMapOf() private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretDeleteParams: OrgSecretDeleteParams) = apply { - this.orgSecretId = orgSecretDeleteParams.orgSecretId - additionalQueryParams(orgSecretDeleteParams.additionalQueryParams) - additionalHeaders(orgSecretDeleteParams.additionalHeaders) - additionalBodyProperties(orgSecretDeleteParams.additionalBodyProperties) + internal fun from(aiSecretDeleteParams: AiSecretDeleteParams) = apply { + this.aiSecretId = aiSecretDeleteParams.aiSecretId + additionalQueryParams(aiSecretDeleteParams.additionalQueryParams) + additionalHeaders(aiSecretDeleteParams.additionalHeaders) + additionalBodyProperties(aiSecretDeleteParams.additionalBodyProperties) } - /** OrgSecret id */ - fun orgSecretId(orgSecretId: String) = apply { this.orgSecretId = orgSecretId } + /** AiSecret id */ + fun aiSecretId(aiSecretId: String) = apply { this.aiSecretId = aiSecretId } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -142,9 +142,9 @@ constructor( this.additionalBodyProperties.putAll(additionalBodyProperties) } - fun build(): OrgSecretDeleteParams = - OrgSecretDeleteParams( - checkNotNull(orgSecretId) { "`orgSecretId` is required but was not set" }, + fun build(): AiSecretDeleteParams = + AiSecretDeleteParams( + checkNotNull(aiSecretId) { "`aiSecretId` is required but was not set" }, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalBodyProperties.toUnmodifiable(), diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretFindAndDeleteParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt similarity index 81% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretFindAndDeleteParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt index 561075a5..2476992c 100644 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretFindAndDeleteParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParams.kt @@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.util.Objects -class OrgSecretFindAndDeleteParams +class AiSecretFindAndDeleteParams constructor( private val name: String, private val orgName: String?, @@ -26,8 +26,8 @@ constructor( fun orgName(): String? = orgName - internal fun getBody(): OrgSecretFindAndDeleteBody { - return OrgSecretFindAndDeleteBody( + internal fun getBody(): AiSecretFindAndDeleteBody { + return AiSecretFindAndDeleteBody( name, orgName, additionalBodyProperties, @@ -38,9 +38,9 @@ constructor( internal fun getHeaders(): Map> = additionalHeaders - @JsonDeserialize(builder = OrgSecretFindAndDeleteBody.Builder::class) + @JsonDeserialize(builder = AiSecretFindAndDeleteBody.Builder::class) @NoAutoDetect - class OrgSecretFindAndDeleteBody + class AiSecretFindAndDeleteBody internal constructor( private val name: String?, private val orgName: String?, @@ -49,13 +49,13 @@ constructor( private var hashCode: Int = 0 - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(): String? = name /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ @JsonProperty("org_name") fun orgName(): String? = orgName @@ -70,7 +70,7 @@ constructor( return true } - return other is OrgSecretFindAndDeleteBody && + return other is AiSecretFindAndDeleteBody && this.name == other.name && this.orgName == other.orgName && this.additionalProperties == other.additionalProperties @@ -89,7 +89,7 @@ constructor( } override fun toString() = - "OrgSecretFindAndDeleteBody{name=$name, orgName=$orgName, additionalProperties=$additionalProperties}" + "AiSecretFindAndDeleteBody{name=$name, orgName=$orgName, additionalProperties=$additionalProperties}" companion object { @@ -102,19 +102,19 @@ constructor( private var orgName: String? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretFindAndDeleteBody: OrgSecretFindAndDeleteBody) = apply { - this.name = orgSecretFindAndDeleteBody.name - this.orgName = orgSecretFindAndDeleteBody.orgName - additionalProperties(orgSecretFindAndDeleteBody.additionalProperties) + internal fun from(aiSecretFindAndDeleteBody: AiSecretFindAndDeleteBody) = apply { + this.name = aiSecretFindAndDeleteBody.name + this.orgName = aiSecretFindAndDeleteBody.orgName + additionalProperties(aiSecretFindAndDeleteBody.additionalProperties) } - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(name: String) = apply { this.name = name } /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ @JsonProperty("org_name") fun orgName(orgName: String) = apply { this.orgName = orgName } @@ -133,8 +133,8 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): OrgSecretFindAndDeleteBody = - OrgSecretFindAndDeleteBody( + fun build(): AiSecretFindAndDeleteBody = + AiSecretFindAndDeleteBody( checkNotNull(name) { "`name` is required but was not set" }, orgName, additionalProperties.toUnmodifiable(), @@ -153,7 +153,7 @@ constructor( return true } - return other is OrgSecretFindAndDeleteParams && + return other is AiSecretFindAndDeleteParams && this.name == other.name && this.orgName == other.orgName && this.additionalQueryParams == other.additionalQueryParams && @@ -172,7 +172,7 @@ constructor( } override fun toString() = - "OrgSecretFindAndDeleteParams{name=$name, orgName=$orgName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AiSecretFindAndDeleteParams{name=$name, orgName=$orgName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -190,21 +190,21 @@ constructor( private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretFindAndDeleteParams: OrgSecretFindAndDeleteParams) = apply { - this.name = orgSecretFindAndDeleteParams.name - this.orgName = orgSecretFindAndDeleteParams.orgName - additionalQueryParams(orgSecretFindAndDeleteParams.additionalQueryParams) - additionalHeaders(orgSecretFindAndDeleteParams.additionalHeaders) - additionalBodyProperties(orgSecretFindAndDeleteParams.additionalBodyProperties) + internal fun from(aiSecretFindAndDeleteParams: AiSecretFindAndDeleteParams) = apply { + this.name = aiSecretFindAndDeleteParams.name + this.orgName = aiSecretFindAndDeleteParams.orgName + additionalQueryParams(aiSecretFindAndDeleteParams.additionalQueryParams) + additionalHeaders(aiSecretFindAndDeleteParams.additionalHeaders) + additionalBodyProperties(aiSecretFindAndDeleteParams.additionalBodyProperties) } - /** Name of the org secret */ + /** Name of the AI secret */ fun name(name: String) = apply { this.name = name } /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ fun orgName(orgName: String) = apply { this.orgName = orgName } @@ -262,8 +262,8 @@ constructor( this.additionalBodyProperties.putAll(additionalBodyProperties) } - fun build(): OrgSecretFindAndDeleteParams = - OrgSecretFindAndDeleteParams( + fun build(): AiSecretFindAndDeleteParams = + AiSecretFindAndDeleteParams( checkNotNull(name) { "`name` is required but was not set" }, orgName, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListPage.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListPage.kt old mode 100755 new mode 100644 similarity index 67% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListPage.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListPage.kt index 52b9027f..a9f0f7da --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListPage.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListPage.kt @@ -8,77 +8,73 @@ import com.braintrustdata.api.core.JsonMissing import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.toUnmodifiable -import com.braintrustdata.api.services.blocking.OrgSecretService +import com.braintrustdata.api.services.blocking.AiSecretService import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.util.Objects -class OrgSecretListPage +class AiSecretListPage private constructor( - private val orgSecretService: OrgSecretService, - private val params: OrgSecretListParams, + private val aiSecretService: AiSecretService, + private val params: AiSecretListParams, private val response: Response, ) { fun response(): Response = response - fun objects(): List = response().objects() + fun objects(): List = response().objects() override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is OrgSecretListPage && - this.orgSecretService == other.orgSecretService && + return other is AiSecretListPage && + this.aiSecretService == other.aiSecretService && this.params == other.params && this.response == other.response } override fun hashCode(): Int { return Objects.hash( - orgSecretService, + aiSecretService, params, response, ) } override fun toString() = - "OrgSecretListPage{orgSecretService=$orgSecretService, params=$params, response=$response}" + "AiSecretListPage{aiSecretService=$aiSecretService, params=$params, response=$response}" fun hasNextPage(): Boolean { return !objects().isEmpty() } - fun getNextPageParams(): OrgSecretListParams? { + fun getNextPageParams(): AiSecretListParams? { if (!hasNextPage()) { return null } return if (params.endingBefore() != null) { - OrgSecretListParams.builder().from(params).endingBefore(objects().first().id()).build() + AiSecretListParams.builder().from(params).endingBefore(objects().first().id()).build() } else { - OrgSecretListParams.builder().from(params).startingAfter(objects().last().id()).build() + AiSecretListParams.builder().from(params).startingAfter(objects().last().id()).build() } } - fun getNextPage(): OrgSecretListPage? { - return getNextPageParams()?.let { orgSecretService.list(it) } + fun getNextPage(): AiSecretListPage? { + return getNextPageParams()?.let { aiSecretService.list(it) } } fun autoPager(): AutoPager = AutoPager(this) companion object { - fun of( - orgSecretService: OrgSecretService, - params: OrgSecretListParams, - response: Response - ) = - OrgSecretListPage( - orgSecretService, + fun of(aiSecretService: AiSecretService, params: AiSecretListParams, response: Response) = + AiSecretListPage( + aiSecretService, params, response, ) @@ -88,15 +84,15 @@ private constructor( @NoAutoDetect class Response constructor( - private val objects: JsonField>, + private val objects: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - fun objects(): List = objects.getNullable("objects") ?: listOf() + fun objects(): List = objects.getNullable("objects") ?: listOf() - @JsonProperty("objects") fun _objects(): JsonField>? = objects + @JsonProperty("objects") fun _objects(): JsonField>? = objects @JsonAnyGetter @ExcludeMissing @@ -126,7 +122,7 @@ private constructor( } override fun toString() = - "OrgSecretListPage.Response{objects=$objects, additionalProperties=$additionalProperties}" + "AiSecretListPage.Response{objects=$objects, additionalProperties=$additionalProperties}" companion object { @@ -135,7 +131,7 @@ private constructor( class Builder { - private var objects: JsonField> = JsonMissing.of() + private var objects: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(page: Response) = apply { @@ -143,10 +139,10 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun objects(objects: List) = objects(JsonField.of(objects)) + fun objects(objects: List) = objects(JsonField.of(objects)) @JsonProperty("objects") - fun objects(objects: JsonField>) = apply { this.objects = objects } + fun objects(objects: JsonField>) = apply { this.objects = objects } @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { @@ -159,10 +155,10 @@ private constructor( class AutoPager constructor( - private val firstPage: OrgSecretListPage, - ) : Sequence { + private val firstPage: AiSecretListPage, + ) : Sequence { - override fun iterator(): Iterator = iterator { + override fun iterator(): Iterator = iterator { var page = firstPage var index = 0 while (true) { diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListPageAsync.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListPageAsync.kt old mode 100755 new mode 100644 similarity index 68% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListPageAsync.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListPageAsync.kt index f936ea67..7cda0f70 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListPageAsync.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListPageAsync.kt @@ -8,7 +8,7 @@ import com.braintrustdata.api.core.JsonMissing import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.core.NoAutoDetect import com.braintrustdata.api.core.toUnmodifiable -import com.braintrustdata.api.services.async.OrgSecretServiceAsync +import com.braintrustdata.api.services.async.AiSecretServiceAsync import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty @@ -17,57 +17,57 @@ import java.util.Objects import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector -class OrgSecretListPageAsync +class AiSecretListPageAsync private constructor( - private val orgSecretService: OrgSecretServiceAsync, - private val params: OrgSecretListParams, + private val aiSecretService: AiSecretServiceAsync, + private val params: AiSecretListParams, private val response: Response, ) { fun response(): Response = response - fun objects(): List = response().objects() + fun objects(): List = response().objects() override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is OrgSecretListPageAsync && - this.orgSecretService == other.orgSecretService && + return other is AiSecretListPageAsync && + this.aiSecretService == other.aiSecretService && this.params == other.params && this.response == other.response } override fun hashCode(): Int { return Objects.hash( - orgSecretService, + aiSecretService, params, response, ) } override fun toString() = - "OrgSecretListPageAsync{orgSecretService=$orgSecretService, params=$params, response=$response}" + "AiSecretListPageAsync{aiSecretService=$aiSecretService, params=$params, response=$response}" fun hasNextPage(): Boolean { return !objects().isEmpty() } - fun getNextPageParams(): OrgSecretListParams? { + fun getNextPageParams(): AiSecretListParams? { if (!hasNextPage()) { return null } return if (params.endingBefore() != null) { - OrgSecretListParams.builder().from(params).endingBefore(objects().first().id()).build() + AiSecretListParams.builder().from(params).endingBefore(objects().first().id()).build() } else { - OrgSecretListParams.builder().from(params).startingAfter(objects().last().id()).build() + AiSecretListParams.builder().from(params).startingAfter(objects().last().id()).build() } } - suspend fun getNextPage(): OrgSecretListPageAsync? { - return getNextPageParams()?.let { orgSecretService.list(it) } + suspend fun getNextPage(): AiSecretListPageAsync? { + return getNextPageParams()?.let { aiSecretService.list(it) } } fun autoPager(): AutoPager = AutoPager(this) @@ -75,12 +75,12 @@ private constructor( companion object { fun of( - orgSecretService: OrgSecretServiceAsync, - params: OrgSecretListParams, + aiSecretService: AiSecretServiceAsync, + params: AiSecretListParams, response: Response ) = - OrgSecretListPageAsync( - orgSecretService, + AiSecretListPageAsync( + aiSecretService, params, response, ) @@ -90,15 +90,15 @@ private constructor( @NoAutoDetect class Response constructor( - private val objects: JsonField>, + private val objects: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - fun objects(): List = objects.getNullable("objects") ?: listOf() + fun objects(): List = objects.getNullable("objects") ?: listOf() - @JsonProperty("objects") fun _objects(): JsonField>? = objects + @JsonProperty("objects") fun _objects(): JsonField>? = objects @JsonAnyGetter @ExcludeMissing @@ -128,7 +128,7 @@ private constructor( } override fun toString() = - "OrgSecretListPageAsync.Response{objects=$objects, additionalProperties=$additionalProperties}" + "AiSecretListPageAsync.Response{objects=$objects, additionalProperties=$additionalProperties}" companion object { @@ -137,7 +137,7 @@ private constructor( class Builder { - private var objects: JsonField> = JsonMissing.of() + private var objects: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(page: Response) = apply { @@ -145,10 +145,10 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun objects(objects: List) = objects(JsonField.of(objects)) + fun objects(objects: List) = objects(JsonField.of(objects)) @JsonProperty("objects") - fun objects(objects: JsonField>) = apply { this.objects = objects } + fun objects(objects: JsonField>) = apply { this.objects = objects } @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { @@ -161,10 +161,10 @@ private constructor( class AutoPager constructor( - private val firstPage: OrgSecretListPageAsync, - ) : Flow { + private val firstPage: AiSecretListPageAsync, + ) : Flow { - override suspend fun collect(collector: FlowCollector) { + override suspend fun collect(collector: FlowCollector) { var page = firstPage var index = 0 while (true) { diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt old mode 100755 new mode 100644 similarity index 79% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt index ed8ff259..a5fb8ff9 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretListParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretListParams.kt @@ -19,19 +19,23 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import java.util.Objects -class OrgSecretListParams +class AiSecretListParams constructor( + private val aiSecretName: String?, + private val aiSecretType: AiSecretType?, private val endingBefore: String?, private val ids: Ids?, private val limit: Long?, private val orgName: String?, - private val orgSecretName: String?, - private val orgSecretType: OrgSecretType?, private val startingAfter: String?, private val additionalQueryParams: Map>, private val additionalHeaders: Map>, ) { + fun aiSecretName(): String? = aiSecretName + + fun aiSecretType(): AiSecretType? = aiSecretType + fun endingBefore(): String? = endingBefore fun ids(): Ids? = ids @@ -40,20 +44,16 @@ constructor( fun orgName(): String? = orgName - fun orgSecretName(): String? = orgSecretName - - fun orgSecretType(): OrgSecretType? = orgSecretType - fun startingAfter(): String? = startingAfter internal fun getQueryParams(): Map> { val params = mutableMapOf>() + this.aiSecretName?.let { params.put("ai_secret_name", listOf(it.toString())) } + this.aiSecretType?.let { params.put("ai_secret_type", listOf(it.toString())) } this.endingBefore?.let { params.put("ending_before", listOf(it.toString())) } this.ids?.let { params.put("ids", listOf(it.toString())) } this.limit?.let { params.put("limit", listOf(it.toString())) } this.orgName?.let { params.put("org_name", listOf(it.toString())) } - this.orgSecretName?.let { params.put("org_secret_name", listOf(it.toString())) } - this.orgSecretType?.let { params.put("org_secret_type", listOf(it.toString())) } this.startingAfter?.let { params.put("starting_after", listOf(it.toString())) } params.putAll(additionalQueryParams) return params.toUnmodifiable() @@ -70,13 +70,13 @@ constructor( return true } - return other is OrgSecretListParams && + return other is AiSecretListParams && + this.aiSecretName == other.aiSecretName && + this.aiSecretType == other.aiSecretType && this.endingBefore == other.endingBefore && this.ids == other.ids && this.limit == other.limit && this.orgName == other.orgName && - this.orgSecretName == other.orgSecretName && - this.orgSecretType == other.orgSecretType && this.startingAfter == other.startingAfter && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders @@ -84,12 +84,12 @@ constructor( override fun hashCode(): Int { return Objects.hash( + aiSecretName, + aiSecretType, endingBefore, ids, limit, orgName, - orgSecretName, - orgSecretType, startingAfter, additionalQueryParams, additionalHeaders, @@ -97,7 +97,7 @@ constructor( } override fun toString() = - "OrgSecretListParams{endingBefore=$endingBefore, ids=$ids, limit=$limit, orgName=$orgName, orgSecretName=$orgSecretName, orgSecretType=$orgSecretType, startingAfter=$startingAfter, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "AiSecretListParams{aiSecretName=$aiSecretName, aiSecretType=$aiSecretType, endingBefore=$endingBefore, ids=$ids, limit=$limit, orgName=$orgName, startingAfter=$startingAfter, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" fun toBuilder() = Builder().from(this) @@ -109,26 +109,39 @@ constructor( @NoAutoDetect class Builder { + private var aiSecretName: String? = null + private var aiSecretType: AiSecretType? = null private var endingBefore: String? = null private var ids: Ids? = null private var limit: Long? = null private var orgName: String? = null - private var orgSecretName: String? = null - private var orgSecretType: OrgSecretType? = null private var startingAfter: String? = null private var additionalQueryParams: MutableMap> = mutableMapOf() private var additionalHeaders: MutableMap> = mutableMapOf() - internal fun from(orgSecretListParams: OrgSecretListParams) = apply { - this.endingBefore = orgSecretListParams.endingBefore - this.ids = orgSecretListParams.ids - this.limit = orgSecretListParams.limit - this.orgName = orgSecretListParams.orgName - this.orgSecretName = orgSecretListParams.orgSecretName - this.orgSecretType = orgSecretListParams.orgSecretType - this.startingAfter = orgSecretListParams.startingAfter - additionalQueryParams(orgSecretListParams.additionalQueryParams) - additionalHeaders(orgSecretListParams.additionalHeaders) + internal fun from(aiSecretListParams: AiSecretListParams) = apply { + this.aiSecretName = aiSecretListParams.aiSecretName + this.aiSecretType = aiSecretListParams.aiSecretType + this.endingBefore = aiSecretListParams.endingBefore + this.ids = aiSecretListParams.ids + this.limit = aiSecretListParams.limit + this.orgName = aiSecretListParams.orgName + this.startingAfter = aiSecretListParams.startingAfter + additionalQueryParams(aiSecretListParams.additionalQueryParams) + additionalHeaders(aiSecretListParams.additionalHeaders) + } + + /** Name of the ai_secret to search for */ + fun aiSecretName(aiSecretName: String) = apply { this.aiSecretName = aiSecretName } + + fun aiSecretType(aiSecretType: AiSecretType) = apply { this.aiSecretType = aiSecretType } + + fun aiSecretType(string: String) = apply { + this.aiSecretType = AiSecretType.ofString(string) + } + + fun aiSecretType(strings: List) = apply { + this.aiSecretType = AiSecretType.ofStrings(strings) } /** @@ -164,21 +177,6 @@ constructor( /** Filter search results to within a particular organization */ fun orgName(orgName: String) = apply { this.orgName = orgName } - /** Name of the org_secret to search for */ - fun orgSecretName(orgSecretName: String) = apply { this.orgSecretName = orgSecretName } - - fun orgSecretType(orgSecretType: OrgSecretType) = apply { - this.orgSecretType = orgSecretType - } - - fun orgSecretType(string: String) = apply { - this.orgSecretType = OrgSecretType.ofString(string) - } - - fun orgSecretType(strings: List) = apply { - this.orgSecretType = OrgSecretType.ofStrings(strings) - } - /** * Pagination cursor id. * @@ -228,23 +226,23 @@ constructor( fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - fun build(): OrgSecretListParams = - OrgSecretListParams( + fun build(): AiSecretListParams = + AiSecretListParams( + aiSecretName, + aiSecretType, endingBefore, ids, limit, orgName, - orgSecretName, - orgSecretType, startingAfter, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), ) } - @JsonDeserialize(using = Ids.Deserializer::class) - @JsonSerialize(using = Ids.Serializer::class) - class Ids + @JsonDeserialize(using = AiSecretType.Deserializer::class) + @JsonSerialize(using = AiSecretType.Serializer::class) + class AiSecretType private constructor( private val string: String? = null, private val strings: List? = null, @@ -275,10 +273,10 @@ constructor( } } - fun validate(): Ids = apply { + fun validate(): AiSecretType = apply { if (!validated) { if (string == null && strings == null) { - throw BraintrustInvalidDataException("Unknown Ids: $_json") + throw BraintrustInvalidDataException("Unknown AiSecretType: $_json") } validated = true } @@ -289,7 +287,9 @@ constructor( return true } - return other is Ids && this.string == other.string && this.strings == other.strings + return other is AiSecretType && + this.string == other.string && + this.strings == other.strings } override fun hashCode(): Int { @@ -298,18 +298,18 @@ constructor( override fun toString(): String { return when { - string != null -> "Ids{string=$string}" - strings != null -> "Ids{strings=$strings}" - _json != null -> "Ids{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Ids") + string != null -> "AiSecretType{string=$string}" + strings != null -> "AiSecretType{strings=$strings}" + _json != null -> "AiSecretType{_unknown=$_json}" + else -> throw IllegalStateException("Invalid AiSecretType") } } companion object { - fun ofString(string: String) = Ids(string = string) + fun ofString(string: String) = AiSecretType(string = string) - fun ofStrings(strings: List) = Ids(strings = strings) + fun ofStrings(strings: List) = AiSecretType(strings = strings) } interface Visitor { @@ -319,29 +319,29 @@ constructor( fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw BraintrustInvalidDataException("Unknown Ids: $json") + throw BraintrustInvalidDataException("Unknown AiSecretType: $json") } } - class Deserializer : BaseDeserializer(Ids::class) { + class Deserializer : BaseDeserializer(AiSecretType::class) { - override fun ObjectCodec.deserialize(node: JsonNode): Ids { + override fun ObjectCodec.deserialize(node: JsonNode): AiSecretType { val json = JsonValue.fromJsonNode(node) tryDeserialize(node, jacksonTypeRef())?.let { - return Ids(string = it, _json = json) + return AiSecretType(string = it, _json = json) } tryDeserialize(node, jacksonTypeRef>())?.let { - return Ids(strings = it, _json = json) + return AiSecretType(strings = it, _json = json) } - return Ids(_json = json) + return AiSecretType(_json = json) } } - class Serializer : BaseSerializer(Ids::class) { + class Serializer : BaseSerializer(AiSecretType::class) { override fun serialize( - value: Ids, + value: AiSecretType, generator: JsonGenerator, provider: SerializerProvider ) { @@ -349,15 +349,15 @@ constructor( value.string != null -> generator.writeObject(value.string) value.strings != null -> generator.writeObject(value.strings) value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Ids") + else -> throw IllegalStateException("Invalid AiSecretType") } } } } - @JsonDeserialize(using = OrgSecretType.Deserializer::class) - @JsonSerialize(using = OrgSecretType.Serializer::class) - class OrgSecretType + @JsonDeserialize(using = Ids.Deserializer::class) + @JsonSerialize(using = Ids.Serializer::class) + class Ids private constructor( private val string: String? = null, private val strings: List? = null, @@ -388,10 +388,10 @@ constructor( } } - fun validate(): OrgSecretType = apply { + fun validate(): Ids = apply { if (!validated) { if (string == null && strings == null) { - throw BraintrustInvalidDataException("Unknown OrgSecretType: $_json") + throw BraintrustInvalidDataException("Unknown Ids: $_json") } validated = true } @@ -402,9 +402,7 @@ constructor( return true } - return other is OrgSecretType && - this.string == other.string && - this.strings == other.strings + return other is Ids && this.string == other.string && this.strings == other.strings } override fun hashCode(): Int { @@ -413,18 +411,18 @@ constructor( override fun toString(): String { return when { - string != null -> "OrgSecretType{string=$string}" - strings != null -> "OrgSecretType{strings=$strings}" - _json != null -> "OrgSecretType{_unknown=$_json}" - else -> throw IllegalStateException("Invalid OrgSecretType") + string != null -> "Ids{string=$string}" + strings != null -> "Ids{strings=$strings}" + _json != null -> "Ids{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Ids") } } companion object { - fun ofString(string: String) = OrgSecretType(string = string) + fun ofString(string: String) = Ids(string = string) - fun ofStrings(strings: List) = OrgSecretType(strings = strings) + fun ofStrings(strings: List) = Ids(strings = strings) } interface Visitor { @@ -434,29 +432,29 @@ constructor( fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw BraintrustInvalidDataException("Unknown OrgSecretType: $json") + throw BraintrustInvalidDataException("Unknown Ids: $json") } } - class Deserializer : BaseDeserializer(OrgSecretType::class) { + class Deserializer : BaseDeserializer(Ids::class) { - override fun ObjectCodec.deserialize(node: JsonNode): OrgSecretType { + override fun ObjectCodec.deserialize(node: JsonNode): Ids { val json = JsonValue.fromJsonNode(node) tryDeserialize(node, jacksonTypeRef())?.let { - return OrgSecretType(string = it, _json = json) + return Ids(string = it, _json = json) } tryDeserialize(node, jacksonTypeRef>())?.let { - return OrgSecretType(strings = it, _json = json) + return Ids(strings = it, _json = json) } - return OrgSecretType(_json = json) + return Ids(_json = json) } } - class Serializer : BaseSerializer(OrgSecretType::class) { + class Serializer : BaseSerializer(Ids::class) { override fun serialize( - value: OrgSecretType, + value: Ids, generator: JsonGenerator, provider: SerializerProvider ) { @@ -464,7 +462,7 @@ constructor( value.string != null -> generator.writeObject(value.string) value.strings != null -> generator.writeObject(value.strings) value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid OrgSecretType") + else -> throw IllegalStateException("Invalid Ids") } } } diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretCreateParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt old mode 100755 new mode 100644 similarity index 87% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretCreateParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt index 88f52ab7..77dba57b --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretCreateParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretReplaceParams.kt @@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.util.Objects -class OrgSecretCreateParams +class AiSecretReplaceParams constructor( private val name: String, private val metadata: Metadata?, @@ -35,8 +35,8 @@ constructor( fun type(): String? = type - internal fun getBody(): OrgSecretCreateBody { - return OrgSecretCreateBody( + internal fun getBody(): AiSecretReplaceBody { + return AiSecretReplaceBody( name, metadata, orgName, @@ -50,9 +50,9 @@ constructor( internal fun getHeaders(): Map> = additionalHeaders - @JsonDeserialize(builder = OrgSecretCreateBody.Builder::class) + @JsonDeserialize(builder = AiSecretReplaceBody.Builder::class) @NoAutoDetect - class OrgSecretCreateBody + class AiSecretReplaceBody internal constructor( private val name: String?, private val metadata: Metadata?, @@ -64,7 +64,7 @@ constructor( private var hashCode: Int = 0 - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(): String? = name @JsonProperty("metadata") fun metadata(): Metadata? = metadata @@ -72,7 +72,7 @@ constructor( /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ @JsonProperty("org_name") fun orgName(): String? = orgName @@ -95,7 +95,7 @@ constructor( return true } - return other is OrgSecretCreateBody && + return other is AiSecretReplaceBody && this.name == other.name && this.metadata == other.metadata && this.orgName == other.orgName && @@ -120,7 +120,7 @@ constructor( } override fun toString() = - "OrgSecretCreateBody{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalProperties=$additionalProperties}" + "AiSecretReplaceBody{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -136,16 +136,16 @@ constructor( private var type: String? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretCreateBody: OrgSecretCreateBody) = apply { - this.name = orgSecretCreateBody.name - this.metadata = orgSecretCreateBody.metadata - this.orgName = orgSecretCreateBody.orgName - this.secret = orgSecretCreateBody.secret - this.type = orgSecretCreateBody.type - additionalProperties(orgSecretCreateBody.additionalProperties) + internal fun from(aiSecretReplaceBody: AiSecretReplaceBody) = apply { + this.name = aiSecretReplaceBody.name + this.metadata = aiSecretReplaceBody.metadata + this.orgName = aiSecretReplaceBody.orgName + this.secret = aiSecretReplaceBody.secret + this.type = aiSecretReplaceBody.type + additionalProperties(aiSecretReplaceBody.additionalProperties) } - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(name: String) = apply { this.name = name } @JsonProperty("metadata") @@ -154,7 +154,7 @@ constructor( /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ @JsonProperty("org_name") fun orgName(orgName: String) = apply { this.orgName = orgName } @@ -181,8 +181,8 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): OrgSecretCreateBody = - OrgSecretCreateBody( + fun build(): AiSecretReplaceBody = + AiSecretReplaceBody( checkNotNull(name) { "`name` is required but was not set" }, metadata, orgName, @@ -204,7 +204,7 @@ constructor( return true } - return other is OrgSecretCreateParams && + return other is AiSecretReplaceParams && this.name == other.name && this.metadata == other.metadata && this.orgName == other.orgName && @@ -229,7 +229,7 @@ constructor( } override fun toString() = - "OrgSecretCreateParams{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AiSecretReplaceParams{name=$name, metadata=$metadata, orgName=$orgName, secret=$secret, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -250,18 +250,18 @@ constructor( private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretCreateParams: OrgSecretCreateParams) = apply { - this.name = orgSecretCreateParams.name - this.metadata = orgSecretCreateParams.metadata - this.orgName = orgSecretCreateParams.orgName - this.secret = orgSecretCreateParams.secret - this.type = orgSecretCreateParams.type - additionalQueryParams(orgSecretCreateParams.additionalQueryParams) - additionalHeaders(orgSecretCreateParams.additionalHeaders) - additionalBodyProperties(orgSecretCreateParams.additionalBodyProperties) + internal fun from(aiSecretReplaceParams: AiSecretReplaceParams) = apply { + this.name = aiSecretReplaceParams.name + this.metadata = aiSecretReplaceParams.metadata + this.orgName = aiSecretReplaceParams.orgName + this.secret = aiSecretReplaceParams.secret + this.type = aiSecretReplaceParams.type + additionalQueryParams(aiSecretReplaceParams.additionalQueryParams) + additionalHeaders(aiSecretReplaceParams.additionalHeaders) + additionalBodyProperties(aiSecretReplaceParams.additionalBodyProperties) } - /** Name of the org secret */ + /** Name of the AI secret */ fun name(name: String) = apply { this.name = name } fun metadata(metadata: Metadata) = apply { this.metadata = metadata } @@ -269,7 +269,7 @@ constructor( /** * For nearly all users, this parameter should be unnecessary. But in the rare case that * your API key belongs to multiple organizations, you may specify the name of the - * organization the Org Secret belongs in. + * organization the AI Secret belongs in. */ fun orgName(orgName: String) = apply { this.orgName = orgName } @@ -335,8 +335,8 @@ constructor( this.additionalBodyProperties.putAll(additionalBodyProperties) } - fun build(): OrgSecretCreateParams = - OrgSecretCreateParams( + fun build(): AiSecretReplaceParams = + AiSecretReplaceParams( checkNotNull(name) { "`name` is required but was not set" }, metadata, orgName, diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretRetrieveParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretRetrieveParams.kt old mode 100755 new mode 100644 similarity index 76% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretRetrieveParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretRetrieveParams.kt index c4d0ba3a..3ce06ad7 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretRetrieveParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretRetrieveParams.kt @@ -7,14 +7,14 @@ import com.braintrustdata.api.core.toUnmodifiable import com.braintrustdata.api.models.* import java.util.Objects -class OrgSecretRetrieveParams +class AiSecretRetrieveParams constructor( - private val orgSecretId: String, + private val aiSecretId: String, private val additionalQueryParams: Map>, private val additionalHeaders: Map>, ) { - fun orgSecretId(): String = orgSecretId + fun aiSecretId(): String = aiSecretId internal fun getQueryParams(): Map> = additionalQueryParams @@ -22,7 +22,7 @@ constructor( fun getPathParam(index: Int): String { return when (index) { - 0 -> orgSecretId + 0 -> aiSecretId else -> "" } } @@ -36,22 +36,22 @@ constructor( return true } - return other is OrgSecretRetrieveParams && - this.orgSecretId == other.orgSecretId && + return other is AiSecretRetrieveParams && + this.aiSecretId == other.aiSecretId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders } override fun hashCode(): Int { return Objects.hash( - orgSecretId, + aiSecretId, additionalQueryParams, additionalHeaders, ) } override fun toString() = - "OrgSecretRetrieveParams{orgSecretId=$orgSecretId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "AiSecretRetrieveParams{aiSecretId=$aiSecretId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" fun toBuilder() = Builder().from(this) @@ -63,18 +63,18 @@ constructor( @NoAutoDetect class Builder { - private var orgSecretId: String? = null + private var aiSecretId: String? = null private var additionalQueryParams: MutableMap> = mutableMapOf() private var additionalHeaders: MutableMap> = mutableMapOf() - internal fun from(orgSecretRetrieveParams: OrgSecretRetrieveParams) = apply { - this.orgSecretId = orgSecretRetrieveParams.orgSecretId - additionalQueryParams(orgSecretRetrieveParams.additionalQueryParams) - additionalHeaders(orgSecretRetrieveParams.additionalHeaders) + internal fun from(aiSecretRetrieveParams: AiSecretRetrieveParams) = apply { + this.aiSecretId = aiSecretRetrieveParams.aiSecretId + additionalQueryParams(aiSecretRetrieveParams.additionalQueryParams) + additionalHeaders(aiSecretRetrieveParams.additionalHeaders) } - /** OrgSecret id */ - fun orgSecretId(orgSecretId: String) = apply { this.orgSecretId = orgSecretId } + /** AiSecret id */ + fun aiSecretId(aiSecretId: String) = apply { this.aiSecretId = aiSecretId } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -116,9 +116,9 @@ constructor( fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } - fun build(): OrgSecretRetrieveParams = - OrgSecretRetrieveParams( - checkNotNull(orgSecretId) { "`orgSecretId` is required but was not set" }, + fun build(): AiSecretRetrieveParams = + AiSecretRetrieveParams( + checkNotNull(aiSecretId) { "`aiSecretId` is required but was not set" }, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), ) diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretUpdateParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt old mode 100755 new mode 100644 similarity index 82% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretUpdateParams.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt index 5e108663..59aa2225 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/OrgSecretUpdateParams.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/AiSecretUpdateParams.kt @@ -13,9 +13,9 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.util.Objects -class OrgSecretUpdateParams +class AiSecretUpdateParams constructor( - private val orgSecretId: String, + private val aiSecretId: String, private val metadata: Metadata?, private val name: String?, private val secret: String?, @@ -25,7 +25,7 @@ constructor( private val additionalBodyProperties: Map, ) { - fun orgSecretId(): String = orgSecretId + fun aiSecretId(): String = aiSecretId fun metadata(): Metadata? = metadata @@ -35,8 +35,8 @@ constructor( fun type(): String? = type - internal fun getBody(): OrgSecretUpdateBody { - return OrgSecretUpdateBody( + internal fun getBody(): AiSecretUpdateBody { + return AiSecretUpdateBody( metadata, name, secret, @@ -51,14 +51,14 @@ constructor( fun getPathParam(index: Int): String { return when (index) { - 0 -> orgSecretId + 0 -> aiSecretId else -> "" } } - @JsonDeserialize(builder = OrgSecretUpdateBody.Builder::class) + @JsonDeserialize(builder = AiSecretUpdateBody.Builder::class) @NoAutoDetect - class OrgSecretUpdateBody + class AiSecretUpdateBody internal constructor( private val metadata: Metadata?, private val name: String?, @@ -71,7 +71,7 @@ constructor( @JsonProperty("metadata") fun metadata(): Metadata? = metadata - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(): String? = name @JsonProperty("secret") fun secret(): String? = secret @@ -89,7 +89,7 @@ constructor( return true } - return other is OrgSecretUpdateBody && + return other is AiSecretUpdateBody && this.metadata == other.metadata && this.name == other.name && this.secret == other.secret && @@ -112,7 +112,7 @@ constructor( } override fun toString() = - "OrgSecretUpdateBody{metadata=$metadata, name=$name, secret=$secret, type=$type, additionalProperties=$additionalProperties}" + "AiSecretUpdateBody{metadata=$metadata, name=$name, secret=$secret, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -127,18 +127,18 @@ constructor( private var type: String? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretUpdateBody: OrgSecretUpdateBody) = apply { - this.metadata = orgSecretUpdateBody.metadata - this.name = orgSecretUpdateBody.name - this.secret = orgSecretUpdateBody.secret - this.type = orgSecretUpdateBody.type - additionalProperties(orgSecretUpdateBody.additionalProperties) + internal fun from(aiSecretUpdateBody: AiSecretUpdateBody) = apply { + this.metadata = aiSecretUpdateBody.metadata + this.name = aiSecretUpdateBody.name + this.secret = aiSecretUpdateBody.secret + this.type = aiSecretUpdateBody.type + additionalProperties(aiSecretUpdateBody.additionalProperties) } @JsonProperty("metadata") fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - /** Name of the org secret */ + /** Name of the AI secret */ @JsonProperty("name") fun name(name: String) = apply { this.name = name } @JsonProperty("secret") fun secret(secret: String) = apply { this.secret = secret } @@ -159,8 +159,8 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): OrgSecretUpdateBody = - OrgSecretUpdateBody( + fun build(): AiSecretUpdateBody = + AiSecretUpdateBody( metadata, name, secret, @@ -181,8 +181,8 @@ constructor( return true } - return other is OrgSecretUpdateParams && - this.orgSecretId == other.orgSecretId && + return other is AiSecretUpdateParams && + this.aiSecretId == other.aiSecretId && this.metadata == other.metadata && this.name == other.name && this.secret == other.secret && @@ -194,7 +194,7 @@ constructor( override fun hashCode(): Int { return Objects.hash( - orgSecretId, + aiSecretId, metadata, name, secret, @@ -206,7 +206,7 @@ constructor( } override fun toString() = - "OrgSecretUpdateParams{orgSecretId=$orgSecretId, metadata=$metadata, name=$name, secret=$secret, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AiSecretUpdateParams{aiSecretId=$aiSecretId, metadata=$metadata, name=$name, secret=$secret, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -218,7 +218,7 @@ constructor( @NoAutoDetect class Builder { - private var orgSecretId: String? = null + private var aiSecretId: String? = null private var metadata: Metadata? = null private var name: String? = null private var secret: String? = null @@ -227,23 +227,23 @@ constructor( private var additionalHeaders: MutableMap> = mutableMapOf() private var additionalBodyProperties: MutableMap = mutableMapOf() - internal fun from(orgSecretUpdateParams: OrgSecretUpdateParams) = apply { - this.orgSecretId = orgSecretUpdateParams.orgSecretId - this.metadata = orgSecretUpdateParams.metadata - this.name = orgSecretUpdateParams.name - this.secret = orgSecretUpdateParams.secret - this.type = orgSecretUpdateParams.type - additionalQueryParams(orgSecretUpdateParams.additionalQueryParams) - additionalHeaders(orgSecretUpdateParams.additionalHeaders) - additionalBodyProperties(orgSecretUpdateParams.additionalBodyProperties) + internal fun from(aiSecretUpdateParams: AiSecretUpdateParams) = apply { + this.aiSecretId = aiSecretUpdateParams.aiSecretId + this.metadata = aiSecretUpdateParams.metadata + this.name = aiSecretUpdateParams.name + this.secret = aiSecretUpdateParams.secret + this.type = aiSecretUpdateParams.type + additionalQueryParams(aiSecretUpdateParams.additionalQueryParams) + additionalHeaders(aiSecretUpdateParams.additionalHeaders) + additionalBodyProperties(aiSecretUpdateParams.additionalBodyProperties) } - /** OrgSecret id */ - fun orgSecretId(orgSecretId: String) = apply { this.orgSecretId = orgSecretId } + /** AiSecret id */ + fun aiSecretId(aiSecretId: String) = apply { this.aiSecretId = aiSecretId } fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - /** Name of the org secret */ + /** Name of the AI secret */ fun name(name: String) = apply { this.name = name } fun secret(secret: String) = apply { this.secret = secret } @@ -304,9 +304,9 @@ constructor( this.additionalBodyProperties.putAll(additionalBodyProperties) } - fun build(): OrgSecretUpdateParams = - OrgSecretUpdateParams( - checkNotNull(orgSecretId) { "`orgSecretId` is required but was not set" }, + fun build(): AiSecretUpdateParams = + AiSecretUpdateParams( + checkNotNull(aiSecretId) { "`aiSecretId` is required but was not set" }, metadata, name, secret, diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt new file mode 100644 index 00000000..64e26d96 --- /dev/null +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeParams.kt @@ -0,0 +1,926 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.braintrustdata.api.models + +import com.braintrustdata.api.core.BaseDeserializer +import com.braintrustdata.api.core.BaseSerializer +import com.braintrustdata.api.core.Enum +import com.braintrustdata.api.core.ExcludeMissing +import com.braintrustdata.api.core.JsonField +import com.braintrustdata.api.core.JsonMissing +import com.braintrustdata.api.core.JsonValue +import com.braintrustdata.api.core.NoAutoDetect +import com.braintrustdata.api.core.getOrThrow +import com.braintrustdata.api.core.toUnmodifiable +import com.braintrustdata.api.errors.BraintrustInvalidDataException +import com.braintrustdata.api.models.* +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.Objects + +class FunctionInvokeParams +constructor( + private val functionId: String, + private val input: JsonValue?, + private val parent: Parent?, + private val stream: Boolean?, + private val version: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun functionId(): String = functionId + + fun input(): JsonValue? = input + + fun parent(): Parent? = parent + + fun stream(): Boolean? = stream + + fun version(): String? = version + + internal fun getBody(): FunctionInvokeBody { + return FunctionInvokeBody( + input, + parent, + stream, + version, + additionalBodyProperties, + ) + } + + internal fun getQueryParams(): Map> = additionalQueryParams + + internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> functionId + else -> "" + } + } + + /** The request to invoke a function */ + @JsonDeserialize(builder = FunctionInvokeBody.Builder::class) + @NoAutoDetect + class FunctionInvokeBody + internal constructor( + private val input: JsonValue?, + private val parent: Parent?, + private val stream: Boolean?, + private val version: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Argument to the function, which can be any JSON serializable value */ + @JsonProperty("input") fun input(): JsonValue? = input + + /** Options for tracing the function call */ + @JsonProperty("parent") fun parent(): Parent? = parent + + /** + * Whether to stream the response. If true, results will be returned in the Braintrust SSE + * format. + */ + @JsonProperty("stream") fun stream(): Boolean? = stream + + /** The version of the function */ + @JsonProperty("version") fun version(): String? = version + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FunctionInvokeBody && + this.input == other.input && + this.parent == other.parent && + this.stream == other.stream && + this.version == other.version && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + input, + parent, + stream, + version, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "FunctionInvokeBody{input=$input, parent=$parent, stream=$stream, version=$version, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var input: JsonValue? = null + private var parent: Parent? = null + private var stream: Boolean? = null + private var version: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(functionInvokeBody: FunctionInvokeBody) = apply { + this.input = functionInvokeBody.input + this.parent = functionInvokeBody.parent + this.stream = functionInvokeBody.stream + this.version = functionInvokeBody.version + additionalProperties(functionInvokeBody.additionalProperties) + } + + /** Argument to the function, which can be any JSON serializable value */ + @JsonProperty("input") fun input(input: JsonValue) = apply { this.input = input } + + /** Options for tracing the function call */ + @JsonProperty("parent") fun parent(parent: Parent) = apply { this.parent = parent } + + /** + * Whether to stream the response. If true, results will be returned in the Braintrust + * SSE format. + */ + @JsonProperty("stream") fun stream(stream: Boolean) = apply { this.stream = stream } + + /** The version of the function */ + @JsonProperty("version") fun version(version: String) = apply { this.version = version } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): FunctionInvokeBody = + FunctionInvokeBody( + input, + parent, + stream, + version, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FunctionInvokeParams && + this.functionId == other.functionId && + this.input == other.input && + this.parent == other.parent && + this.stream == other.stream && + this.version == other.version && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + functionId, + input, + parent, + stream, + version, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "FunctionInvokeParams{functionId=$functionId, input=$input, parent=$parent, stream=$stream, version=$version, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var functionId: String? = null + private var input: JsonValue? = null + private var parent: Parent? = null + private var stream: Boolean? = null + private var version: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + internal fun from(functionInvokeParams: FunctionInvokeParams) = apply { + this.functionId = functionInvokeParams.functionId + this.input = functionInvokeParams.input + this.parent = functionInvokeParams.parent + this.stream = functionInvokeParams.stream + this.version = functionInvokeParams.version + additionalQueryParams(functionInvokeParams.additionalQueryParams) + additionalHeaders(functionInvokeParams.additionalHeaders) + additionalBodyProperties(functionInvokeParams.additionalBodyProperties) + } + + /** Function id */ + fun functionId(functionId: String) = apply { this.functionId = functionId } + + /** Argument to the function, which can be any JSON serializable value */ + fun input(input: JsonValue) = apply { this.input = input } + + /** Options for tracing the function call */ + fun parent(parent: Parent) = apply { this.parent = parent } + + /** Options for tracing the function call */ + fun parent(spanParentStruct: Parent.SpanParentStruct) = apply { + this.parent = Parent.ofSpanParentStruct(spanParentStruct) + } + + /** Options for tracing the function call */ + fun parent(string: String) = apply { this.parent = Parent.ofString(string) } + + /** + * Whether to stream the response. If true, results will be returned in the Braintrust SSE + * format. + */ + fun stream(stream: Boolean) = apply { this.stream = stream } + + /** The version of the function */ + fun version(version: String) = apply { this.version = version } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): FunctionInvokeParams = + FunctionInvokeParams( + checkNotNull(functionId) { "`functionId` is required but was not set" }, + input, + parent, + stream, + version, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(using = Parent.Deserializer::class) + @JsonSerialize(using = Parent.Serializer::class) + class Parent + private constructor( + private val spanParentStruct: SpanParentStruct? = null, + private val string: String? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + /** Span parent properties */ + fun spanParentStruct(): SpanParentStruct? = spanParentStruct + /** The parent's span identifier, created by calling `.export()` on a span */ + fun string(): String? = string + + fun isSpanParentStruct(): Boolean = spanParentStruct != null + + fun isString(): Boolean = string != null + + fun asSpanParentStruct(): SpanParentStruct = spanParentStruct.getOrThrow("spanParentStruct") + + fun asString(): String = string.getOrThrow("string") + + fun _json(): JsonValue? = _json + + fun accept(visitor: Visitor): T { + return when { + spanParentStruct != null -> visitor.visitSpanParentStruct(spanParentStruct) + string != null -> visitor.visitString(string) + else -> visitor.unknown(_json) + } + } + + fun validate(): Parent = apply { + if (!validated) { + if (spanParentStruct == null && string == null) { + throw BraintrustInvalidDataException("Unknown Parent: $_json") + } + spanParentStruct?.validate() + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Parent && + this.spanParentStruct == other.spanParentStruct && + this.string == other.string + } + + override fun hashCode(): Int { + return Objects.hash(spanParentStruct, string) + } + + override fun toString(): String { + return when { + spanParentStruct != null -> "Parent{spanParentStruct=$spanParentStruct}" + string != null -> "Parent{string=$string}" + _json != null -> "Parent{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Parent") + } + } + + companion object { + + fun ofSpanParentStruct(spanParentStruct: SpanParentStruct) = + Parent(spanParentStruct = spanParentStruct) + + fun ofString(string: String) = Parent(string = string) + } + + interface Visitor { + + fun visitSpanParentStruct(spanParentStruct: SpanParentStruct): T + + fun visitString(string: String): T + + fun unknown(json: JsonValue?): T { + throw BraintrustInvalidDataException("Unknown Parent: $json") + } + } + + class Deserializer : BaseDeserializer(Parent::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Parent { + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Parent(spanParentStruct = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Parent(string = it, _json = json) + } + + return Parent(_json = json) + } + } + + class Serializer : BaseSerializer(Parent::class) { + + override fun serialize( + value: Parent, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.spanParentStruct != null -> generator.writeObject(value.spanParentStruct) + value.string != null -> generator.writeObject(value.string) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Parent") + } + } + } + + /** Span parent properties */ + @JsonDeserialize(builder = SpanParentStruct.Builder::class) + @NoAutoDetect + class SpanParentStruct + private constructor( + private val objectType: JsonField, + private val objectId: JsonField, + private val rowIds: JsonField, + private val propagatedEvent: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun objectType(): ObjectType = objectType.getRequired("object_type") + + /** The id of the container object you are logging to */ + fun objectId(): String = objectId.getRequired("object_id") + + /** Identifiers for the row to to log a subspan under */ + fun rowIds(): RowIds? = rowIds.getNullable("row_ids") + + /** Include these properties in every span created under this parent */ + fun propagatedEvent(): PropagatedEvent? = + propagatedEvent.getNullable("propagated_event") + + @JsonProperty("object_type") @ExcludeMissing fun _objectType() = objectType + + /** The id of the container object you are logging to */ + @JsonProperty("object_id") @ExcludeMissing fun _objectId() = objectId + + /** Identifiers for the row to to log a subspan under */ + @JsonProperty("row_ids") @ExcludeMissing fun _rowIds() = rowIds + + /** Include these properties in every span created under this parent */ + @JsonProperty("propagated_event") + @ExcludeMissing + fun _propagatedEvent() = propagatedEvent + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): SpanParentStruct = apply { + if (!validated) { + objectType() + objectId() + rowIds()?.validate() + propagatedEvent()?.validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SpanParentStruct && + this.objectType == other.objectType && + this.objectId == other.objectId && + this.rowIds == other.rowIds && + this.propagatedEvent == other.propagatedEvent && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + objectType, + objectId, + rowIds, + propagatedEvent, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "SpanParentStruct{objectType=$objectType, objectId=$objectId, rowIds=$rowIds, propagatedEvent=$propagatedEvent, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var objectType: JsonField = JsonMissing.of() + private var objectId: JsonField = JsonMissing.of() + private var rowIds: JsonField = JsonMissing.of() + private var propagatedEvent: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(spanParentStruct: SpanParentStruct) = apply { + this.objectType = spanParentStruct.objectType + this.objectId = spanParentStruct.objectId + this.rowIds = spanParentStruct.rowIds + this.propagatedEvent = spanParentStruct.propagatedEvent + additionalProperties(spanParentStruct.additionalProperties) + } + + fun objectType(objectType: ObjectType) = objectType(JsonField.of(objectType)) + + @JsonProperty("object_type") + @ExcludeMissing + fun objectType(objectType: JsonField) = apply { + this.objectType = objectType + } + + /** The id of the container object you are logging to */ + fun objectId(objectId: String) = objectId(JsonField.of(objectId)) + + /** The id of the container object you are logging to */ + @JsonProperty("object_id") + @ExcludeMissing + fun objectId(objectId: JsonField) = apply { this.objectId = objectId } + + /** Identifiers for the row to to log a subspan under */ + fun rowIds(rowIds: RowIds) = rowIds(JsonField.of(rowIds)) + + /** Identifiers for the row to to log a subspan under */ + @JsonProperty("row_ids") + @ExcludeMissing + fun rowIds(rowIds: JsonField) = apply { this.rowIds = rowIds } + + /** Include these properties in every span created under this parent */ + fun propagatedEvent(propagatedEvent: PropagatedEvent) = + propagatedEvent(JsonField.of(propagatedEvent)) + + /** Include these properties in every span created under this parent */ + @JsonProperty("propagated_event") + @ExcludeMissing + fun propagatedEvent(propagatedEvent: JsonField) = apply { + this.propagatedEvent = propagatedEvent + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): SpanParentStruct = + SpanParentStruct( + objectType, + objectId, + rowIds, + propagatedEvent, + additionalProperties.toUnmodifiable(), + ) + } + + class ObjectType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ObjectType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val PROJECT_LOGS = ObjectType(JsonField.of("project_logs")) + + val EXPERIMENT = ObjectType(JsonField.of("experiment")) + + fun of(value: String) = ObjectType(JsonField.of(value)) + } + + enum class Known { + PROJECT_LOGS, + EXPERIMENT, + } + + enum class Value { + PROJECT_LOGS, + EXPERIMENT, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + PROJECT_LOGS -> Value.PROJECT_LOGS + EXPERIMENT -> Value.EXPERIMENT + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + PROJECT_LOGS -> Known.PROJECT_LOGS + EXPERIMENT -> Known.EXPERIMENT + else -> throw BraintrustInvalidDataException("Unknown ObjectType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** Include these properties in every span created under this parent */ + @JsonDeserialize(builder = PropagatedEvent.Builder::class) + @NoAutoDetect + class PropagatedEvent + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): PropagatedEvent = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PropagatedEvent && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode + } + + override fun toString() = + "PropagatedEvent{additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(propagatedEvent: PropagatedEvent) = apply { + additionalProperties(propagatedEvent.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): PropagatedEvent = + PropagatedEvent(additionalProperties.toUnmodifiable()) + } + } + + /** Identifiers for the row to to log a subspan under */ + @JsonDeserialize(builder = RowIds.Builder::class) + @NoAutoDetect + class RowIds + private constructor( + private val id: JsonField, + private val spanId: JsonField, + private val rootSpanId: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The id of the row */ + fun id(): String = id.getRequired("id") + + /** The span_id of the row */ + fun spanId(): String = spanId.getRequired("span_id") + + /** The root_span_id of the row */ + fun rootSpanId(): String = rootSpanId.getRequired("root_span_id") + + /** The id of the row */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The span_id of the row */ + @JsonProperty("span_id") @ExcludeMissing fun _spanId() = spanId + + /** The root_span_id of the row */ + @JsonProperty("root_span_id") @ExcludeMissing fun _rootSpanId() = rootSpanId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): RowIds = apply { + if (!validated) { + id() + spanId() + rootSpanId() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RowIds && + this.id == other.id && + this.spanId == other.spanId && + this.rootSpanId == other.rootSpanId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + spanId, + rootSpanId, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "RowIds{id=$id, spanId=$spanId, rootSpanId=$rootSpanId, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var spanId: JsonField = JsonMissing.of() + private var rootSpanId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(rowIds: RowIds) = apply { + this.id = rowIds.id + this.spanId = rowIds.spanId + this.rootSpanId = rowIds.rootSpanId + additionalProperties(rowIds.additionalProperties) + } + + /** The id of the row */ + fun id(id: String) = id(JsonField.of(id)) + + /** The id of the row */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + /** The span_id of the row */ + fun spanId(spanId: String) = spanId(JsonField.of(spanId)) + + /** The span_id of the row */ + @JsonProperty("span_id") + @ExcludeMissing + fun spanId(spanId: JsonField) = apply { this.spanId = spanId } + + /** The root_span_id of the row */ + fun rootSpanId(rootSpanId: String) = rootSpanId(JsonField.of(rootSpanId)) + + /** The root_span_id of the row */ + @JsonProperty("root_span_id") + @ExcludeMissing + fun rootSpanId(rootSpanId: JsonField) = apply { + this.rootSpanId = rootSpanId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): RowIds = + RowIds( + id, + spanId, + rootSpanId, + additionalProperties.toUnmodifiable(), + ) + } + } + } + } +} diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeResponse.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeResponse.kt new file mode 100644 index 00000000..47762f1f --- /dev/null +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/models/FunctionInvokeResponse.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.braintrustdata.api.models + +import com.braintrustdata.api.core.ExcludeMissing +import com.braintrustdata.api.core.JsonValue +import com.braintrustdata.api.core.NoAutoDetect +import com.braintrustdata.api.core.toUnmodifiable +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import java.util.Objects + +@JsonDeserialize(builder = FunctionInvokeResponse.Builder::class) +@NoAutoDetect +class FunctionInvokeResponse +private constructor( + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): FunctionInvokeResponse = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FunctionInvokeResponse && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode + } + + override fun toString() = "FunctionInvokeResponse{additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(functionInvokeResponse: FunctionInvokeResponse) = apply { + additionalProperties(functionInvokeResponse.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): FunctionInvokeResponse = + FunctionInvokeResponse(additionalProperties.toUnmodifiable()) + } +} diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/AiSecretServiceAsync.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/AiSecretServiceAsync.kt new file mode 100644 index 00000000..c5ffeab9 --- /dev/null +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/AiSecretServiceAsync.kt @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + +package com.braintrustdata.api.services.async + +import com.braintrustdata.api.core.RequestOptions +import com.braintrustdata.api.models.AISecret +import com.braintrustdata.api.models.AiSecretCreateParams +import com.braintrustdata.api.models.AiSecretDeleteParams +import com.braintrustdata.api.models.AiSecretFindAndDeleteParams +import com.braintrustdata.api.models.AiSecretListPageAsync +import com.braintrustdata.api.models.AiSecretListParams +import com.braintrustdata.api.models.AiSecretReplaceParams +import com.braintrustdata.api.models.AiSecretRetrieveParams +import com.braintrustdata.api.models.AiSecretUpdateParams + +interface AiSecretServiceAsync { + + /** + * Create a new ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will return the existing ai_secret unmodified + */ + suspend fun create( + params: AiSecretCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** Get an ai_secret object by its id */ + suspend fun retrieve( + params: AiSecretRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** + * Partially update an ai_secret object. Specify the fields to update in the payload. Any + * object-type fields will be deep-merged with existing content. Currently we do not support + * removing fields or setting them to null. + */ + suspend fun update( + params: AiSecretUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** + * List out all ai_secrets. The ai_secrets are sorted by creation date, with the most + * recently-created ai_secrets coming first + */ + suspend fun list( + params: AiSecretListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AiSecretListPageAsync + + /** Delete an ai_secret object by its id */ + suspend fun delete( + params: AiSecretDeleteParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** Delete a single ai_secret */ + suspend fun findAndDelete( + params: AiSecretFindAndDeleteParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** + * Create or replace ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will replace the existing ai_secret with the provided fields + */ + suspend fun replace( + params: AiSecretReplaceParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret +} diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/OrgSecretServiceAsyncImpl.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/AiSecretServiceAsyncImpl.kt old mode 100755 new mode 100644 similarity index 68% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/OrgSecretServiceAsyncImpl.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/AiSecretServiceAsyncImpl.kt index 5c6195d9..de0af9d3 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/OrgSecretServiceAsyncImpl.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/AiSecretServiceAsyncImpl.kt @@ -8,42 +8,42 @@ import com.braintrustdata.api.core.http.HttpMethod import com.braintrustdata.api.core.http.HttpRequest import com.braintrustdata.api.core.http.HttpResponse.Handler import com.braintrustdata.api.errors.BraintrustError -import com.braintrustdata.api.models.OrgSecret -import com.braintrustdata.api.models.OrgSecretCreateParams -import com.braintrustdata.api.models.OrgSecretDeleteParams -import com.braintrustdata.api.models.OrgSecretFindAndDeleteParams -import com.braintrustdata.api.models.OrgSecretListPageAsync -import com.braintrustdata.api.models.OrgSecretListParams -import com.braintrustdata.api.models.OrgSecretReplaceParams -import com.braintrustdata.api.models.OrgSecretRetrieveParams -import com.braintrustdata.api.models.OrgSecretUpdateParams +import com.braintrustdata.api.models.AISecret +import com.braintrustdata.api.models.AiSecretCreateParams +import com.braintrustdata.api.models.AiSecretDeleteParams +import com.braintrustdata.api.models.AiSecretFindAndDeleteParams +import com.braintrustdata.api.models.AiSecretListPageAsync +import com.braintrustdata.api.models.AiSecretListParams +import com.braintrustdata.api.models.AiSecretReplaceParams +import com.braintrustdata.api.models.AiSecretRetrieveParams +import com.braintrustdata.api.models.AiSecretUpdateParams import com.braintrustdata.api.services.errorHandler import com.braintrustdata.api.services.json import com.braintrustdata.api.services.jsonHandler import com.braintrustdata.api.services.withErrorHandler -class OrgSecretServiceAsyncImpl +class AiSecretServiceAsyncImpl constructor( private val clientOptions: ClientOptions, -) : OrgSecretServiceAsync { +) : AiSecretServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** - * Create a new org_secret. If there is an existing org_secret with the same name as the one - * specified in the request, will return the existing org_secret unmodified + * Create a new ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will return the existing ai_secret unmodified */ override suspend fun create( - params: OrgSecretCreateParams, + params: AiSecretCreateParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -61,18 +61,18 @@ constructor( } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Get an org_secret object by its id */ + /** Get an ai_secret object by its id */ override suspend fun retrieve( - params: OrgSecretRetrieveParams, + params: AiSecretRetrieveParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("v1", "org_secret", params.getPathParam(0)) + .addPathSegments("v1", "ai_secret", params.getPathParam(0)) .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -89,22 +89,22 @@ constructor( } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** - * Partially update an org_secret object. Specify the fields to update in the payload. Any + * Partially update an ai_secret object. Specify the fields to update in the payload. Any * object-type fields will be deep-merged with existing content. Currently we do not support * removing fields or setting them to null. */ override suspend fun update( - params: OrgSecretUpdateParams, + params: AiSecretUpdateParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.PATCH) - .addPathSegments("v1", "org_secret", params.getPathParam(0)) + .addPathSegments("v1", "ai_secret", params.getPathParam(0)) .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -122,22 +122,22 @@ constructor( } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) /** - * List out all org_secrets. The org_secrets are sorted by creation date, with the most - * recently-created org_secrets coming first + * List out all ai_secrets. The ai_secrets are sorted by creation date, with the most + * recently-created ai_secrets coming first */ override suspend fun list( - params: OrgSecretListParams, + params: AiSecretListParams, requestOptions: RequestOptions - ): OrgSecretListPageAsync { + ): AiSecretListPageAsync { val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -151,22 +151,22 @@ constructor( validate() } } - .let { OrgSecretListPageAsync.of(this, params, it) } + .let { AiSecretListPageAsync.of(this, params, it) } } } - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val deleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Delete an org_secret object by its id */ + /** Delete an ai_secret object by its id */ override suspend fun delete( - params: OrgSecretDeleteParams, + params: AiSecretDeleteParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("v1", "org_secret", params.getPathParam(0)) + .addPathSegments("v1", "ai_secret", params.getPathParam(0)) .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -184,18 +184,18 @@ constructor( } } - private val findAndDeleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val findAndDeleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Delete a single org_secret */ + /** Delete a single ai_secret */ override suspend fun findAndDelete( - params: OrgSecretFindAndDeleteParams, + params: AiSecretFindAndDeleteParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -213,21 +213,21 @@ constructor( } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** - * Create or replace org_secret. If there is an existing org_secret with the same name as the - * one specified in the request, will replace the existing org_secret with the provided fields + * Create or replace ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will replace the existing ai_secret with the provided fields */ override suspend fun replace( - params: OrgSecretReplaceParams, + params: AiSecretReplaceParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsync.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsync.kt index 78e66d95..6ee2173b 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsync.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsync.kt @@ -8,6 +8,8 @@ import com.braintrustdata.api.core.RequestOptions import com.braintrustdata.api.models.Function import com.braintrustdata.api.models.FunctionCreateParams import com.braintrustdata.api.models.FunctionDeleteParams +import com.braintrustdata.api.models.FunctionInvokeParams +import com.braintrustdata.api.models.FunctionInvokeResponse import com.braintrustdata.api.models.FunctionListPageAsync import com.braintrustdata.api.models.FunctionListParams import com.braintrustdata.api.models.FunctionReplaceParams @@ -56,6 +58,12 @@ interface FunctionServiceAsync { requestOptions: RequestOptions = RequestOptions.none() ): Function + /** Invoke a function. */ + suspend fun invoke( + params: FunctionInvokeParams, + requestOptions: RequestOptions = RequestOptions.none() + ): FunctionInvokeResponse + /** * Create or replace function. If there is an existing function in the project with the same * slug as the one specified in the request, will replace the existing function with the diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsyncImpl.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsyncImpl.kt index 3fda06ad..d00cd2ec 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsyncImpl.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/FunctionServiceAsyncImpl.kt @@ -11,6 +11,8 @@ import com.braintrustdata.api.errors.BraintrustError import com.braintrustdata.api.models.Function import com.braintrustdata.api.models.FunctionCreateParams import com.braintrustdata.api.models.FunctionDeleteParams +import com.braintrustdata.api.models.FunctionInvokeParams +import com.braintrustdata.api.models.FunctionInvokeResponse import com.braintrustdata.api.models.FunctionListPageAsync import com.braintrustdata.api.models.FunctionListParams import com.braintrustdata.api.models.FunctionReplaceParams @@ -183,6 +185,29 @@ constructor( } } + private val invokeHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Invoke a function. */ + override suspend fun invoke( + params: FunctionInvokeParams, + requestOptions: RequestOptions + ): FunctionInvokeResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("v1", "function", params.getPathParam(0), "invoke") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> + response.use { invokeHandler.handle(it) } + } + } + private val replaceHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/OrgSecretServiceAsync.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/OrgSecretServiceAsync.kt deleted file mode 100755 index a966ae14..00000000 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/async/OrgSecretServiceAsync.kt +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - -package com.braintrustdata.api.services.async - -import com.braintrustdata.api.core.RequestOptions -import com.braintrustdata.api.models.OrgSecret -import com.braintrustdata.api.models.OrgSecretCreateParams -import com.braintrustdata.api.models.OrgSecretDeleteParams -import com.braintrustdata.api.models.OrgSecretFindAndDeleteParams -import com.braintrustdata.api.models.OrgSecretListPageAsync -import com.braintrustdata.api.models.OrgSecretListParams -import com.braintrustdata.api.models.OrgSecretReplaceParams -import com.braintrustdata.api.models.OrgSecretRetrieveParams -import com.braintrustdata.api.models.OrgSecretUpdateParams - -interface OrgSecretServiceAsync { - - /** - * Create a new org_secret. If there is an existing org_secret with the same name as the one - * specified in the request, will return the existing org_secret unmodified - */ - suspend fun create( - params: OrgSecretCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** Get an org_secret object by its id */ - suspend fun retrieve( - params: OrgSecretRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** - * Partially update an org_secret object. Specify the fields to update in the payload. Any - * object-type fields will be deep-merged with existing content. Currently we do not support - * removing fields or setting them to null. - */ - suspend fun update( - params: OrgSecretUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** - * List out all org_secrets. The org_secrets are sorted by creation date, with the most - * recently-created org_secrets coming first - */ - suspend fun list( - params: OrgSecretListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecretListPageAsync - - /** Delete an org_secret object by its id */ - suspend fun delete( - params: OrgSecretDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** Delete a single org_secret */ - suspend fun findAndDelete( - params: OrgSecretFindAndDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** - * Create or replace org_secret. If there is an existing org_secret with the same name as the - * one specified in the request, will replace the existing org_secret with the provided fields - */ - suspend fun replace( - params: OrgSecretReplaceParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret -} diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/AiSecretService.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/AiSecretService.kt new file mode 100644 index 00000000..cb8dcfa9 --- /dev/null +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/AiSecretService.kt @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + +package com.braintrustdata.api.services.blocking + +import com.braintrustdata.api.core.RequestOptions +import com.braintrustdata.api.models.AISecret +import com.braintrustdata.api.models.AiSecretCreateParams +import com.braintrustdata.api.models.AiSecretDeleteParams +import com.braintrustdata.api.models.AiSecretFindAndDeleteParams +import com.braintrustdata.api.models.AiSecretListPage +import com.braintrustdata.api.models.AiSecretListParams +import com.braintrustdata.api.models.AiSecretReplaceParams +import com.braintrustdata.api.models.AiSecretRetrieveParams +import com.braintrustdata.api.models.AiSecretUpdateParams + +interface AiSecretService { + + /** + * Create a new ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will return the existing ai_secret unmodified + */ + fun create( + params: AiSecretCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** Get an ai_secret object by its id */ + fun retrieve( + params: AiSecretRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** + * Partially update an ai_secret object. Specify the fields to update in the payload. Any + * object-type fields will be deep-merged with existing content. Currently we do not support + * removing fields or setting them to null. + */ + fun update( + params: AiSecretUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** + * List out all ai_secrets. The ai_secrets are sorted by creation date, with the most + * recently-created ai_secrets coming first + */ + fun list( + params: AiSecretListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AiSecretListPage + + /** Delete an ai_secret object by its id */ + fun delete( + params: AiSecretDeleteParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** Delete a single ai_secret */ + fun findAndDelete( + params: AiSecretFindAndDeleteParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret + + /** + * Create or replace ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will replace the existing ai_secret with the provided fields + */ + fun replace( + params: AiSecretReplaceParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AISecret +} diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/OrgSecretServiceImpl.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/AiSecretServiceImpl.kt old mode 100755 new mode 100644 similarity index 66% rename from braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/OrgSecretServiceImpl.kt rename to braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/AiSecretServiceImpl.kt index c0671f84..4b6cd903 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/OrgSecretServiceImpl.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/AiSecretServiceImpl.kt @@ -8,39 +8,39 @@ import com.braintrustdata.api.core.http.HttpMethod import com.braintrustdata.api.core.http.HttpRequest import com.braintrustdata.api.core.http.HttpResponse.Handler import com.braintrustdata.api.errors.BraintrustError -import com.braintrustdata.api.models.OrgSecret -import com.braintrustdata.api.models.OrgSecretCreateParams -import com.braintrustdata.api.models.OrgSecretDeleteParams -import com.braintrustdata.api.models.OrgSecretFindAndDeleteParams -import com.braintrustdata.api.models.OrgSecretListPage -import com.braintrustdata.api.models.OrgSecretListParams -import com.braintrustdata.api.models.OrgSecretReplaceParams -import com.braintrustdata.api.models.OrgSecretRetrieveParams -import com.braintrustdata.api.models.OrgSecretUpdateParams +import com.braintrustdata.api.models.AISecret +import com.braintrustdata.api.models.AiSecretCreateParams +import com.braintrustdata.api.models.AiSecretDeleteParams +import com.braintrustdata.api.models.AiSecretFindAndDeleteParams +import com.braintrustdata.api.models.AiSecretListPage +import com.braintrustdata.api.models.AiSecretListParams +import com.braintrustdata.api.models.AiSecretReplaceParams +import com.braintrustdata.api.models.AiSecretRetrieveParams +import com.braintrustdata.api.models.AiSecretUpdateParams import com.braintrustdata.api.services.errorHandler import com.braintrustdata.api.services.json import com.braintrustdata.api.services.jsonHandler import com.braintrustdata.api.services.withErrorHandler -class OrgSecretServiceImpl +class AiSecretServiceImpl constructor( private val clientOptions: ClientOptions, -) : OrgSecretService { +) : AiSecretService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** - * Create a new org_secret. If there is an existing org_secret with the same name as the one - * specified in the request, will return the existing org_secret unmodified + * Create a new ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will return the existing ai_secret unmodified */ - override fun create(params: OrgSecretCreateParams, requestOptions: RequestOptions): OrgSecret { + override fun create(params: AiSecretCreateParams, requestOptions: RequestOptions): AISecret { val request = HttpRequest.builder() .method(HttpMethod.POST) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -58,18 +58,18 @@ constructor( } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Get an org_secret object by its id */ + /** Get an ai_secret object by its id */ override fun retrieve( - params: OrgSecretRetrieveParams, + params: AiSecretRetrieveParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("v1", "org_secret", params.getPathParam(0)) + .addPathSegments("v1", "ai_secret", params.getPathParam(0)) .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -86,19 +86,19 @@ constructor( } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** - * Partially update an org_secret object. Specify the fields to update in the payload. Any + * Partially update an ai_secret object. Specify the fields to update in the payload. Any * object-type fields will be deep-merged with existing content. Currently we do not support * removing fields or setting them to null. */ - override fun update(params: OrgSecretUpdateParams, requestOptions: RequestOptions): OrgSecret { + override fun update(params: AiSecretUpdateParams, requestOptions: RequestOptions): AISecret { val request = HttpRequest.builder() .method(HttpMethod.PATCH) - .addPathSegments("v1", "org_secret", params.getPathParam(0)) + .addPathSegments("v1", "ai_secret", params.getPathParam(0)) .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -116,22 +116,22 @@ constructor( } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) /** - * List out all org_secrets. The org_secrets are sorted by creation date, with the most - * recently-created org_secrets coming first + * List out all ai_secrets. The ai_secrets are sorted by creation date, with the most + * recently-created ai_secrets coming first */ override fun list( - params: OrgSecretListParams, + params: AiSecretListParams, requestOptions: RequestOptions - ): OrgSecretListPage { + ): AiSecretListPage { val request = HttpRequest.builder() .method(HttpMethod.GET) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -145,19 +145,19 @@ constructor( validate() } } - .let { OrgSecretListPage.of(this, params, it) } + .let { AiSecretListPage.of(this, params, it) } } } - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val deleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Delete an org_secret object by its id */ - override fun delete(params: OrgSecretDeleteParams, requestOptions: RequestOptions): OrgSecret { + /** Delete an ai_secret object by its id */ + override fun delete(params: AiSecretDeleteParams, requestOptions: RequestOptions): AISecret { val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("v1", "org_secret", params.getPathParam(0)) + .addPathSegments("v1", "ai_secret", params.getPathParam(0)) .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -175,18 +175,18 @@ constructor( } } - private val findAndDeleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val findAndDeleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - /** Delete a single org_secret */ + /** Delete a single ai_secret */ override fun findAndDelete( - params: OrgSecretFindAndDeleteParams, + params: AiSecretFindAndDeleteParams, requestOptions: RequestOptions - ): OrgSecret { + ): AISecret { val request = HttpRequest.builder() .method(HttpMethod.DELETE) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) @@ -204,21 +204,18 @@ constructor( } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** - * Create or replace org_secret. If there is an existing org_secret with the same name as the - * one specified in the request, will replace the existing org_secret with the provided fields + * Create or replace ai_secret. If there is an existing ai_secret with the same name as the one + * specified in the request, will replace the existing ai_secret with the provided fields */ - override fun replace( - params: OrgSecretReplaceParams, - requestOptions: RequestOptions - ): OrgSecret { + override fun replace(params: AiSecretReplaceParams, requestOptions: RequestOptions): AISecret { val request = HttpRequest.builder() .method(HttpMethod.PUT) - .addPathSegments("v1", "org_secret") + .addPathSegments("v1", "ai_secret") .putAllQueryParams(clientOptions.queryParams) .putAllQueryParams(params.getQueryParams()) .putAllHeaders(clientOptions.headers) diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionService.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionService.kt index 3ce0f7a9..aa80d44b 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionService.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionService.kt @@ -8,6 +8,8 @@ import com.braintrustdata.api.core.RequestOptions import com.braintrustdata.api.models.Function import com.braintrustdata.api.models.FunctionCreateParams import com.braintrustdata.api.models.FunctionDeleteParams +import com.braintrustdata.api.models.FunctionInvokeParams +import com.braintrustdata.api.models.FunctionInvokeResponse import com.braintrustdata.api.models.FunctionListPage import com.braintrustdata.api.models.FunctionListParams import com.braintrustdata.api.models.FunctionReplaceParams @@ -56,6 +58,12 @@ interface FunctionService { requestOptions: RequestOptions = RequestOptions.none() ): Function + /** Invoke a function. */ + fun invoke( + params: FunctionInvokeParams, + requestOptions: RequestOptions = RequestOptions.none() + ): FunctionInvokeResponse + /** * Create or replace function. If there is an existing function in the project with the same * slug as the one specified in the request, will replace the existing function with the diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceImpl.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceImpl.kt index 95410c08..ef3824db 100755 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceImpl.kt +++ b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceImpl.kt @@ -11,6 +11,8 @@ import com.braintrustdata.api.errors.BraintrustError import com.braintrustdata.api.models.Function import com.braintrustdata.api.models.FunctionCreateParams import com.braintrustdata.api.models.FunctionDeleteParams +import com.braintrustdata.api.models.FunctionInvokeParams +import com.braintrustdata.api.models.FunctionInvokeResponse import com.braintrustdata.api.models.FunctionListPage import com.braintrustdata.api.models.FunctionListParams import com.braintrustdata.api.models.FunctionReplaceParams @@ -174,6 +176,29 @@ constructor( } } + private val invokeHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** Invoke a function. */ + override fun invoke( + params: FunctionInvokeParams, + requestOptions: RequestOptions + ): FunctionInvokeResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("v1", "function", params.getPathParam(0), "invoke") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response.use { invokeHandler.handle(it) } + } + } + private val replaceHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/OrgSecretService.kt b/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/OrgSecretService.kt deleted file mode 100755 index 8cd11821..00000000 --- a/braintrust-kotlin-core/src/main/kotlin/com/braintrustdata/api/services/blocking/OrgSecretService.kt +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - -package com.braintrustdata.api.services.blocking - -import com.braintrustdata.api.core.RequestOptions -import com.braintrustdata.api.models.OrgSecret -import com.braintrustdata.api.models.OrgSecretCreateParams -import com.braintrustdata.api.models.OrgSecretDeleteParams -import com.braintrustdata.api.models.OrgSecretFindAndDeleteParams -import com.braintrustdata.api.models.OrgSecretListPage -import com.braintrustdata.api.models.OrgSecretListParams -import com.braintrustdata.api.models.OrgSecretReplaceParams -import com.braintrustdata.api.models.OrgSecretRetrieveParams -import com.braintrustdata.api.models.OrgSecretUpdateParams - -interface OrgSecretService { - - /** - * Create a new org_secret. If there is an existing org_secret with the same name as the one - * specified in the request, will return the existing org_secret unmodified - */ - fun create( - params: OrgSecretCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** Get an org_secret object by its id */ - fun retrieve( - params: OrgSecretRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** - * Partially update an org_secret object. Specify the fields to update in the payload. Any - * object-type fields will be deep-merged with existing content. Currently we do not support - * removing fields or setting them to null. - */ - fun update( - params: OrgSecretUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** - * List out all org_secrets. The org_secrets are sorted by creation date, with the most - * recently-created org_secrets coming first - */ - fun list( - params: OrgSecretListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecretListPage - - /** Delete an org_secret object by its id */ - fun delete( - params: OrgSecretDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** Delete a single org_secret */ - fun findAndDelete( - params: OrgSecretFindAndDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret - - /** - * Create or replace org_secret. If there is an existing org_secret with the same name as the - * one specified in the request, will replace the existing org_secret with the provided fields - */ - fun replace( - params: OrgSecretReplaceParams, - requestOptions: RequestOptions = RequestOptions.none() - ): OrgSecret -} diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AISecretTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AISecretTest.kt new file mode 100644 index 00000000..561dc76b --- /dev/null +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AISecretTest.kt @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.braintrustdata.api.models + +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class AISecretTest { + + @Test + fun createAISecret() { + val aISecret = + AISecret.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .orgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .metadata(AISecret.Metadata.builder().build()) + .previewSecret("preview_secret") + .type("type") + .build() + assertThat(aISecret).isNotNull + assertThat(aISecret.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(aISecret.name()).isEqualTo("name") + assertThat(aISecret.orgId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(aISecret.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(aISecret.metadata()).isEqualTo(AISecret.Metadata.builder().build()) + assertThat(aISecret.previewSecret()).isEqualTo("preview_secret") + assertThat(aISecret.type()).isEqualTo("type") + } +} diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretReplaceParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretCreateParamsTest.kt old mode 100755 new mode 100644 similarity index 68% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretReplaceParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretCreateParamsTest.kt index 8c5a57ac..803786eb --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretReplaceParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretCreateParamsTest.kt @@ -6,13 +6,13 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretReplaceParamsTest { +class AiSecretCreateParamsTest { @Test - fun createOrgSecretReplaceParams() { - OrgSecretReplaceParams.builder() + fun createAiSecretCreateParams() { + AiSecretCreateParams.builder() .name("name") - .metadata(OrgSecretReplaceParams.Metadata.builder().build()) + .metadata(AiSecretCreateParams.Metadata.builder().build()) .orgName("org_name") .secret("secret") .type("type") @@ -22,9 +22,9 @@ class OrgSecretReplaceParamsTest { @Test fun getBody() { val params = - OrgSecretReplaceParams.builder() + AiSecretCreateParams.builder() .name("name") - .metadata(OrgSecretReplaceParams.Metadata.builder().build()) + .metadata(AiSecretCreateParams.Metadata.builder().build()) .orgName("org_name") .secret("secret") .type("type") @@ -32,7 +32,7 @@ class OrgSecretReplaceParamsTest { val body = params.getBody() assertThat(body).isNotNull assertThat(body.name()).isEqualTo("name") - assertThat(body.metadata()).isEqualTo(OrgSecretReplaceParams.Metadata.builder().build()) + assertThat(body.metadata()).isEqualTo(AiSecretCreateParams.Metadata.builder().build()) assertThat(body.orgName()).isEqualTo("org_name") assertThat(body.secret()).isEqualTo("secret") assertThat(body.type()).isEqualTo("type") @@ -40,7 +40,7 @@ class OrgSecretReplaceParamsTest { @Test fun getBodyWithoutOptionalFields() { - val params = OrgSecretReplaceParams.builder().name("name").build() + val params = AiSecretCreateParams.builder().name("name").build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.name()).isEqualTo("name") diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretRetrieveParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretDeleteParamsTest.kt old mode 100755 new mode 100644 similarity index 60% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretRetrieveParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretDeleteParamsTest.kt index d22d2980..5f984b71 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretRetrieveParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretDeleteParamsTest.kt @@ -6,23 +6,21 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretRetrieveParamsTest { +class AiSecretDeleteParamsTest { @Test - fun createOrgSecretRetrieveParams() { - OrgSecretRetrieveParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() + fun createAiSecretDeleteParams() { + AiSecretDeleteParams.builder().aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() } @Test fun getPathParam() { val params = - OrgSecretRetrieveParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + AiSecretDeleteParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(params).isNotNull - // path param "orgSecretId" + // path param "aiSecretId" assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param assertThat(params.getPathParam(1)).isEqualTo("") diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretFindAndDeleteParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParamsTest.kt similarity index 63% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretFindAndDeleteParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParamsTest.kt index 3bd93b25..e3e4da8a 100644 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretFindAndDeleteParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretFindAndDeleteParamsTest.kt @@ -6,16 +6,16 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretFindAndDeleteParamsTest { +class AiSecretFindAndDeleteParamsTest { @Test - fun createOrgSecretFindAndDeleteParams() { - OrgSecretFindAndDeleteParams.builder().name("name").orgName("org_name").build() + fun createAiSecretFindAndDeleteParams() { + AiSecretFindAndDeleteParams.builder().name("name").orgName("org_name").build() } @Test fun getBody() { - val params = OrgSecretFindAndDeleteParams.builder().name("name").orgName("org_name").build() + val params = AiSecretFindAndDeleteParams.builder().name("name").orgName("org_name").build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.name()).isEqualTo("name") @@ -24,7 +24,7 @@ class OrgSecretFindAndDeleteParamsTest { @Test fun getBodyWithoutOptionalFields() { - val params = OrgSecretFindAndDeleteParams.builder().name("name").build() + val params = AiSecretFindAndDeleteParams.builder().name("name").build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.name()).isEqualTo("name") diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretListParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretListParamsTest.kt old mode 100755 new mode 100644 similarity index 60% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretListParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretListParamsTest.kt index 69c5d0f6..27820e93 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretListParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretListParamsTest.kt @@ -6,17 +6,17 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretListParamsTest { +class AiSecretListParamsTest { @Test - fun createOrgSecretListParams() { - OrgSecretListParams.builder() + fun createAiSecretListParams() { + AiSecretListParams.builder() + .aiSecretName("ai_secret_name") + .aiSecretType(AiSecretListParams.AiSecretType.ofString("string")) .endingBefore("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .ids(OrgSecretListParams.Ids.ofString("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")) + .ids(AiSecretListParams.Ids.ofString("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")) .limit(123L) .orgName("org_name") - .orgSecretName("org_secret_name") - .orgSecretType(OrgSecretListParams.OrgSecretType.ofString("string")) .startingAfter("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() } @@ -24,37 +24,37 @@ class OrgSecretListParamsTest { @Test fun getQueryParams() { val params = - OrgSecretListParams.builder() + AiSecretListParams.builder() + .aiSecretName("ai_secret_name") + .aiSecretType(AiSecretListParams.AiSecretType.ofString("string")) .endingBefore("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .ids(OrgSecretListParams.Ids.ofString("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")) + .ids(AiSecretListParams.Ids.ofString("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")) .limit(123L) .orgName("org_name") - .orgSecretName("org_secret_name") - .orgSecretType(OrgSecretListParams.OrgSecretType.ofString("string")) .startingAfter("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val expected = mutableMapOf>() + expected.put("ai_secret_name", listOf("ai_secret_name")) + expected.put( + "ai_secret_type", + listOf(AiSecretListParams.AiSecretType.ofString("string").toString()) + ) expected.put("ending_before", listOf("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")) expected.put( "ids", listOf( - OrgSecretListParams.Ids.ofString("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").toString() + AiSecretListParams.Ids.ofString("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").toString() ) ) expected.put("limit", listOf("123")) expected.put("org_name", listOf("org_name")) - expected.put("org_secret_name", listOf("org_secret_name")) - expected.put( - "org_secret_type", - listOf(OrgSecretListParams.OrgSecretType.ofString("string").toString()) - ) expected.put("starting_after", listOf("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")) assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = OrgSecretListParams.builder().build() + val params = AiSecretListParams.builder().build() val expected = mutableMapOf>() assertThat(params.getQueryParams()).isEqualTo(expected) } diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretCreateParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretReplaceParamsTest.kt old mode 100755 new mode 100644 similarity index 72% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretCreateParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretReplaceParamsTest.kt index 1b409e00..3204ee97 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretCreateParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretReplaceParamsTest.kt @@ -6,13 +6,13 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretCreateParamsTest { +class AiSecretReplaceParamsTest { @Test - fun createOrgSecretCreateParams() { - OrgSecretCreateParams.builder() + fun createAiSecretReplaceParams() { + AiSecretReplaceParams.builder() .name("name") - .metadata(OrgSecretCreateParams.Metadata.builder().build()) + .metadata(AiSecretReplaceParams.Metadata.builder().build()) .orgName("org_name") .secret("secret") .type("type") @@ -22,9 +22,9 @@ class OrgSecretCreateParamsTest { @Test fun getBody() { val params = - OrgSecretCreateParams.builder() + AiSecretReplaceParams.builder() .name("name") - .metadata(OrgSecretCreateParams.Metadata.builder().build()) + .metadata(AiSecretReplaceParams.Metadata.builder().build()) .orgName("org_name") .secret("secret") .type("type") @@ -32,7 +32,7 @@ class OrgSecretCreateParamsTest { val body = params.getBody() assertThat(body).isNotNull assertThat(body.name()).isEqualTo("name") - assertThat(body.metadata()).isEqualTo(OrgSecretCreateParams.Metadata.builder().build()) + assertThat(body.metadata()).isEqualTo(AiSecretReplaceParams.Metadata.builder().build()) assertThat(body.orgName()).isEqualTo("org_name") assertThat(body.secret()).isEqualTo("secret") assertThat(body.type()).isEqualTo("type") @@ -40,7 +40,7 @@ class OrgSecretCreateParamsTest { @Test fun getBodyWithoutOptionalFields() { - val params = OrgSecretCreateParams.builder().name("name").build() + val params = AiSecretReplaceParams.builder().name("name").build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.name()).isEqualTo("name") diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretDeleteParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretRetrieveParamsTest.kt old mode 100755 new mode 100644 similarity index 66% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretDeleteParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretRetrieveParamsTest.kt index 3dbacbc3..c2a28575 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretDeleteParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretRetrieveParamsTest.kt @@ -6,21 +6,21 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretDeleteParamsTest { +class AiSecretRetrieveParamsTest { @Test - fun createOrgSecretDeleteParams() { - OrgSecretDeleteParams.builder().orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + fun createAiSecretRetrieveParams() { + AiSecretRetrieveParams.builder().aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() } @Test fun getPathParam() { val params = - OrgSecretDeleteParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + AiSecretRetrieveParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(params).isNotNull - // path param "orgSecretId" + // path param "aiSecretId" assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param assertThat(params.getPathParam(1)).isEqualTo("") diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretUpdateParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretUpdateParamsTest.kt old mode 100755 new mode 100644 similarity index 60% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretUpdateParamsTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretUpdateParamsTest.kt index abee260a..d324f0a2 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretUpdateParamsTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/AiSecretUpdateParamsTest.kt @@ -6,13 +6,13 @@ import com.braintrustdata.api.models.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -class OrgSecretUpdateParamsTest { +class AiSecretUpdateParamsTest { @Test - fun createOrgSecretUpdateParams() { - OrgSecretUpdateParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .metadata(OrgSecretUpdateParams.Metadata.builder().build()) + fun createAiSecretUpdateParams() { + AiSecretUpdateParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .metadata(AiSecretUpdateParams.Metadata.builder().build()) .name("name") .secret("secret") .type("type") @@ -22,16 +22,16 @@ class OrgSecretUpdateParamsTest { @Test fun getBody() { val params = - OrgSecretUpdateParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .metadata(OrgSecretUpdateParams.Metadata.builder().build()) + AiSecretUpdateParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .metadata(AiSecretUpdateParams.Metadata.builder().build()) .name("name") .secret("secret") .type("type") .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.metadata()).isEqualTo(OrgSecretUpdateParams.Metadata.builder().build()) + assertThat(body.metadata()).isEqualTo(AiSecretUpdateParams.Metadata.builder().build()) assertThat(body.name()).isEqualTo("name") assertThat(body.secret()).isEqualTo("secret") assertThat(body.type()).isEqualTo("type") @@ -40,8 +40,8 @@ class OrgSecretUpdateParamsTest { @Test fun getBodyWithoutOptionalFields() { val params = - OrgSecretUpdateParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + AiSecretUpdateParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val body = params.getBody() assertThat(body).isNotNull @@ -50,11 +50,11 @@ class OrgSecretUpdateParamsTest { @Test fun getPathParam() { val params = - OrgSecretUpdateParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + AiSecretUpdateParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(params).isNotNull - // path param "orgSecretId" + // path param "aiSecretId" assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") // out-of-bound path param assertThat(params.getPathParam(1)).isEqualTo("") diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/FunctionInvokeParamsTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/FunctionInvokeParamsTest.kt new file mode 100644 index 00000000..13772aa3 --- /dev/null +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/FunctionInvokeParamsTest.kt @@ -0,0 +1,125 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.braintrustdata.api.models + +import com.braintrustdata.api.core.JsonValue +import com.braintrustdata.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class FunctionInvokeParamsTest { + + @Test + fun createFunctionInvokeParams() { + FunctionInvokeParams.builder() + .functionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .input(JsonValue.from(mapOf())) + .parent( + FunctionInvokeParams.Parent.ofSpanParentStruct( + FunctionInvokeParams.Parent.SpanParentStruct.builder() + .objectId("object_id") + .objectType( + FunctionInvokeParams.Parent.SpanParentStruct.ObjectType.PROJECT_LOGS + ) + .propagatedEvent( + FunctionInvokeParams.Parent.SpanParentStruct.PropagatedEvent.builder() + .build() + ) + .rowIds( + FunctionInvokeParams.Parent.SpanParentStruct.RowIds.builder() + .id("id") + .rootSpanId("root_span_id") + .spanId("span_id") + .build() + ) + .build() + ) + ) + .stream(true) + .version("version") + .build() + } + + @Test + fun getBody() { + val params = + FunctionInvokeParams.builder() + .functionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .input(JsonValue.from(mapOf())) + .parent( + FunctionInvokeParams.Parent.ofSpanParentStruct( + FunctionInvokeParams.Parent.SpanParentStruct.builder() + .objectId("object_id") + .objectType( + FunctionInvokeParams.Parent.SpanParentStruct.ObjectType.PROJECT_LOGS + ) + .propagatedEvent( + FunctionInvokeParams.Parent.SpanParentStruct.PropagatedEvent + .builder() + .build() + ) + .rowIds( + FunctionInvokeParams.Parent.SpanParentStruct.RowIds.builder() + .id("id") + .rootSpanId("root_span_id") + .spanId("span_id") + .build() + ) + .build() + ) + ) + .stream(true) + .version("version") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.input()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body.parent()) + .isEqualTo( + FunctionInvokeParams.Parent.ofSpanParentStruct( + FunctionInvokeParams.Parent.SpanParentStruct.builder() + .objectId("object_id") + .objectType( + FunctionInvokeParams.Parent.SpanParentStruct.ObjectType.PROJECT_LOGS + ) + .propagatedEvent( + FunctionInvokeParams.Parent.SpanParentStruct.PropagatedEvent.builder() + .build() + ) + .rowIds( + FunctionInvokeParams.Parent.SpanParentStruct.RowIds.builder() + .id("id") + .rootSpanId("root_span_id") + .spanId("span_id") + .build() + ) + .build() + ) + ) + assertThat(body.stream()).isEqualTo(true) + assertThat(body.version()).isEqualTo("version") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + FunctionInvokeParams.builder() + .functionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val body = params.getBody() + assertThat(body).isNotNull + } + + @Test + fun getPathParam() { + val params = + FunctionInvokeParams.builder() + .functionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(params).isNotNull + // path param "functionId" + assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretTest.kt deleted file mode 100755 index 24865e94..00000000 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/models/OrgSecretTest.kt +++ /dev/null @@ -1,32 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.braintrustdata.api.models - -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class OrgSecretTest { - - @Test - fun createOrgSecret() { - val orgSecret = - OrgSecret.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .orgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .metadata(OrgSecret.Metadata.builder().build()) - .previewSecret("preview_secret") - .type("type") - .build() - assertThat(orgSecret).isNotNull - assertThat(orgSecret.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(orgSecret.name()).isEqualTo("name") - assertThat(orgSecret.orgId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(orgSecret.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(orgSecret.metadata()).isEqualTo(OrgSecret.Metadata.builder().build()) - assertThat(orgSecret.previewSecret()).isEqualTo("preview_secret") - assertThat(orgSecret.type()).isEqualTo("type") - } -} diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/OrgSecretServiceTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/AiSecretServiceTest.kt old mode 100755 new mode 100644 similarity index 57% rename from braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/OrgSecretServiceTest.kt rename to braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/AiSecretServiceTest.kt index 1a3f9bb0..6214ccca --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/OrgSecretServiceTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/AiSecretServiceTest.kt @@ -5,12 +5,12 @@ package com.braintrustdata.api.services.blocking import com.braintrustdata.api.TestServerExtension import com.braintrustdata.api.client.okhttp.BraintrustOkHttpClient import com.braintrustdata.api.models.* -import com.braintrustdata.api.models.OrgSecretListParams +import com.braintrustdata.api.models.AiSecretListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) -class OrgSecretServiceTest { +class AiSecretServiceTest { @Test fun callCreate() { @@ -19,19 +19,19 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val orgSecret = - orgSecretService.create( - OrgSecretCreateParams.builder() + val aiSecretService = client.aiSecret() + val aISecret = + aiSecretService.create( + AiSecretCreateParams.builder() .name("name") - .metadata(OrgSecretCreateParams.Metadata.builder().build()) + .metadata(AiSecretCreateParams.Metadata.builder().build()) .orgName("org_name") .secret("secret") .type("type") .build() ) - println(orgSecret) - orgSecret.validate() + println(aISecret) + aISecret.validate() } @Test @@ -41,15 +41,15 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val orgSecret = - orgSecretService.retrieve( - OrgSecretRetrieveParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + val aiSecretService = client.aiSecret() + val aISecret = + aiSecretService.retrieve( + AiSecretRetrieveParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - println(orgSecret) - orgSecret.validate() + println(aISecret) + aISecret.validate() } @Test @@ -59,19 +59,19 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val orgSecret = - orgSecretService.update( - OrgSecretUpdateParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .metadata(OrgSecretUpdateParams.Metadata.builder().build()) + val aiSecretService = client.aiSecret() + val aISecret = + aiSecretService.update( + AiSecretUpdateParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .metadata(AiSecretUpdateParams.Metadata.builder().build()) .name("name") .secret("secret") .type("type") .build() ) - println(orgSecret) - orgSecret.validate() + println(aISecret) + aISecret.validate() } @Test @@ -81,8 +81,8 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val response = orgSecretService.list(OrgSecretListParams.builder().build()) + val aiSecretService = client.aiSecret() + val response = aiSecretService.list(AiSecretListParams.builder().build()) println(response) response.objects().forEach { it.validate() } } @@ -94,15 +94,15 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val orgSecret = - orgSecretService.delete( - OrgSecretDeleteParams.builder() - .orgSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + val aiSecretService = client.aiSecret() + val aISecret = + aiSecretService.delete( + AiSecretDeleteParams.builder() + .aiSecretId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - println(orgSecret) - orgSecret.validate() + println(aISecret) + aISecret.validate() } @Test @@ -112,13 +112,13 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val orgSecret = - orgSecretService.findAndDelete( - OrgSecretFindAndDeleteParams.builder().name("name").orgName("org_name").build() + val aiSecretService = client.aiSecret() + val aISecret = + aiSecretService.findAndDelete( + AiSecretFindAndDeleteParams.builder().name("name").orgName("org_name").build() ) - println(orgSecret) - orgSecret.validate() + println(aISecret) + aISecret.validate() } @Test @@ -128,18 +128,18 @@ class OrgSecretServiceTest { .baseUrl(TestServerExtension.BASE_URL) .apiKey("My API Key") .build() - val orgSecretService = client.orgSecret() - val orgSecret = - orgSecretService.replace( - OrgSecretReplaceParams.builder() + val aiSecretService = client.aiSecret() + val aISecret = + aiSecretService.replace( + AiSecretReplaceParams.builder() .name("name") - .metadata(OrgSecretReplaceParams.Metadata.builder().build()) + .metadata(AiSecretReplaceParams.Metadata.builder().build()) .orgName("org_name") .secret("secret") .type("type") .build() ) - println(orgSecret) - orgSecret.validate() + println(aISecret) + aISecret.validate() } } diff --git a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceTest.kt b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceTest.kt index e05e9bb4..0836c694 100755 --- a/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceTest.kt +++ b/braintrust-kotlin-core/src/test/kotlin/com/braintrustdata/api/services/blocking/FunctionServiceTest.kt @@ -4,6 +4,7 @@ package com.braintrustdata.api.services.blocking import com.braintrustdata.api.TestServerExtension import com.braintrustdata.api.client.okhttp.BraintrustOkHttpClient +import com.braintrustdata.api.core.JsonValue import com.braintrustdata.api.models.* import com.braintrustdata.api.models.FunctionListParams import org.junit.jupiter.api.Test @@ -288,6 +289,49 @@ class FunctionServiceTest { function.validate() } + @Test + fun callInvoke() { + val client = + BraintrustOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val functionService = client.function() + val functionInvokeResponse = + functionService.invoke( + FunctionInvokeParams.builder() + .functionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .input(JsonValue.from(mapOf())) + .parent( + FunctionInvokeParams.Parent.ofSpanParentStruct( + FunctionInvokeParams.Parent.SpanParentStruct.builder() + .objectId("object_id") + .objectType( + FunctionInvokeParams.Parent.SpanParentStruct.ObjectType + .PROJECT_LOGS + ) + .propagatedEvent( + FunctionInvokeParams.Parent.SpanParentStruct.PropagatedEvent + .builder() + .build() + ) + .rowIds( + FunctionInvokeParams.Parent.SpanParentStruct.RowIds.builder() + .id("id") + .rootSpanId("root_span_id") + .spanId("span_id") + .build() + ) + .build() + ) + ) + .stream(true) + .version("version") + .build() + ) + println(functionInvokeResponse) + } + @Test fun callReplace() { val client =