diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index 367f9d8..9af25ea 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -153,8 +153,8 @@ private constructor( clock, baseUrl, apiKey, - headers.toUnmodifiable(), - queryParams.toUnmodifiable(), + headers.toImmutable(), + queryParams.toImmutable(), responseValidation, maxRetries, ) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt index 2351f9c..535cb02 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt @@ -4,7 +4,6 @@ package com.openlayer.api.core import com.google.common.collect.ImmutableListMultimap import com.google.common.collect.ListMultimap -import com.google.common.collect.Multimaps import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Collections @@ -13,30 +12,15 @@ internal fun T?.getOrThrow(name: String): T = this ?: throw OpenlayerInvalidDataException("`${name}` is not present") @JvmSynthetic -internal fun List.toUnmodifiable(): List { - if (isEmpty()) { - return Collections.emptyList() - } - - return Collections.unmodifiableList(this) -} +internal fun List.toImmutable(): List = + if (isEmpty()) Collections.emptyList() else Collections.unmodifiableList(toList()) @JvmSynthetic -internal fun Map.toUnmodifiable(): Map { - if (isEmpty()) { - return Collections.emptyMap() - } - - return Collections.unmodifiableMap(this) -} +internal fun Map.toImmutable(): Map = + if (isEmpty()) Collections.emptyMap() else Collections.unmodifiableMap(toMap()) @JvmSynthetic -internal fun ListMultimap.toUnmodifiable(): ListMultimap { - if (isEmpty()) { - return ImmutableListMultimap.of() - } - - return Multimaps.unmodifiableListMultimap(this) -} +internal fun ListMultimap.toImmutable(): ListMultimap = + ImmutableListMultimap.copyOf(this) internal interface Enum diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index b0e1059..fc2653e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -389,7 +389,7 @@ private constructor( override fun toString() = values.toString() companion object { - @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toUnmodifiable()) + @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toImmutable()) } } @@ -415,7 +415,7 @@ private constructor( companion object { @JsonCreator @JvmStatic - fun of(values: Map) = JsonObject(values.toUnmodifiable()) + fun of(values: Map) = JsonObject(values.toImmutable()) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt deleted file mode 100644 index 79dd3d8..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.openlayer.api.core.http - -import java.io.IOException -import java.io.InputStream -import java.io.OutputStream -import java.lang.AutoCloseable -import java.util.Optional - -interface BinaryResponseContent : AutoCloseable { - - fun contentType(): Optional - - fun body(): InputStream - - @Throws(IOException::class) fun writeTo(outputStream: OutputStream) -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt index f7c3a90..dbb6e3e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt @@ -4,7 +4,7 @@ import com.google.common.collect.ArrayListMultimap import com.google.common.collect.ListMultimap import com.google.common.collect.Multimap import com.google.common.collect.MultimapBuilder -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable class HttpRequest private constructor( @@ -83,8 +83,8 @@ private constructor( HttpRequest( checkNotNull(method) { "`method` is required but was not set" }, url, - pathSegments.toUnmodifiable(), - queryParams.toUnmodifiable(), + pathSegments.toImmutable(), + queryParams.toImmutable(), headers, body, ) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index d22ee41..b324349 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import java.util.Objects @JsonDeserialize(builder = OpenlayerError.Builder::class) @@ -60,6 +60,6 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): OpenlayerError = OpenlayerError(additionalProperties.toUnmodifiable()) + fun build(): OpenlayerError = OpenlayerError(additionalProperties.toImmutable()) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitCreateParams.kt deleted file mode 100644 index 295c594..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitCreateParams.kt +++ /dev/null @@ -1,673 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.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.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ExcludeMissing -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.* -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional - -class CommitCreateParams -constructor( - private val projectId: String, - private val commit: Commit, - private val storageUri: String, - private val archived: Boolean?, - private val deploymentStatus: String?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, -) { - - fun projectId(): String = projectId - - fun commit(): Commit = commit - - fun storageUri(): String = storageUri - - fun archived(): Optional = Optional.ofNullable(archived) - - fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus) - - @JvmSynthetic - internal fun getBody(): CommitCreateBody { - return CommitCreateBody( - commit, - storageUri, - archived, - deploymentStatus, - additionalBodyProperties, - ) - } - - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } - } - - @JsonDeserialize(builder = CommitCreateBody.Builder::class) - @NoAutoDetect - class CommitCreateBody - internal constructor( - private val commit: Commit?, - private val storageUri: String?, - private val archived: Boolean?, - private val deploymentStatus: String?, - private val additionalProperties: Map, - ) { - - /** The details of a commit (project version). */ - @JsonProperty("commit") fun commit(): Commit? = commit - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") fun storageUri(): String? = storageUri - - /** Whether the commit is archived. */ - @JsonProperty("archived") fun archived(): Boolean? = archived - - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") fun deploymentStatus(): String? = deploymentStatus - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var commit: Commit? = null - private var storageUri: String? = null - private var archived: Boolean? = null - private var deploymentStatus: String? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commitCreateBody: CommitCreateBody) = apply { - this.commit = commitCreateBody.commit - this.storageUri = commitCreateBody.storageUri - this.archived = commitCreateBody.archived - this.deploymentStatus = commitCreateBody.deploymentStatus - additionalProperties(commitCreateBody.additionalProperties) - } - - /** The details of a commit (project version). */ - @JsonProperty("commit") fun commit(commit: Commit) = apply { this.commit = commit } - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } - - /** Whether the commit is archived. */ - @JsonProperty("archived") - fun archived(archived: Boolean) = apply { this.archived = archived } - - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - fun deploymentStatus(deploymentStatus: String) = apply { - this.deploymentStatus = deploymentStatus - } - - 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(): CommitCreateBody = - CommitCreateBody( - checkNotNull(commit) { "`commit` is required but was not set" }, - checkNotNull(storageUri) { "`storageUri` is required but was not set" }, - archived, - deploymentStatus, - additionalProperties.toUnmodifiable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CommitCreateBody && this.commit == other.commit && this.storageUri == other.storageUri && this.archived == other.archived && this.deploymentStatus == other.deploymentStatus && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(commit, storageUri, archived, deploymentStatus, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "CommitCreateBody{commit=$commit, storageUri=$storageUri, archived=$archived, deploymentStatus=$deploymentStatus, additionalProperties=$additionalProperties}" - } - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CommitCreateParams && this.projectId == other.projectId && this.commit == other.commit && this.storageUri == other.storageUri && this.archived == other.archived && this.deploymentStatus == other.deploymentStatus && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(projectId, commit, storageUri, archived, deploymentStatus, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ - } - - override fun toString() = - "CommitCreateParams{projectId=$projectId, commit=$commit, storageUri=$storageUri, archived=$archived, deploymentStatus=$deploymentStatus, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var projectId: String? = null - private var commit: Commit? = null - private var storageUri: String? = null - private var archived: Boolean? = null - private var deploymentStatus: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commitCreateParams: CommitCreateParams) = apply { - this.projectId = commitCreateParams.projectId - this.commit = commitCreateParams.commit - this.storageUri = commitCreateParams.storageUri - this.archived = commitCreateParams.archived - this.deploymentStatus = commitCreateParams.deploymentStatus - additionalQueryParams(commitCreateParams.additionalQueryParams) - additionalHeaders(commitCreateParams.additionalHeaders) - additionalBodyProperties(commitCreateParams.additionalBodyProperties) - } - - fun projectId(projectId: String) = apply { this.projectId = projectId } - - /** The details of a commit (project version). */ - fun commit(commit: Commit) = apply { this.commit = commit } - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } - - /** Whether the commit is archived. */ - fun archived(archived: Boolean) = apply { this.archived = archived } - - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = apply { - this.deploymentStatus = deploymentStatus - } - - 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(): CommitCreateParams = - CommitCreateParams( - checkNotNull(projectId) { "`projectId` is required but was not set" }, - checkNotNull(commit) { "`commit` is required but was not set" }, - checkNotNull(storageUri) { "`storageUri` is required but was not set" }, - archived, - deploymentStatus, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) - } - - /** The details of a commit (project version). */ - @JsonDeserialize(builder = Commit.Builder::class) - @NoAutoDetect - class Commit - private constructor( - private val id: String?, - private val authorId: String?, - private val dateCreated: OffsetDateTime?, - private val fileSize: Long?, - private val message: String?, - private val mlModelId: String?, - private val validationDatasetId: String?, - private val trainingDatasetId: String?, - private val storageUri: String?, - private val gitCommitSha: Long?, - private val gitCommitRef: String?, - private val gitCommitUrl: String?, - private val additionalProperties: Map, - ) { - - /** The commit id. */ - @JsonProperty("id") fun id(): String? = id - - /** The author id of the commit. */ - @JsonProperty("authorId") fun authorId(): String? = authorId - - /** The commit creation date. */ - @JsonProperty("dateCreated") fun dateCreated(): OffsetDateTime? = dateCreated - - /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") fun fileSize(): Long? = fileSize - - /** The commit message. */ - @JsonProperty("message") fun message(): String? = message - - /** The model id. */ - @JsonProperty("mlModelId") fun mlModelId(): String? = mlModelId - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - fun validationDatasetId(): String? = validationDatasetId - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") fun trainingDatasetId(): String? = trainingDatasetId - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") fun storageUri(): String? = storageUri - - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") fun gitCommitSha(): Long? = gitCommitSha - - /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") fun gitCommitRef(): String? = gitCommitRef - - /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") fun gitCommitUrl(): String? = gitCommitUrl - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: String? = null - private var authorId: String? = null - private var dateCreated: OffsetDateTime? = null - private var fileSize: Long? = null - private var message: String? = null - private var mlModelId: String? = null - private var validationDatasetId: String? = null - private var trainingDatasetId: String? = null - private var storageUri: String? = null - private var gitCommitSha: Long? = null - private var gitCommitRef: String? = null - private var gitCommitUrl: String? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commit: Commit) = apply { - this.id = commit.id - this.authorId = commit.authorId - this.dateCreated = commit.dateCreated - this.fileSize = commit.fileSize - this.message = commit.message - this.mlModelId = commit.mlModelId - this.validationDatasetId = commit.validationDatasetId - this.trainingDatasetId = commit.trainingDatasetId - this.storageUri = commit.storageUri - this.gitCommitSha = commit.gitCommitSha - this.gitCommitRef = commit.gitCommitRef - this.gitCommitUrl = commit.gitCommitUrl - additionalProperties(commit.additionalProperties) - } - - /** The commit id. */ - @JsonProperty("id") fun id(id: String) = apply { this.id = id } - - /** The author id of the commit. */ - @JsonProperty("authorId") - fun authorId(authorId: String) = apply { this.authorId = authorId } - - /** The commit creation date. */ - @JsonProperty("dateCreated") - fun dateCreated(dateCreated: OffsetDateTime) = apply { this.dateCreated = dateCreated } - - /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - fun fileSize(fileSize: Long) = apply { this.fileSize = fileSize } - - /** The commit message. */ - @JsonProperty("message") fun message(message: String) = apply { this.message = message } - - /** The model id. */ - @JsonProperty("mlModelId") - fun mlModelId(mlModelId: String) = apply { this.mlModelId = mlModelId } - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - fun validationDatasetId(validationDatasetId: String) = apply { - this.validationDatasetId = validationDatasetId - } - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - fun trainingDatasetId(trainingDatasetId: String) = apply { - this.trainingDatasetId = trainingDatasetId - } - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } - - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - fun gitCommitSha(gitCommitSha: Long) = apply { this.gitCommitSha = gitCommitSha } - - /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - fun gitCommitRef(gitCommitRef: String) = apply { this.gitCommitRef = gitCommitRef } - - /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - fun gitCommitUrl(gitCommitUrl: String) = apply { this.gitCommitUrl = gitCommitUrl } - - 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(): Commit = - Commit( - checkNotNull(id) { "`id` is required but was not set" }, - checkNotNull(authorId) { "`authorId` is required but was not set" }, - dateCreated, - fileSize, - checkNotNull(message) { "`message` is required but was not set" }, - mlModelId, - validationDatasetId, - trainingDatasetId, - checkNotNull(storageUri) { "`storageUri` is required but was not set" }, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties.toUnmodifiable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Commit && this.id == other.id && this.authorId == other.authorId && this.dateCreated == other.dateCreated && this.fileSize == other.fileSize && this.message == other.message && this.mlModelId == other.mlModelId && this.validationDatasetId == other.validationDatasetId && this.trainingDatasetId == other.trainingDatasetId && this.storageUri == other.storageUri && this.gitCommitSha == other.gitCommitSha && this.gitCommitRef == other.gitCommitRef && this.gitCommitUrl == other.gitCommitUrl && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(id, authorId, dateCreated, fileSize, message, mlModelId, validationDatasetId, trainingDatasetId, storageUri, gitCommitSha, gitCommitRef, gitCommitUrl, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" - } - - class Status - @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 /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val QUEUED = Status(JsonField.of("queued")) - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PAUSED = Status(JsonField.of("paused")) - - @JvmField val FAILED = Status(JsonField.of("failed")) - - @JvmField val COMPLETED = Status(JsonField.of("completed")) - - @JvmField val UNKNOWN = Status(JsonField.of("unknown")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - } - - enum class Value { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - QUEUED -> Value.QUEUED - RUNNING -> Value.RUNNING - PAUSED -> Value.PAUSED - FAILED -> Value.FAILED - COMPLETED -> Value.COMPLETED - UNKNOWN -> Value.UNKNOWN - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - QUEUED -> Known.QUEUED - RUNNING -> Known.RUNNING - PAUSED -> Known.PAUSED - FAILED -> Known.FAILED - COMPLETED -> Known.COMPLETED - UNKNOWN -> Known.UNKNOWN - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = Links.Builder::class) - @NoAutoDetect - class Links - private constructor( - private val app: String?, - private val additionalProperties: Map, - ) { - - @JsonProperty("app") fun app(): String? = app - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var app: String? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) - } - - @JsonProperty("app") fun app(app: String) = apply { this.app = app } - - 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(): Links = - Links( - checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - } -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitCreateResponse.kt deleted file mode 100644 index da6f58d..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitCreateResponse.kt +++ /dev/null @@ -1,951 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.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.databind.annotation.JsonDeserialize -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ExcludeMissing -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.errors.OpenlayerInvalidDataException -import java.time.OffsetDateTime -import java.util.Objects -import java.util.Optional - -@JsonDeserialize(builder = CommitCreateResponse.Builder::class) -@NoAutoDetect -class CommitCreateResponse -private constructor( - private val id: JsonField, - private val dateCreated: JsonField, - private val status: JsonField, - private val statusMessage: JsonField, - private val projectId: JsonField, - private val storageUri: JsonField, - private val commit: JsonField, - private val deploymentStatus: JsonField, - private val mlModelId: JsonField, - private val validationDatasetId: JsonField, - private val trainingDatasetId: JsonField, - private val archived: JsonField, - private val dateArchived: JsonField, - private val passingGoalCount: JsonField, - private val failingGoalCount: JsonField, - private val totalGoalCount: JsonField, - private val links: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - /** The project version (commit) id. */ - fun id(): String = id.getRequired("id") - - /** The project version (commit) creation date. */ - fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") - - /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. - */ - fun status(): Status = status.getRequired("status") - - /** The commit status message. */ - fun statusMessage(): Optional = - Optional.ofNullable(statusMessage.getNullable("statusMessage")) - - /** The project id. */ - fun projectId(): String = projectId.getRequired("projectId") - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(): String = storageUri.getRequired("storageUri") - - /** The details of a commit (project version). */ - fun commit(): Commit = commit.getRequired("commit") - - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(): Optional = - Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) - - /** The model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - - /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - - /** The training dataset id. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - - /** Whether the commit is archived. */ - fun archived(): Optional = Optional.ofNullable(archived.getNullable("archived")) - - /** The commit archive date. */ - fun dateArchived(): Optional = - Optional.ofNullable(dateArchived.getNullable("dateArchived")) - - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") - - /** The number of tests that are failing for the commit. */ - fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") - - /** The total number of tests for the commit. */ - fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") - - fun links(): Optional = Optional.ofNullable(links.getNullable("links")) - - /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. - */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - /** The commit status message. */ - @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - - /** The project id. */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri - - /** The details of a commit (project version). */ - @JsonProperty("commit") @ExcludeMissing fun _commit() = commit - - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus() = deploymentStatus - - /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun _validationDatasetId() = validationDatasetId - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") @ExcludeMissing fun _trainingDatasetId() = trainingDatasetId - - /** Whether the commit is archived. */ - @JsonProperty("archived") @ExcludeMissing fun _archived() = archived - - /** The commit archive date. */ - @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived - - /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount - - /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount - - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount - - @JsonProperty("links") @ExcludeMissing fun _links() = links - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): CommitCreateResponse = apply { - if (!validated) { - id() - dateCreated() - status() - statusMessage() - projectId() - storageUri() - commit().validate() - deploymentStatus() - mlModelId() - validationDatasetId() - trainingDatasetId() - archived() - dateArchived() - passingGoalCount() - failingGoalCount() - totalGoalCount() - links().map { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var statusMessage: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() - private var commit: JsonField = JsonMissing.of() - private var deploymentStatus: JsonField = JsonMissing.of() - private var mlModelId: JsonField = JsonMissing.of() - private var validationDatasetId: JsonField = JsonMissing.of() - private var trainingDatasetId: JsonField = JsonMissing.of() - private var archived: JsonField = JsonMissing.of() - private var dateArchived: JsonField = JsonMissing.of() - private var passingGoalCount: JsonField = JsonMissing.of() - private var failingGoalCount: JsonField = JsonMissing.of() - private var totalGoalCount: JsonField = JsonMissing.of() - private var links: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commitCreateResponse: CommitCreateResponse) = apply { - this.id = commitCreateResponse.id - this.dateCreated = commitCreateResponse.dateCreated - this.status = commitCreateResponse.status - this.statusMessage = commitCreateResponse.statusMessage - this.projectId = commitCreateResponse.projectId - this.storageUri = commitCreateResponse.storageUri - this.commit = commitCreateResponse.commit - this.deploymentStatus = commitCreateResponse.deploymentStatus - this.mlModelId = commitCreateResponse.mlModelId - this.validationDatasetId = commitCreateResponse.validationDatasetId - this.trainingDatasetId = commitCreateResponse.trainingDatasetId - this.archived = commitCreateResponse.archived - this.dateArchived = commitCreateResponse.dateArchived - this.passingGoalCount = commitCreateResponse.passingGoalCount - this.failingGoalCount = commitCreateResponse.failingGoalCount - this.totalGoalCount = commitCreateResponse.totalGoalCount - this.links = commitCreateResponse.links - additionalProperties(commitCreateResponse.additionalProperties) - } - - /** The project version (commit) id. */ - fun id(id: String) = id(JsonField.of(id)) - - /** The project version (commit) id. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - - /** The project version (commit) creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - - /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } - - /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. - */ - fun status(status: Status) = status(JsonField.of(status)) - - /** - * The commit status. Initially, the commit is `queued`, then, it switches to `running`. - * Finally, it can be `paused`, `failed`, or `completed`. - */ - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } - - /** The commit status message. */ - fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) - - /** The commit status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun statusMessage(statusMessage: JsonField) = apply { - this.statusMessage = statusMessage - } - - /** The project id. */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - - /** The details of a commit (project version). */ - fun commit(commit: Commit) = commit(JsonField.of(commit)) - - /** The details of a commit (project version). */ - @JsonProperty("commit") - @ExcludeMissing - fun commit(commit: JsonField) = apply { this.commit = commit } - - /** The deployment status associated with the commit's model. */ - fun deploymentStatus(deploymentStatus: String) = - deploymentStatus(JsonField.of(deploymentStatus)) - - /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - @ExcludeMissing - fun deploymentStatus(deploymentStatus: JsonField) = apply { - this.deploymentStatus = deploymentStatus - } - - /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) - - /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } - - /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun validationDatasetId(validationDatasetId: JsonField) = apply { - this.validationDatasetId = validationDatasetId - } - - /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun trainingDatasetId(trainingDatasetId: JsonField) = apply { - this.trainingDatasetId = trainingDatasetId - } - - /** Whether the commit is archived. */ - fun archived(archived: Boolean) = archived(JsonField.of(archived)) - - /** Whether the commit is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun archived(archived: JsonField) = apply { this.archived = archived } - - /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) - - /** The commit archive date. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun dateArchived(dateArchived: JsonField) = apply { - this.dateArchived = dateArchived - } - - /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = - passingGoalCount(JsonField.of(passingGoalCount)) - - /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun passingGoalCount(passingGoalCount: JsonField) = apply { - this.passingGoalCount = passingGoalCount - } - - /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = - failingGoalCount(JsonField.of(failingGoalCount)) - - /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun failingGoalCount(failingGoalCount: JsonField) = apply { - this.failingGoalCount = failingGoalCount - } - - /** The total number of tests for the commit. */ - fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) - - /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun totalGoalCount(totalGoalCount: JsonField) = apply { - this.totalGoalCount = totalGoalCount - } - - fun links(links: Links) = links(JsonField.of(links)) - - @JsonProperty("links") - @ExcludeMissing - fun links(links: JsonField) = apply { this.links = links } - - 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(): CommitCreateResponse = - CommitCreateResponse( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties.toUnmodifiable(), - ) - } - - /** The details of a commit (project version). */ - @JsonDeserialize(builder = Commit.Builder::class) - @NoAutoDetect - class Commit - private constructor( - private val id: JsonField, - private val authorId: JsonField, - private val dateCreated: JsonField, - private val fileSize: JsonField, - private val message: JsonField, - private val mlModelId: JsonField, - private val validationDatasetId: JsonField, - private val trainingDatasetId: JsonField, - private val storageUri: JsonField, - private val gitCommitSha: JsonField, - private val gitCommitRef: JsonField, - private val gitCommitUrl: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** The commit id. */ - fun id(): String = id.getRequired("id") - - /** The author id of the commit. */ - fun authorId(): String = authorId.getRequired("authorId") - - /** The commit creation date. */ - fun dateCreated(): Optional = - Optional.ofNullable(dateCreated.getNullable("dateCreated")) - - /** The size of the commit bundle in bytes. */ - fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) - - /** The commit message. */ - fun message(): String = message.getRequired("message") - - /** The model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) - - /** The validation dataset id. */ - fun validationDatasetId(): Optional = - Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) - - /** The training dataset id. */ - fun trainingDatasetId(): Optional = - Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(): String = storageUri.getRequired("storageUri") - - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(): Optional = - Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) - - /** The ref of the corresponding git commit. */ - fun gitCommitRef(): Optional = - Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) - - /** The URL of the corresponding git commit. */ - fun gitCommitUrl(): Optional = - Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) - - /** The commit id. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The author id of the commit. */ - @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId - - /** The commit creation date. */ - @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated - - /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize - - /** The commit message. */ - @JsonProperty("message") @ExcludeMissing fun _message() = message - - /** The model id. */ - @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun _validationDatasetId() = validationDatasetId - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun _trainingDatasetId() = trainingDatasetId - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri - - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha - - /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef - - /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Commit = apply { - if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField = JsonMissing.of() - private var authorId: JsonField = JsonMissing.of() - private var dateCreated: JsonField = JsonMissing.of() - private var fileSize: JsonField = JsonMissing.of() - private var message: JsonField = JsonMissing.of() - private var mlModelId: JsonField = JsonMissing.of() - private var validationDatasetId: JsonField = JsonMissing.of() - private var trainingDatasetId: JsonField = JsonMissing.of() - private var storageUri: JsonField = JsonMissing.of() - private var gitCommitSha: JsonField = JsonMissing.of() - private var gitCommitRef: JsonField = JsonMissing.of() - private var gitCommitUrl: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(commit: Commit) = apply { - this.id = commit.id - this.authorId = commit.authorId - this.dateCreated = commit.dateCreated - this.fileSize = commit.fileSize - this.message = commit.message - this.mlModelId = commit.mlModelId - this.validationDatasetId = commit.validationDatasetId - this.trainingDatasetId = commit.trainingDatasetId - this.storageUri = commit.storageUri - this.gitCommitSha = commit.gitCommitSha - this.gitCommitRef = commit.gitCommitRef - this.gitCommitUrl = commit.gitCommitUrl - additionalProperties(commit.additionalProperties) - } - - /** The commit id. */ - fun id(id: String) = id(JsonField.of(id)) - - /** The commit id. */ - @JsonProperty("id") - @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } - - /** The author id of the commit. */ - fun authorId(authorId: String) = authorId(JsonField.of(authorId)) - - /** The author id of the commit. */ - @JsonProperty("authorId") - @ExcludeMissing - fun authorId(authorId: JsonField) = apply { this.authorId = authorId } - - /** The commit creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) - - /** The commit creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun dateCreated(dateCreated: JsonField) = apply { - this.dateCreated = dateCreated - } - - /** The size of the commit bundle in bytes. */ - fun fileSize(fileSize: Long) = fileSize(JsonField.of(fileSize)) - - /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - @ExcludeMissing - fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } - - /** The commit message. */ - fun message(message: String) = message(JsonField.of(message)) - - /** The commit message. */ - @JsonProperty("message") - @ExcludeMissing - fun message(message: JsonField) = apply { this.message = message } - - /** The model id. */ - fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) - - /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } - - /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = - validationDatasetId(JsonField.of(validationDatasetId)) - - /** The validation dataset id. */ - @JsonProperty("validationDatasetId") - @ExcludeMissing - fun validationDatasetId(validationDatasetId: JsonField) = apply { - this.validationDatasetId = validationDatasetId - } - - /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = - trainingDatasetId(JsonField.of(trainingDatasetId)) - - /** The training dataset id. */ - @JsonProperty("trainingDatasetId") - @ExcludeMissing - fun trainingDatasetId(trainingDatasetId: JsonField) = apply { - this.trainingDatasetId = trainingDatasetId - } - - /** The storage URI where the commit bundle is stored. */ - fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) - - /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } - - /** The SHA of the corresponding git commit. */ - fun gitCommitSha(gitCommitSha: Long) = gitCommitSha(JsonField.of(gitCommitSha)) - - /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - @ExcludeMissing - fun gitCommitSha(gitCommitSha: JsonField) = apply { - this.gitCommitSha = gitCommitSha - } - - /** The ref of the corresponding git commit. */ - fun gitCommitRef(gitCommitRef: String) = gitCommitRef(JsonField.of(gitCommitRef)) - - /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - @ExcludeMissing - fun gitCommitRef(gitCommitRef: JsonField) = apply { - this.gitCommitRef = gitCommitRef - } - - /** The URL of the corresponding git commit. */ - fun gitCommitUrl(gitCommitUrl: String) = gitCommitUrl(JsonField.of(gitCommitUrl)) - - /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - @ExcludeMissing - fun gitCommitUrl(gitCommitUrl: JsonField) = apply { - this.gitCommitUrl = gitCommitUrl - } - - 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(): Commit = - Commit( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties.toUnmodifiable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Commit && this.id == other.id && this.authorId == other.authorId && this.dateCreated == other.dateCreated && this.fileSize == other.fileSize && this.message == other.message && this.mlModelId == other.mlModelId && this.validationDatasetId == other.validationDatasetId && this.trainingDatasetId == other.trainingDatasetId && this.storageUri == other.storageUri && this.gitCommitSha == other.gitCommitSha && this.gitCommitRef == other.gitCommitRef && this.gitCommitUrl == other.gitCommitUrl && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(id, authorId, dateCreated, fileSize, message, mlModelId, validationDatasetId, trainingDatasetId, storageUri, gitCommitSha, gitCommitRef, gitCommitUrl, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" - } - - class Status - @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 /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val QUEUED = Status(JsonField.of("queued")) - - @JvmField val RUNNING = Status(JsonField.of("running")) - - @JvmField val PAUSED = Status(JsonField.of("paused")) - - @JvmField val FAILED = Status(JsonField.of("failed")) - - @JvmField val COMPLETED = Status(JsonField.of("completed")) - - @JvmField val UNKNOWN = Status(JsonField.of("unknown")) - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - enum class Known { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - } - - enum class Value { - QUEUED, - RUNNING, - PAUSED, - FAILED, - COMPLETED, - UNKNOWN, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - QUEUED -> Value.QUEUED - RUNNING -> Value.RUNNING - PAUSED -> Value.PAUSED - FAILED -> Value.FAILED - COMPLETED -> Value.COMPLETED - UNKNOWN -> Value.UNKNOWN - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - QUEUED -> Known.QUEUED - RUNNING -> Known.RUNNING - PAUSED -> Known.PAUSED - FAILED -> Known.FAILED - COMPLETED -> Known.COMPLETED - UNKNOWN -> Known.UNKNOWN - else -> throw OpenlayerInvalidDataException("Unknown Status: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = Links.Builder::class) - @NoAutoDetect - class Links - private constructor( - private val app: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - fun app(): String = app.getRequired("app") - - @JsonProperty("app") @ExcludeMissing fun _app() = app - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Links = apply { - if (!validated) { - app() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var app: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(links: Links) = apply { - this.app = links.app - additionalProperties(links.additionalProperties) - } - - fun app(app: String) = app(JsonField.of(app)) - - @JsonProperty("app") - @ExcludeMissing - fun app(app: JsonField) = apply { this.app = app } - - 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(): Links = Links(app, additionalProperties.toUnmodifiable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CommitCreateResponse && this.id == other.id && this.dateCreated == other.dateCreated && this.status == other.status && this.statusMessage == other.statusMessage && this.projectId == other.projectId && this.storageUri == other.storageUri && this.commit == other.commit && this.deploymentStatus == other.deploymentStatus && this.mlModelId == other.mlModelId && this.validationDatasetId == other.validationDatasetId && this.trainingDatasetId == other.trainingDatasetId && this.archived == other.archived && this.dateArchived == other.dateArchived && this.passingGoalCount == other.passingGoalCount && this.failingGoalCount == other.failingGoalCount && this.totalGoalCount == other.totalGoalCount && this.links == other.links && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(id, dateCreated, status, statusMessage, projectId, storageUri, commit, deploymentStatus, mlModelId, validationDatasetId, trainingDatasetId, archived, dateArchived, passingGoalCount, failingGoalCount, totalGoalCount, links, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "CommitCreateResponse{id=$id, dateCreated=$dateCreated, status=$status, statusMessage=$statusMessage, projectId=$projectId, storageUri=$storageUri, commit=$commit, deploymentStatus=$deploymentStatus, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, archived=$archived, dateArchived=$dateArchived, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, links=$links, additionalProperties=$additionalProperties}" -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index 5793eed..ff85530 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -7,7 +7,7 @@ import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.util.Objects @@ -46,7 +46,7 @@ constructor( this.status?.let { params.put("status", listOf(it.toString())) } this.type?.let { params.put("type", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -183,8 +183,8 @@ constructor( perPage, status, type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt index 7e29a80..be9a40d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -22,7 +22,7 @@ import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -93,8 +93,8 @@ private constructor( fun build(): CommitTestResultListResponse = CommitTestResultListResponse( - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable() + items.map { it.toImmutable() }, + additionalProperties.toImmutable() ) } @@ -379,7 +379,7 @@ private constructor( dateDataEnds, status, statusMessage, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -969,7 +969,7 @@ private constructor( subtype, creatorId, originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, + thresholds.map { it.toImmutable() }, archived, dateArchived, suggested, @@ -979,7 +979,7 @@ private constructor( usesTrainingDataset, usesReferenceDataset, usesProductionData, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -1136,10 +1136,10 @@ private constructor( Threshold( measurement, insightName, - insightParameters.map { it.toUnmodifiable() }, + insightParameters.map { it.toImmutable() }, operator, value, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt index 3952fdb..dd8d2c9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -20,7 +20,7 @@ import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.util.Objects @@ -127,8 +127,8 @@ constructor( fun build(): InferencePipelineDataStreamBody = InferencePipelineDataStreamBody( checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), - additionalProperties.toUnmodifiable(), + checkNotNull(rows) { "`rows` is required but was not set" }.toImmutable(), + additionalProperties.toImmutable(), ) } @@ -296,10 +296,10 @@ constructor( "`inferencePipelineId` is required but was not set" }, checkNotNull(config) { "`config` is required but was not set" }, - checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + checkNotNull(rows) { "`rows` is required but was not set" }.toImmutable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } @@ -863,14 +863,14 @@ constructor( costColumnName, groundTruthColumnName, inferenceIdColumnName, - inputVariableNames.map { it.toUnmodifiable() }, + inputVariableNames.map { it.toImmutable() }, latencyColumnName, metadata, outputColumnName, - prompt.map { it.toUnmodifiable() }, + prompt.map { it.toImmutable() }, questionColumnName, timestampColumnName, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -965,7 +965,7 @@ constructor( Prompt( role, content, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -1361,9 +1361,9 @@ constructor( fun build(): TabularClassificationData = TabularClassificationData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - classNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, + categoricalFeatureNames.map { it.toImmutable() }, + classNames.map { it.toImmutable() }, + featureNames.map { it.toImmutable() }, inferenceIdColumnName, labelColumnName, latencyColumnName, @@ -1371,7 +1371,7 @@ constructor( predictionsColumnName, predictionScoresColumnName, timestampColumnName, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -1664,15 +1664,15 @@ constructor( fun build(): TabularRegressionData = TabularRegressionData( - categoricalFeatureNames.map { it.toUnmodifiable() }, - featureNames.map { it.toUnmodifiable() }, + categoricalFeatureNames.map { it.toImmutable() }, + featureNames.map { it.toImmutable() }, inferenceIdColumnName, latencyColumnName, metadata, predictionsColumnName, targetColumnName, timestampColumnName, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -2010,7 +2010,7 @@ constructor( fun build(): TextClassificationData = TextClassificationData( - classNames.map { it.toUnmodifiable() }, + classNames.map { it.toImmutable() }, inferenceIdColumnName, labelColumnName, latencyColumnName, @@ -2019,7 +2019,7 @@ constructor( predictionScoresColumnName, textColumnName, timestampColumnName, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -2084,7 +2084,7 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Row = Row(additionalProperties.toUnmodifiable()) + fun build(): Row = Row(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index b4f29a7..3d53c52 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects @@ -83,7 +83,7 @@ private constructor( } fun build(): InferencePipelineDataStreamResponse = - InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) + InferencePipelineDataStreamResponse(success, additionalProperties.toImmutable()) } class Success diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index 2e356e4..7aecc8f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -4,7 +4,7 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects import java.util.Optional @@ -142,9 +142,9 @@ constructor( checkNotNull(inferencePipelineId) { "`inferencePipelineId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index 95a5267..df34f15 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -3,7 +3,7 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects @@ -117,8 +117,8 @@ constructor( checkNotNull(inferencePipelineId) { "`inferencePipelineId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 0677e27..a500b3a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -383,7 +383,7 @@ private constructor( status, statusMessage, links, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -450,7 +450,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index e4d034d..0a29a72 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects import java.util.Optional @@ -47,7 +47,7 @@ constructor( val params = mutableMapOf>() this.inferenceId.let { params.put("inferenceId", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -119,7 +119,7 @@ constructor( InferencePipelineRowUpdateBody( checkNotNull(row) { "`row` is required but was not set" }, config, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -268,9 +268,9 @@ constructor( checkNotNull(inferenceId) { "`inferenceId` is required but was not set" }, checkNotNull(row) { "`row` is required but was not set" }, config, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } @@ -398,7 +398,7 @@ constructor( timestampColumnName, groundTruthColumnName, humanFeedbackColumnName, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index eda7f6f..595d237 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.util.Objects @@ -82,7 +82,7 @@ private constructor( } fun build(): InferencePipelineRowUpdateResponse = - InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) + InferencePipelineRowUpdateResponse(success, additionalProperties.toImmutable()) } class Success diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt index 3837451..82a6a55 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -7,7 +7,7 @@ import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.util.Objects @@ -42,7 +42,7 @@ constructor( this.status?.let { params.put("status", listOf(it.toString())) } this.type?.let { params.put("type", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -175,8 +175,8 @@ constructor( perPage, status, type, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt index 265bb2a..0078c11 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -22,7 +22,7 @@ import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -95,8 +95,8 @@ private constructor( fun build(): InferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse( - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable() + items.map { it.toImmutable() }, + additionalProperties.toImmutable() ) } @@ -381,7 +381,7 @@ private constructor( dateDataEnds, status, statusMessage, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -971,7 +971,7 @@ private constructor( subtype, creatorId, originProjectVersionId, - thresholds.map { it.toUnmodifiable() }, + thresholds.map { it.toImmutable() }, archived, dateArchived, suggested, @@ -981,7 +981,7 @@ private constructor( usesTrainingDataset, usesReferenceDataset, usesProductionData, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -1138,10 +1138,10 @@ private constructor( Threshold( measurement, insightName, - insightParameters.map { it.toUnmodifiable() }, + insightParameters.map { it.toImmutable() }, operator, value, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index 057aecc..4f4f8a7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects import java.util.Optional @@ -138,7 +138,7 @@ constructor( description, name, referenceDatasetUri, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -293,9 +293,9 @@ constructor( description, name, referenceDatasetUri, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index 6466e7a..f5cdb6c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -382,7 +382,7 @@ private constructor( status, statusMessage, links, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -449,7 +449,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt index 9e4edc1..8bc883e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateParams.kt @@ -12,7 +12,7 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.time.OffsetDateTime @@ -151,7 +151,7 @@ constructor( checkNotNull(storageUri) { "`storageUri` is required but was not set" }, archived, deploymentStatus, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -305,9 +305,9 @@ constructor( checkNotNull(storageUri) { "`storageUri` is required but was not set" }, archived, deploymentStatus, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } @@ -490,7 +490,7 @@ constructor( gitCommitSha, gitCommitRef, gitCommitUrl, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -647,7 +647,7 @@ constructor( fun build(): Links = Links( checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() + additionalProperties.toImmutable() ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt index e7cd957..2e8ac57 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitCreateResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -429,7 +429,7 @@ private constructor( failingGoalCount, totalGoalCount, links, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -737,7 +737,7 @@ private constructor( gitCommitSha, gitCommitRef, gitCommitUrl, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -906,7 +906,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt index dc36aea..054d9e8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -3,7 +3,7 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects import java.util.Optional @@ -29,7 +29,7 @@ constructor( this.page?.let { params.put("page", listOf(it.toString())) } this.perPage?.let { params.put("perPage", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -138,8 +138,8 @@ constructor( checkNotNull(projectId) { "`projectId` is required but was not set" }, page, perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt index 5e392c9..8d5edb0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -84,8 +84,8 @@ private constructor( fun build(): ProjectCommitListResponse = ProjectCommitListResponse( - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable() + items.map { it.toImmutable() }, + additionalProperties.toImmutable() ) } @@ -504,7 +504,7 @@ private constructor( failingGoalCount, totalGoalCount, links, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -817,7 +817,7 @@ private constructor( gitCommitSha, gitCommitRef, gitCommitUrl, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -987,7 +987,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index 6a2ba28..dc5fa27 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -12,7 +12,7 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.time.OffsetDateTime @@ -124,7 +124,7 @@ constructor( checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(taskType) { "`taskType` is required but was not set" }, description, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -265,9 +265,9 @@ constructor( checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(taskType) { "`taskType` is required but was not set" }, description, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } @@ -323,7 +323,7 @@ constructor( fun build(): Links = Links( checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() + additionalProperties.toImmutable() ) } @@ -625,7 +625,7 @@ constructor( rootDir, checkNotNull(projectId) { "`projectId` is required but was not set" }, checkNotNull(gitAccountId) { "`gitAccountId` is required but was not set" }, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index eeb5d25..1f4629e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -390,7 +390,7 @@ private constructor( monitoringGoalCount, links, gitRepo, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -458,7 +458,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -851,7 +851,7 @@ private constructor( rootDir, projectId, gitAccountId, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt index 7d962c4..bcb0647 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -12,7 +12,7 @@ import com.openlayer.api.core.ExcludeMissing import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.util.Objects @@ -120,7 +120,7 @@ constructor( ProjectInferencePipelineCreateBody( description, checkNotNull(name) { "`name` is required but was not set" }, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -262,9 +262,9 @@ constructor( checkNotNull(projectId) { "`projectId` is required but was not set" }, description, checkNotNull(name) { "`name` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } @@ -319,7 +319,7 @@ constructor( fun build(): Links = Links( checkNotNull(app) { "`app` is required but was not set" }, - additionalProperties.toUnmodifiable() + additionalProperties.toImmutable() ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt index e403e3c..55d61de 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -384,7 +384,7 @@ private constructor( status, statusMessage, links, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -451,7 +451,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt index 1065d80..11a6f61 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -3,7 +3,7 @@ package com.openlayer.api.models import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects import java.util.Optional @@ -33,7 +33,7 @@ constructor( this.page?.let { params.put("page", listOf(it.toString())) } this.perPage?.let { params.put("perPage", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -149,8 +149,8 @@ constructor( name, page, perPage, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt index 5f8335c..7198d6b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -86,8 +86,8 @@ private constructor( fun build(): ProjectInferencePipelineListResponse = ProjectInferencePipelineListResponse( - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable() + items.map { it.toImmutable() }, + additionalProperties.toImmutable() ) } @@ -459,7 +459,7 @@ private constructor( status, statusMessage, links, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -527,7 +527,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index 157c7ec..f4ee878 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -7,7 +7,7 @@ import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import java.util.Objects @@ -39,7 +39,7 @@ constructor( this.perPage?.let { params.put("perPage", listOf(it.toString())) } this.taskType?.let { params.put("taskType", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -148,8 +148,8 @@ constructor( page, perPage, taskType, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index 11876d4..51765d9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -13,7 +13,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.errors.OpenlayerInvalidDataException import java.time.OffsetDateTime import java.util.Objects @@ -83,10 +83,7 @@ private constructor( } fun build(): ProjectListResponse = - ProjectListResponse( - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable() - ) + ProjectListResponse(items.map { it.toImmutable() }, additionalProperties.toImmutable()) } @JsonDeserialize(builder = Item.Builder::class) @@ -468,7 +465,7 @@ private constructor( monitoringGoalCount, links, gitRepo, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } @@ -537,7 +534,7 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) + fun build(): Links = Links(app, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -933,7 +930,7 @@ private constructor( rootDir, projectId, gitAccountId, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index 4f61d0d..0e38f68 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -4,7 +4,7 @@ package com.openlayer.api.models import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import com.openlayer.api.models.* import java.util.Objects import java.util.Optional @@ -29,7 +29,7 @@ constructor( val params = mutableMapOf>() this.objectName.let { params.put("objectName", listOf(it.toString())) } params.putAll(additionalQueryParams) - return params.toUnmodifiable() + return params.toImmutable() } @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @@ -139,9 +139,9 @@ constructor( fun build(): StoragePresignedUrlCreateParams = StoragePresignedUrlCreateParams( checkNotNull(objectName) { "`objectName` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), + additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalBodyProperties.toImmutable(), ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt index 41a88e7..9806bbe 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -11,7 +11,7 @@ import com.openlayer.api.core.JsonField import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.core.toImmutable import java.util.Objects @JsonDeserialize(builder = StoragePresignedUrlCreateResponse.Builder::class) @@ -116,7 +116,7 @@ private constructor( url, fields, storageUri, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt deleted file mode 100644 index 4d849f4..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt +++ /dev/null @@ -1,121 +0,0 @@ -@file:JvmName("Handlers") - -package com.openlayer.api.services - -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.core.http.HttpResponse -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.BadRequestException -import com.openlayer.api.errors.InternalServerException -import com.openlayer.api.errors.NotFoundException -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerException -import com.openlayer.api.errors.PermissionDeniedException -import com.openlayer.api.errors.RateLimitException -import com.openlayer.api.errors.UnauthorizedException -import com.openlayer.api.errors.UnexpectedStatusCodeException -import com.openlayer.api.errors.UnprocessableEntityException -import java.io.InputStream -import java.io.OutputStream -import java.util.Optional - -@JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandler - -private object EmptyHandler : Handler { - override fun handle(response: HttpResponse): Void? = null -} - -@JvmSynthetic internal fun stringHandler(): Handler = StringHandler - -@JvmSynthetic internal fun binaryHandler(): Handler = BinaryHandler - -private object StringHandler : Handler { - override fun handle(response: HttpResponse): String { - return response.body().readBytes().toString(Charsets.UTF_8) - } -} - -private object BinaryHandler : Handler { - override fun handle(response: HttpResponse): BinaryResponseContent { - return object : BinaryResponseContent { - override fun contentType(): Optional = - Optional.ofNullable(response.headers().get("Content-Type").firstOrNull()) - - override fun body(): InputStream = response.body() - - override fun close() = response.close() - - override fun writeTo(outputStream: OutputStream) { - response.body().copyTo(outputStream) - } - } - } -} - -@JvmSynthetic -internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler { - return object : Handler { - override fun handle(response: HttpResponse): T { - try { - return jsonMapper.readValue(response.body(), jacksonTypeRef()) - } catch (e: Exception) { - throw OpenlayerException("Error reading response", e) - } - } - } -} - -@JvmSynthetic -internal fun errorHandler(jsonMapper: JsonMapper): Handler { - val handler = jsonHandler(jsonMapper) - - return object : Handler { - override fun handle(response: HttpResponse): OpenlayerError { - try { - return handler.handle(response) - } catch (e: Exception) { - return OpenlayerError.builder().build() - } - } - } -} - -@JvmSynthetic -internal fun Handler.withErrorHandler(errorHandler: Handler): Handler { - return object : Handler { - override fun handle(response: HttpResponse): T { - when (val statusCode = response.statusCode()) { - in 200..299 -> return this@withErrorHandler.handle(response) - 400 -> throw BadRequestException(response.headers(), errorHandler.handle(response)) - 401 -> - throw UnauthorizedException(response.headers(), errorHandler.handle(response)) - 403 -> - throw PermissionDeniedException( - response.headers(), - errorHandler.handle(response) - ) - 404 -> throw NotFoundException(response.headers(), errorHandler.handle(response)) - 422 -> - throw UnprocessableEntityException( - response.headers(), - errorHandler.handle(response) - ) - 429 -> throw RateLimitException(response.headers(), errorHandler.handle(response)) - in 500..599 -> - throw InternalServerException( - statusCode, - response.headers(), - errorHandler.handle(response) - ) - else -> - throw UnexpectedStatusCodeException( - statusCode, - response.headers(), - StringHandler.handle(response) - ) - } - } - } -} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/HttpRequestBodies.kt deleted file mode 100644 index 3e8a1c1..0000000 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/HttpRequestBodies.kt +++ /dev/null @@ -1,114 +0,0 @@ -@file:JvmName("HttpRequestBodies") - -package com.openlayer.api.services - -import com.fasterxml.jackson.databind.json.JsonMapper -import com.openlayer.api.core.Enum -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.http.HttpRequestBody -import com.openlayer.api.errors.OpenlayerException -import java.io.ByteArrayOutputStream -import java.io.OutputStream -import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder - -@JvmSynthetic -internal inline fun json( - jsonMapper: JsonMapper, - value: T, -): HttpRequestBody { - return object : HttpRequestBody { - private var cachedBytes: ByteArray? = null - - private fun serialize(): ByteArray { - if (cachedBytes != null) return cachedBytes!! - - val buffer = ByteArrayOutputStream() - try { - jsonMapper.writeValue(buffer, value) - cachedBytes = buffer.toByteArray() - return cachedBytes!! - } catch (e: Exception) { - throw OpenlayerException("Error writing request", e) - } - } - - override fun writeTo(outputStream: OutputStream) { - outputStream.write(serialize()) - } - - override fun contentType(): String = "application/json" - - override fun contentLength(): Long { - return serialize().size.toLong() - } - - override fun repeatable(): Boolean = true - - override fun close() {} - } -} - -@JvmSynthetic -internal fun multipartFormData( - jsonMapper: JsonMapper, - parts: Array?> -): HttpRequestBody { - val builder = MultipartEntityBuilder.create() - parts.forEach { part -> - if (part?.value != null) { - when (part.value) { - is JsonValue -> { - val buffer = ByteArrayOutputStream() - try { - jsonMapper.writeValue(buffer, part.value) - } catch (e: Exception) { - throw OpenlayerException("Error serializing value to json", e) - } - builder.addBinaryBody( - part.name, - buffer.toByteArray(), - part.contentType, - part.filename - ) - } - is Boolean -> - builder.addTextBody( - part.name, - if (part.value) "true" else "false", - part.contentType - ) - is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is Double -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is ByteArray -> - builder.addBinaryBody(part.name, part.value, part.contentType, part.filename) - is String -> builder.addTextBody(part.name, part.value, part.contentType) - is Enum -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - else -> - throw IllegalArgumentException( - "Unsupported content type: ${part.value::class.java.simpleName}" - ) - } - } - } - val entity = builder.build() - - return object : HttpRequestBody { - override fun writeTo(outputStream: OutputStream) { - try { - return entity.writeTo(outputStream) - } catch (e: Exception) { - throw OpenlayerException("Error writing request", e) - } - } - - override fun contentType(): String = entity.contentType - - override fun contentLength(): Long = -1 - - override fun repeatable(): Boolean = entity.isRepeatable - - override fun close() = entity.close() - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt index a2f9465..1acef18 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt @@ -92,7 +92,7 @@ internal class SerializerTest { fun build(): ClassWithBooleanFieldPrefixedWithIs = ClassWithBooleanFieldPrefixedWithIs( isActive, - additionalProperties.toUnmodifiable(), + additionalProperties.toImmutable(), ) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitCreateParamsTest.kt deleted file mode 100644 index 6386c58..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitCreateParamsTest.kt +++ /dev/null @@ -1,137 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import com.openlayer.api.models.* -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class CommitCreateParamsTest { - - @Test - fun createCommitCreateParams() { - CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .commit( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(123L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .storageUri("s3://...") - .archived(true) - .deploymentStatus("Deployed") - .build() - } - - @Test - fun getBody() { - val params = - CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .commit( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(123L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .storageUri("s3://...") - .archived(true) - .deploymentStatus("Deployed") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.commit()) - .isEqualTo( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(123L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - assertThat(body.storageUri()).isEqualTo("s3://...") - assertThat(body.archived()).isEqualTo(true) - assertThat(body.deploymentStatus()).isEqualTo("Deployed") - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = - CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .commit( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .message("Updated the prompt.") - .storageUri("s3://...") - .build() - ) - .storageUri("s3://...") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.commit()) - .isEqualTo( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .message("Updated the prompt.") - .storageUri("s3://...") - .build() - ) - assertThat(body.storageUri()).isEqualTo("s3://...") - } - - @Test - fun getPathParam() { - val params = - CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .commit( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .message("Updated the prompt.") - .storageUri("s3://...") - .build() - ) - .storageUri("s3://...") - .build() - assertThat(params).isNotNull - // path param "projectId" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitCreateResponseTest.kt deleted file mode 100644 index 279da2a..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitCreateResponseTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.models - -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class CommitCreateResponseTest { - - @Test - fun createCommitCreateResponse() { - val commitCreateResponse = - CommitCreateResponse.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .commit( - CommitCreateResponse.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(123L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(CommitCreateResponse.Status.QUEUED) - .statusMessage("Commit successfully processed.") - .storageUri("s3://...") - .totalGoalCount(123L) - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .archived(true) - .deploymentStatus("Deployed") - .links( - CommitCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .build() - assertThat(commitCreateResponse).isNotNull - assertThat(commitCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitCreateResponse.commit()) - .isEqualTo( - CommitCreateResponse.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(123L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - assertThat(commitCreateResponse.dateArchived()) - .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(commitCreateResponse.dateCreated()) - .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(commitCreateResponse.failingGoalCount()).isEqualTo(123L) - assertThat(commitCreateResponse.mlModelId()) - .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitCreateResponse.passingGoalCount()).isEqualTo(123L) - assertThat(commitCreateResponse.projectId()) - .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitCreateResponse.status()).isEqualTo(CommitCreateResponse.Status.QUEUED) - assertThat(commitCreateResponse.statusMessage()).contains("Commit successfully processed.") - assertThat(commitCreateResponse.storageUri()).isEqualTo("s3://...") - assertThat(commitCreateResponse.totalGoalCount()).isEqualTo(123L) - assertThat(commitCreateResponse.trainingDatasetId()) - .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitCreateResponse.validationDatasetId()) - .contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(commitCreateResponse.archived()).contains(true) - assertThat(commitCreateResponse.deploymentStatus()).contains("Deployed") - assertThat(commitCreateResponse.links()) - .contains( - CommitCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt deleted file mode 100644 index 13c6f05..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt +++ /dev/null @@ -1,51 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.services.blocking - -import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.models.* -import java.time.OffsetDateTime -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -class CommitServiceTest { - - @Test - fun callCreate() { - val client = - OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val commitService = client.commits() - val commitCreateResponse = - commitService.create( - CommitCreateParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .commit( - CommitCreateParams.Commit.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .authorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .fileSize(123L) - .message("Updated the prompt.") - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .storageUri("s3://...") - .trainingDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .validationDatasetId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .gitCommitRef("main") - .gitCommitSha(123L) - .gitCommitUrl("gitCommitUrl") - .build() - ) - .storageUri("s3://...") - .archived(true) - .deploymentStatus("Deployed") - .build() - ) - println(commitCreateResponse) - commitCreateResponse.validate() - } -} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt deleted file mode 100644 index 5c66b4e..0000000 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt +++ /dev/null @@ -1,9 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.openlayer.api.services.blocking - -import com.openlayer.api.TestServerExtension -import com.openlayer.api.models.* -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) class StorageServiceTest