From ae9ef60dfe9795d611e174b81cf66823b265e4af Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Sun, 7 Jul 2024 02:52:05 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- .stats.yml | 2 +- README.md | 34 +- .../api/models/CommitTestResultListParams.kt | 379 +++ .../models/CommitTestResultListResponse.kt | 1664 ++++++++++++ .../InferencePipelineDataStreamParams.kt | 2240 +++++++++++++++++ .../InferencePipelineDataStreamResponse.kt | 161 ++ .../InferencePipelineTestResultListParams.kt | 369 +++ ...InferencePipelineTestResultListResponse.kt | 1666 ++++++++++++ .../api/models/ProjectCommitListParams.kt | 179 ++ .../api/models/ProjectCommitListResponse.kt | 1308 ++++++++++ .../ProjectInferencePipelineCreateParams.kt | 449 ++++ .../ProjectInferencePipelineCreateResponse.kt | 613 +++++ .../ProjectInferencePipelineListParams.kt | 194 ++ .../ProjectInferencePipelineListResponse.kt | 897 +++++++ .../async/commits/TestResultServiceAsync.kt | 15 +- .../commits/TestResultServiceAsyncImpl.kt | 38 + .../inferencePipelines/DataServiceAsync.kt | 15 +- .../DataServiceAsyncImpl.kt | 40 + .../TestResultServiceAsync.kt | 15 +- .../TestResultServiceAsyncImpl.kt | 38 + .../async/projects/CommitServiceAsync.kt | 15 +- .../async/projects/CommitServiceAsyncImpl.kt | 38 + .../projects/InferencePipelineServiceAsync.kt | 24 +- .../InferencePipelineServiceAsyncImpl.kt | 72 + .../blocking/commits/TestResultService.kt | 14 +- .../blocking/commits/TestResultServiceImpl.kt | 36 + .../inferencePipelines/DataService.kt | 14 +- .../inferencePipelines/DataServiceImpl.kt | 38 + .../inferencePipelines/TestResultService.kt | 14 +- .../TestResultServiceImpl.kt | 36 + .../blocking/projects/CommitService.kt | 14 +- .../blocking/projects/CommitServiceImpl.kt | 36 + .../projects/InferencePipelineService.kt | 23 +- .../projects/InferencePipelineServiceImpl.kt | 69 + .../models/CommitTestResultListParamsTest.kt | 65 + .../CommitTestResultListResponseTest.kt | 161 ++ .../InferencePipelineDataStreamParamsTest.kt | 158 ++ ...InferencePipelineDataStreamResponseTest.kt | 20 + ...ferencePipelineTestResultListParamsTest.kt | 68 + ...rencePipelineTestResultListResponseTest.kt | 167 ++ .../api/models/ProjectCommitListParamsTest.kt | 56 + .../models/ProjectCommitListResponseTest.kt | 124 + ...rojectInferencePipelineCreateParamsTest.kt | 59 + ...jectInferencePipelineCreateResponseTest.kt | 71 + .../ProjectInferencePipelineListParamsTest.kt | 59 + ...rojectInferencePipelineListResponseTest.kt | 92 + .../api/services/ErrorHandlingTest.kt | 597 +++-- .../api/services/ServiceParamsTest.kt | 92 +- .../blocking/commits/TestResultServiceTest.kt | 29 +- .../inferencePipelines/DataServiceTest.kt | 52 +- .../TestResultServiceTest.kt | 28 +- .../blocking/projects/CommitServiceTest.kt | 26 +- .../projects/InferencePipelineServiceTest.kt | 47 +- 53 files changed, 12375 insertions(+), 355 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt diff --git a/.stats.yml b/.stats.yml index fcbfe48..699660e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 2 +configured_endpoints: 8 diff --git a/README.md b/README.md index 6885a35..4a4d0de 100644 --- a/README.md +++ b/README.md @@ -68,15 +68,25 @@ Read the documentation for more configuration options. ### Example: creating a resource -To create a new project, first use the `ProjectCreateParams` builder to specify attributes, -then pass that to the `create` method of the `projects` service. +To create a new inference pipeline data, first use the `InferencePipelineDataStreamParams` builder to specify attributes, +then pass that to the `stream` method of the `data` service. ```java -import com.openlayer.api.models.ProjectCreateParams; -import com.openlayer.api.models.ProjectCreateResponse; - -ProjectCreateParams params = ProjectCreateParams.builder().build(); -ProjectCreateResponse projectCreateResponse = client.projects().create(params); +import com.openlayer.api.models.InferencePipelineDataStreamParams; +import com.openlayer.api.models.InferencePipelineDataStreamResponse; +import java.util.List; + +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() + .rows(List.of(InferencePipelineDataStreamParams.Row.builder().build())) + .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .costColumnName("cost") + .inputVariableNames(List.of("user_query")) + .numOfTokenColumnName("tokens") + .timestampColumnName("timestamp") + .build())) + .build(); +InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream(params); ``` --- @@ -87,14 +97,14 @@ ProjectCreateResponse projectCreateResponse = client.projects().create(params); To make a request to the Openlayer API, you generally build an instance of the appropriate `Params` class. -In [Example: creating a resource](#example-creating-a-resource) above, we used the `ProjectCreateParams.builder()` to pass to -the `create` method of the `projects` service. +In [Example: creating a resource](#example-creating-a-resource) above, we used the `InferencePipelineDataStreamParams.builder()` to pass to +the `stream` method of the `data` service. Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using the `putAdditionalProperty` method. ```java -ProjectCreateParams params = ProjectCreateParams.builder() +InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() // ... normal properties .putAdditionalProperty("secret_param", "4242") .build(); @@ -107,7 +117,7 @@ ProjectCreateParams params = ProjectCreateParams.builder() When receiving a response, the Openlayer Java SDK will deserialize it into instances of the typed model classes. In rare cases, the API may return a response property that doesn't match the expected Java type. If you directly access the mistaken property, the SDK will throw an unchecked `OpenlayerInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model. ```java -ProjectCreateResponse projectCreateResponse = client.projects().create().validate(); +InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream().validate(); ``` ### Response properties as JSON @@ -137,7 +147,7 @@ if (field.isMissing()) { Sometimes, the server response may include additional properties that are not yet available in this library's types. You can access them using the model's `_additionalProperties` method: ```java -JsonValue secret = projectCreateResponse._additionalProperties().get("secret_field"); +JsonValue secret = inferencePipelineDataStreamResponse._additionalProperties().get("secret_field"); ``` --- 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 new file mode 100644 index 0000000..6b1c3e4 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -0,0 +1,379 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +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.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class CommitTestResultListParams +constructor( + private val projectVersionId: String, + private val includeArchived: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectVersionId(): String = projectVersionId + + fun includeArchived(): Optional = Optional.ofNullable(includeArchived) + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + fun status(): Optional = Optional.ofNullable(status) + + fun type(): Optional = Optional.ofNullable(type) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.includeArchived?.let { params.put("includeArchived", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.status?.let { params.put("status", listOf(it.toString())) } + this.type?.let { params.put("type", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectVersionId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CommitTestResultListParams && + this.projectVersionId == other.projectVersionId && + this.includeArchived == other.includeArchived && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectVersionId, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "CommitTestResultListParams{projectVersionId=$projectVersionId, includeArchived=$includeArchived, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var projectVersionId: String? = null + private var includeArchived: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var status: Status? = null + private var type: Type? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(commitTestResultListParams: CommitTestResultListParams) = apply { + this.projectVersionId = commitTestResultListParams.projectVersionId + this.includeArchived = commitTestResultListParams.includeArchived + this.page = commitTestResultListParams.page + this.perPage = commitTestResultListParams.perPage + this.status = commitTestResultListParams.status + this.type = commitTestResultListParams.type + additionalQueryParams(commitTestResultListParams.additionalQueryParams) + additionalHeaders(commitTestResultListParams.additionalHeaders) + additionalBodyProperties(commitTestResultListParams.additionalBodyProperties) + } + + fun projectVersionId(projectVersionId: String) = apply { + this.projectVersionId = projectVersionId + } + + /** Include archived goals. */ + fun includeArchived(includeArchived: Boolean) = apply { + this.includeArchived = includeArchived + } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ + fun status(status: Status) = apply { this.status = status } + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type) = apply { this.type = type } + + 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(): CommitTestResultListParams = + CommitTestResultListParams( + checkNotNull(projectVersionId) { "`projectVersionId` is required but was not set" }, + includeArchived, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + 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 other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val INTEGRITY = Type(JsonField.of("integrity")) + + @JvmField val CONSISTENCY = Type(JsonField.of("consistency")) + + @JvmField val PERFORMANCE = Type(JsonField.of("performance")) + + @JvmField val FAIRNESS = Type(JsonField.of("fairness")) + + @JvmField val ROBUSTNESS = Type(JsonField.of("robustness")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + } + + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + FAIRNESS -> Known.FAIRNESS + ROBUSTNESS -> Known.ROBUSTNESS + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..731f3b5 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -0,0 +1,1664 @@ +// 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.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +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.getOrThrow +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 = CommitTestResultListResponse.Builder::class) +@NoAutoDetect +class CommitTestResultListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): CommitTestResultListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CommitTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(commitTestResultListResponse: CommitTestResultListResponse) = apply { + this._meta = commitTestResultListResponse._meta + this.items = commitTestResultListResponse.items + additionalProperties(commitTestResultListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): CommitTestResultListResponse = + CommitTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + private constructor( + private val id: JsonField, + private val goal: JsonField, + private val goalId: JsonField, + private val projectVersionId: JsonField, + private val inferencePipelineId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val dateDataStarts: JsonField, + private val dateDataEnds: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Project version (commit) id. */ + fun id(): String = id.getRequired("id") + + fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) + + /** The test id. */ + fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) + + /** The project version (commit) id. */ + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + + /** The inference pipeline id. */ + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The data start date. */ + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + + /** The data end date. */ + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + + /** The status of the test. */ + fun status(): Status = status.getRequired("status") + + /** The status message. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + /** Project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + + /** The test id. */ + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun _inferencePipelineId() = inferencePipelineId + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The data start date. */ + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + + /** The data end date. */ + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + + /** The status of the test. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Item{id=$id, goal=$goal, goalId=$goalId, projectVersionId=$projectVersionId, inferencePipelineId=$inferencePipelineId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateDataStarts=$dateDataStarts, dateDataEnds=$dateDataEnds, status=$status, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var goal: JsonField = JsonMissing.of() + private var goalId: JsonField = JsonMissing.of() + private var projectVersionId: JsonField = JsonMissing.of() + private var inferencePipelineId: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var dateDataStarts: JsonField = JsonMissing.of() + private var dateDataEnds: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + this.id = item.id + this.goal = item.goal + this.goalId = item.goalId + this.projectVersionId = item.projectVersionId + this.inferencePipelineId = item.inferencePipelineId + this.dateCreated = item.dateCreated + this.dateUpdated = item.dateUpdated + this.dateDataStarts = item.dateDataStarts + this.dateDataEnds = item.dateDataEnds + this.status = item.status + this.statusMessage = item.statusMessage + additionalProperties(item.additionalProperties) + } + + /** Project version (commit) id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** Project version (commit) id. */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + fun goal(goal: Goal) = goal(JsonField.of(goal)) + + @JsonProperty("goal") + @ExcludeMissing + fun goal(goal: JsonField) = apply { this.goal = goal } + + /** The test id. */ + fun goalId(goalId: String) = goalId(JsonField.of(goalId)) + + /** The test id. */ + @JsonProperty("goalId") + @ExcludeMissing + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") + @ExcludeMissing + fun projectVersionId(projectVersionId: JsonField) = apply { + this.projectVersionId = projectVersionId + } + + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: String) = + inferencePipelineId(JsonField.of(inferencePipelineId)) + + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun inferencePipelineId(inferencePipelineId: JsonField) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The data start date. */ + fun dateDataStarts(dateDataStarts: OffsetDateTime) = + dateDataStarts(JsonField.of(dateDataStarts)) + + /** The data start date. */ + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun dateDataStarts(dateDataStarts: JsonField) = apply { + this.dateDataStarts = dateDataStarts + } + + /** The data end date. */ + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) + + /** The data end date. */ + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun dateDataEnds(dateDataEnds: JsonField) = apply { + this.dateDataEnds = dateDataEnds + } + + /** The status of the test. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the test. */ + @JsonProperty("status") + @ExcludeMissing + fun status(status: JsonField) = apply { this.status = status } + + /** The status message. */ + fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + + /** The status message. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + 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(): Item = + Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) + } + + 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 other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = Goal.Builder::class) + @NoAutoDetect + class Goal + private constructor( + private val id: JsonField, + private val number: JsonField, + private val name: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val evaluationWindow: JsonField, + private val delayWindow: JsonField, + private val type: JsonField, + private val subtype: JsonField, + private val creatorId: JsonField, + private val originProjectVersionId: JsonField, + private val thresholds: JsonField>, + private val archived: JsonField, + private val dateArchived: JsonField, + private val suggested: JsonField, + private val commentCount: JsonField, + private val usesMlModel: JsonField, + private val usesValidationDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesReferenceDataset: JsonField, + private val usesProductionData: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The test id. */ + fun id(): String = id.getRequired("id") + + /** The test number. */ + fun number(): Long = number.getRequired("number") + + /** The test name. */ + fun name(): String = name.getRequired("name") + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(): Optional = + Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) + + /** The test type. */ + fun type(): String = type.getRequired("type") + + /** The test subtype. */ + fun subtype(): String = subtype.getRequired("subtype") + + /** The test creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(): Optional = + Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** Whether the test is archived. */ + fun archived(): Optional = + Optional.ofNullable(archived.getNullable("archived")) + + /** The date the test was archived. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + + /** Whether the test is suggested or user-created. */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + /** The number of comments on the test. */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** Whether the test uses an ML model. */ + fun usesMlModel(): Optional = + Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(): Optional = + Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(): Optional = + Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) + + /** The test id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The test number. */ + @JsonProperty("number") @ExcludeMissing fun _number() = number + + /** The test name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow() = evaluationWindow + + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + + /** The test type. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The test subtype. */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + + /** The test creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId() = originProjectVersionId + + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + + /** Whether the test is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + + /** The date the test was archived. */ + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived + + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested + + /** The number of comments on the test. */ + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + + /** Whether the test uses an ML model. */ + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset() = usesValidationDataset + + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset() = usesTrainingDataset + + /** Whether the test uses a reference dataset (monitoring mode only). */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset() = usesReferenceDataset + + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData() = usesProductionData + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Goal = apply { + if (!validated) { + id() + number() + name() + dateCreated() + dateUpdated() + evaluationWindow() + delayWindow() + type() + subtype() + creatorId() + originProjectVersionId() + thresholds().forEach { it.validate() } + archived() + dateArchived() + suggested() + commentCount() + usesMlModel() + usesValidationDataset() + usesTrainingDataset() + usesReferenceDataset() + usesProductionData() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Goal{id=$id, number=$number, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, evaluationWindow=$evaluationWindow, delayWindow=$delayWindow, type=$type, subtype=$subtype, creatorId=$creatorId, originProjectVersionId=$originProjectVersionId, thresholds=$thresholds, archived=$archived, dateArchived=$dateArchived, suggested=$suggested, commentCount=$commentCount, usesMlModel=$usesMlModel, usesValidationDataset=$usesValidationDataset, usesTrainingDataset=$usesTrainingDataset, usesReferenceDataset=$usesReferenceDataset, usesProductionData=$usesProductionData, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var number: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var description: JsonValue = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var subtype: JsonField = JsonMissing.of() + private var creatorId: JsonField = JsonMissing.of() + private var originProjectVersionId: JsonField = JsonMissing.of() + private var thresholds: JsonField> = JsonMissing.of() + private var archived: JsonField = JsonMissing.of() + private var dateArchived: JsonField = JsonMissing.of() + private var suggested: JsonField = JsonMissing.of() + private var commentCount: JsonField = JsonMissing.of() + private var usesMlModel: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesProductionData: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(goal: Goal) = apply { + this.id = goal.id + this.number = goal.number + this.name = goal.name + this.dateCreated = goal.dateCreated + this.dateUpdated = goal.dateUpdated + this.description = goal.description + this.evaluationWindow = goal.evaluationWindow + this.delayWindow = goal.delayWindow + this.type = goal.type + this.subtype = goal.subtype + this.creatorId = goal.creatorId + this.originProjectVersionId = goal.originProjectVersionId + this.thresholds = goal.thresholds + this.archived = goal.archived + this.dateArchived = goal.dateArchived + this.suggested = goal.suggested + this.commentCount = goal.commentCount + this.usesMlModel = goal.usesMlModel + this.usesValidationDataset = goal.usesValidationDataset + this.usesTrainingDataset = goal.usesTrainingDataset + this.usesReferenceDataset = goal.usesReferenceDataset + this.usesProductionData = goal.usesProductionData + additionalProperties(goal.additionalProperties) + } + + /** The test id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The test id. */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) + + /** The test number. */ + @JsonProperty("number") + @ExcludeMissing + fun number(number: JsonField) = apply { this.number = number } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The test name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The test description. */ + @JsonProperty("description") + @ExcludeMissing + fun description(description: JsonValue) = apply { this.description = description } + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(JsonField.of(evaluationWindow)) + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) + + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") + @ExcludeMissing + fun delayWindow(delayWindow: JsonField) = apply { + this.delayWindow = delayWindow + } + + /** The test type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** The test type. */ + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + /** The test subtype. */ + fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + + /** The test subtype. */ + @JsonProperty("subtype") + @ExcludeMissing + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + /** The test creator id. */ + fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + + /** The test creator id. */ + @JsonProperty("creatorId") + @ExcludeMissing + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String) = + originProjectVersionId(JsonField.of(originProjectVersionId)) + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + @JsonProperty("thresholds") + @ExcludeMissing + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds + } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = archived(JsonField.of(archived)) + + /** Whether the test is archived. */ + @JsonProperty("archived") + @ExcludeMissing + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) + + /** The date the test was archived. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") + @ExcludeMissing + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** The number of comments on the test. */ + @JsonProperty("commentCount") + @ExcludeMissing + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } + + /** Whether the test uses an ML model. */ + fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) + + /** Whether the test uses an ML model. */ + @JsonProperty("usesMlModel") + @ExcludeMissing + fun usesMlModel(usesMlModel: JsonField) = apply { + this.usesMlModel = usesMlModel + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset + } + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) + + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) + + /** Whether the test uses a reference dataset (monitoring mode only). */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { + this.usesReferenceDataset = usesReferenceDataset + } + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) + + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + 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(): Goal = + Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Threshold.Builder::class) + @NoAutoDetect + class Threshold + private constructor( + private val measurement: JsonField, + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The measurement to be evaluated. */ + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) + + /** The insight name to be evaluated. */ + fun insightName(): Optional = + Optional.ofNullable(insightName.getNullable("insightName")) + + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) + + /** The operator to be used for the evaluation. */ + fun operator(): Optional = + Optional.ofNullable(operator.getNullable("operator")) + + /** The value to be compared. */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** The measurement to be evaluated. */ + @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement + + /** The insight name to be evaluated. */ + @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName + + @JsonProperty("insightParameters") + @ExcludeMissing + fun _insightParameters() = insightParameters + + /** The operator to be used for the evaluation. */ + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + + /** The value to be compared. */ + @JsonProperty("value") @ExcludeMissing fun _value() = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Threshold = apply { + if (!validated) { + measurement() + insightName() + insightParameters() + operator() + value() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var measurement: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: JsonField> = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(threshold: Threshold) = apply { + this.measurement = threshold.measurement + this.insightName = threshold.insightName + this.insightParameters = threshold.insightParameters + this.operator = threshold.operator + this.value = threshold.value + additionalProperties(threshold.additionalProperties) + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** The measurement to be evaluated. */ + @JsonProperty("measurement") + @ExcludeMissing + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement + } + + /** The insight name to be evaluated. */ + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + + /** The insight name to be evaluated. */ + @JsonProperty("insightName") + @ExcludeMissing + fun insightName(insightName: JsonField) = apply { + this.insightName = insightName + } + + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) + + @JsonProperty("insightParameters") + @ExcludeMissing + fun insightParameters(insightParameters: JsonField>) = apply { + this.insightParameters = insightParameters + } + + /** The operator to be used for the evaluation. */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** The operator to be used for the evaluation. */ + @JsonProperty("operator") + @ExcludeMissing + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value to be compared. */ + fun value(value: Value) = value(JsonField.of(value)) + + /** The value to be compared. */ + @JsonProperty("value") + @ExcludeMissing + fun value(value: JsonField) = apply { this.value = value } + + 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(): Threshold = + Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + fun double(): Optional = Optional.ofNullable(double) + + fun boolean(): Optional = Optional.ofNullable(boolean) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isDouble(): Boolean = double != null + + fun isBoolean(): Boolean = boolean != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asDouble(): Double = double.getOrThrow("double") + + fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + } + + fun validate(): Value = apply { + if (!validated) { + if ( + double == null && + boolean == null && + string == null && + strings == null + ) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings + } + + override fun hashCode(): Int { + return Objects.hash( + double, + boolean, + string, + strings, + ) + } + + override fun toString(): String { + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + } + + companion object { + + @JvmStatic fun ofDouble(double: Double) = Value(double = double) + + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + interface Visitor { + + fun visitDouble(double: Double): T + + fun visitBoolean(boolean: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) + } + } + + class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + value.string != null -> generator.writeObject(value.string) + value.strings != null -> generator.writeObject(value.strings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Value") + } + } + } + } + } + } + } +} 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 new file mode 100644 index 0000000..e2f6f84 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -0,0 +1,2240 @@ +// 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.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +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.getOrThrow +import com.openlayer.api.core.toUnmodifiable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineDataStreamParams +constructor( + private val inferencePipelineId: String, + private val config: Config, + private val rows: List, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + fun config(): Config = config + + fun rows(): List = rows + + @JvmSynthetic + internal fun getBody(): InferencePipelineDataStreamBody { + return InferencePipelineDataStreamBody( + config, + rows, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + @JsonDeserialize(builder = InferencePipelineDataStreamBody.Builder::class) + @NoAutoDetect + class InferencePipelineDataStreamBody + internal constructor( + private val config: Config?, + private val rows: List?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + @JsonProperty("config") fun config(): Config? = config + + /** A list of entries that represent rows of a csv file */ + @JsonProperty("rows") fun rows(): List? = rows + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamBody && + this.config == other.config && + this.rows == other.rows && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + config, + rows, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var config: Config? = null + private var rows: List? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = + apply { + this.config = inferencePipelineDataStreamBody.config + this.rows = inferencePipelineDataStreamBody.rows + additionalProperties(inferencePipelineDataStreamBody.additionalProperties) + } + + /** + * Configuration for the data stream. Depends on your **Openlayer project task type**. + */ + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } + + /** A list of entries that represent rows of a csv file */ + @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } + + 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(): InferencePipelineDataStreamBody = + InferencePipelineDataStreamBody( + checkNotNull(config) { "`config` is required but was not set" }, + checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamParams && + this.inferencePipelineId == other.inferencePipelineId && + this.config == other.config && + this.rows == other.rows && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + config, + rows, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineDataStreamParams{inferencePipelineId=$inferencePipelineId, config=$config, rows=$rows, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var config: Config? = null + private var rows: MutableList = mutableListOf() + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(inferencePipelineDataStreamParams: InferencePipelineDataStreamParams) = + apply { + this.inferencePipelineId = inferencePipelineDataStreamParams.inferencePipelineId + this.config = inferencePipelineDataStreamParams.config + this.rows(inferencePipelineDataStreamParams.rows) + additionalQueryParams(inferencePipelineDataStreamParams.additionalQueryParams) + additionalHeaders(inferencePipelineDataStreamParams.additionalHeaders) + additionalBodyProperties(inferencePipelineDataStreamParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(config: Config) = apply { this.config = config } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(llmData: Config.LlmData) = apply { this.config = Config.ofLlmData(llmData) } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(tabularClassificationData: Config.TabularClassificationData) = apply { + this.config = Config.ofTabularClassificationData(tabularClassificationData) + } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(tabularRegressionData: Config.TabularRegressionData) = apply { + this.config = Config.ofTabularRegressionData(tabularRegressionData) + } + + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + fun config(textClassificationData: Config.TextClassificationData) = apply { + this.config = Config.ofTextClassificationData(textClassificationData) + } + + /** A list of entries that represent rows of a csv file */ + fun rows(rows: List) = apply { + this.rows.clear() + this.rows.addAll(rows) + } + + /** A list of entries that represent rows of a csv file */ + fun addRow(row: Row) = apply { this.rows.add(row) } + + 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(): InferencePipelineDataStreamParams = + InferencePipelineDataStreamParams( + checkNotNull(inferencePipelineId) { + "`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(), + ) + } + + @JsonDeserialize(using = Config.Deserializer::class) + @JsonSerialize(using = Config.Serializer::class) + class Config + private constructor( + private val llmData: LlmData? = null, + private val tabularClassificationData: TabularClassificationData? = null, + private val tabularRegressionData: TabularRegressionData? = null, + private val textClassificationData: TextClassificationData? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + fun llmData(): Optional = Optional.ofNullable(llmData) + + fun tabularClassificationData(): Optional = + Optional.ofNullable(tabularClassificationData) + + fun tabularRegressionData(): Optional = + Optional.ofNullable(tabularRegressionData) + + fun textClassificationData(): Optional = + Optional.ofNullable(textClassificationData) + + fun isLlmData(): Boolean = llmData != null + + fun isTabularClassificationData(): Boolean = tabularClassificationData != null + + fun isTabularRegressionData(): Boolean = tabularRegressionData != null + + fun isTextClassificationData(): Boolean = textClassificationData != null + + fun asLlmData(): LlmData = llmData.getOrThrow("llmData") + + fun asTabularClassificationData(): TabularClassificationData = + tabularClassificationData.getOrThrow("tabularClassificationData") + + fun asTabularRegressionData(): TabularRegressionData = + tabularRegressionData.getOrThrow("tabularRegressionData") + + fun asTextClassificationData(): TextClassificationData = + textClassificationData.getOrThrow("textClassificationData") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + llmData != null -> visitor.visitLlmData(llmData) + tabularClassificationData != null -> + visitor.visitTabularClassificationData(tabularClassificationData) + tabularRegressionData != null -> + visitor.visitTabularRegressionData(tabularRegressionData) + textClassificationData != null -> + visitor.visitTextClassificationData(textClassificationData) + else -> visitor.unknown(_json) + } + } + + fun validate(): Config = apply { + if (!validated) { + if ( + llmData == null && + tabularClassificationData == null && + tabularRegressionData == null && + textClassificationData == null + ) { + throw OpenlayerInvalidDataException("Unknown Config: $_json") + } + llmData?.validate() + tabularClassificationData?.validate() + tabularRegressionData?.validate() + textClassificationData?.validate() + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Config && + this.llmData == other.llmData && + this.tabularClassificationData == other.tabularClassificationData && + this.tabularRegressionData == other.tabularRegressionData && + this.textClassificationData == other.textClassificationData + } + + override fun hashCode(): Int { + return Objects.hash( + llmData, + tabularClassificationData, + tabularRegressionData, + textClassificationData, + ) + } + + override fun toString(): String { + return when { + llmData != null -> "Config{llmData=$llmData}" + tabularClassificationData != null -> + "Config{tabularClassificationData=$tabularClassificationData}" + tabularRegressionData != null -> + "Config{tabularRegressionData=$tabularRegressionData}" + textClassificationData != null -> + "Config{textClassificationData=$textClassificationData}" + _json != null -> "Config{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Config") + } + } + + companion object { + + @JvmStatic fun ofLlmData(llmData: LlmData) = Config(llmData = llmData) + + @JvmStatic + fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = + Config(tabularClassificationData = tabularClassificationData) + + @JvmStatic + fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = + Config(tabularRegressionData = tabularRegressionData) + + @JvmStatic + fun ofTextClassificationData(textClassificationData: TextClassificationData) = + Config(textClassificationData = textClassificationData) + } + + interface Visitor { + + fun visitLlmData(llmData: LlmData): T + + fun visitTabularClassificationData( + tabularClassificationData: TabularClassificationData + ): T + + fun visitTabularRegressionData(tabularRegressionData: TabularRegressionData): T + + fun visitTextClassificationData(textClassificationData: TextClassificationData): T + + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Config: $json") + } + } + + class Deserializer : BaseDeserializer(Config::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Config { + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Config(llmData = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Config(tabularClassificationData = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Config(tabularRegressionData = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Config(textClassificationData = it, _json = json) + } + + return Config(_json = json) + } + } + + class Serializer : BaseSerializer(Config::class) { + + override fun serialize( + value: Config, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.llmData != null -> generator.writeObject(value.llmData) + value.tabularClassificationData != null -> + generator.writeObject(value.tabularClassificationData) + value.tabularRegressionData != null -> + generator.writeObject(value.tabularRegressionData) + value.textClassificationData != null -> + generator.writeObject(value.textClassificationData) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Config") + } + } + } + + @JsonDeserialize(builder = LlmData.Builder::class) + @NoAutoDetect + class LlmData + private constructor( + private val numOfTokenColumnName: JsonField, + private val contextColumnName: JsonField, + private val costColumnName: JsonField, + private val groundTruthColumnName: JsonField, + private val inferenceIdColumnName: JsonField, + private val inputVariableNames: JsonField>, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val outputColumnName: JsonField, + private val prompt: JsonField>, + private val questionColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(): Optional = + Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + + /** + * Name of the column with the context retrieved. Applies to RAG use cases. Providing + * the context enables RAG-specific metrics. + */ + fun contextColumnName(): Optional = + Optional.ofNullable(contextColumnName.getNullable("contextColumnName")) + + /** Name of the column with the cost associated with each row. */ + fun costColumnName(): Optional = + Optional.ofNullable(costColumnName.getNullable("costColumnName")) + + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(): Optional = + Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** Array of input variable names. Each input variable should be a dataset column. */ + fun inputVariableNames(): Optional> = + Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model outputs. */ + fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") + + /** Prompt for the LLM. */ + fun prompt(): Optional> = Optional.ofNullable(prompt.getNullable("prompt")) + + /** + * Name of the column with the questions. Applies to RAG use cases. Providing the + * question enables RAG-specific metrics. + */ + fun questionColumnName(): Optional = + Optional.ofNullable(questionColumnName.getNullable("questionColumnName")) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** Name of the column with the total number of tokens. */ + @JsonProperty("numOfTokenColumnName") + @ExcludeMissing + fun _numOfTokenColumnName() = numOfTokenColumnName + + /** + * Name of the column with the context retrieved. Applies to RAG use cases. Providing + * the context enables RAG-specific metrics. + */ + @JsonProperty("contextColumnName") + @ExcludeMissing + fun _contextColumnName() = contextColumnName + + /** Name of the column with the cost associated with each row. */ + @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName + + /** Name of the column with the ground truths. */ + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + fun _groundTruthColumnName() = groundTruthColumnName + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** Array of input variable names. Each input variable should be a dataset column. */ + @JsonProperty("inputVariableNames") + @ExcludeMissing + fun _inputVariableNames() = inputVariableNames + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model outputs. */ + @JsonProperty("outputColumnName") + @ExcludeMissing + fun _outputColumnName() = outputColumnName + + /** Prompt for the LLM. */ + @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt + + /** + * Name of the column with the questions. Applies to RAG use cases. Providing the + * question enables RAG-specific metrics. + */ + @JsonProperty("questionColumnName") + @ExcludeMissing + fun _questionColumnName() = questionColumnName + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun _timestampColumnName() = timestampColumnName + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): LlmData = apply { + if (!validated) { + numOfTokenColumnName() + contextColumnName() + costColumnName() + groundTruthColumnName() + inferenceIdColumnName() + inputVariableNames() + latencyColumnName() + outputColumnName() + prompt().map { it.forEach { it.validate() } } + questionColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LlmData && + this.numOfTokenColumnName == other.numOfTokenColumnName && + this.contextColumnName == other.contextColumnName && + this.costColumnName == other.costColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.inputVariableNames == other.inputVariableNames && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.outputColumnName == other.outputColumnName && + this.prompt == other.prompt && + this.questionColumnName == other.questionColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames, + latencyColumnName, + metadata, + outputColumnName, + prompt, + questionColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "LlmData{numOfTokenColumnName=$numOfTokenColumnName, contextColumnName=$contextColumnName, costColumnName=$costColumnName, groundTruthColumnName=$groundTruthColumnName, inferenceIdColumnName=$inferenceIdColumnName, inputVariableNames=$inputVariableNames, latencyColumnName=$latencyColumnName, metadata=$metadata, outputColumnName=$outputColumnName, prompt=$prompt, questionColumnName=$questionColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var numOfTokenColumnName: JsonField = JsonMissing.of() + private var contextColumnName: JsonField = JsonMissing.of() + private var costColumnName: JsonField = JsonMissing.of() + private var groundTruthColumnName: JsonField = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var inputVariableNames: JsonField> = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var outputColumnName: JsonField = JsonMissing.of() + private var prompt: JsonField> = JsonMissing.of() + private var questionColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(llmData: LlmData) = apply { + this.numOfTokenColumnName = llmData.numOfTokenColumnName + this.contextColumnName = llmData.contextColumnName + this.costColumnName = llmData.costColumnName + this.groundTruthColumnName = llmData.groundTruthColumnName + this.inferenceIdColumnName = llmData.inferenceIdColumnName + this.inputVariableNames = llmData.inputVariableNames + this.latencyColumnName = llmData.latencyColumnName + this.metadata = llmData.metadata + this.outputColumnName = llmData.outputColumnName + this.prompt = llmData.prompt + this.questionColumnName = llmData.questionColumnName + this.timestampColumnName = llmData.timestampColumnName + additionalProperties(llmData.additionalProperties) + } + + /** Name of the column with the total number of tokens. */ + fun numOfTokenColumnName(numOfTokenColumnName: String) = + numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) + + /** Name of the column with the total number of tokens. */ + @JsonProperty("numOfTokenColumnName") + @ExcludeMissing + fun numOfTokenColumnName(numOfTokenColumnName: JsonField) = apply { + this.numOfTokenColumnName = numOfTokenColumnName + } + + /** + * Name of the column with the context retrieved. Applies to RAG use cases. + * Providing the context enables RAG-specific metrics. + */ + fun contextColumnName(contextColumnName: String) = + contextColumnName(JsonField.of(contextColumnName)) + + /** + * Name of the column with the context retrieved. Applies to RAG use cases. + * Providing the context enables RAG-specific metrics. + */ + @JsonProperty("contextColumnName") + @ExcludeMissing + fun contextColumnName(contextColumnName: JsonField) = apply { + this.contextColumnName = contextColumnName + } + + /** Name of the column with the cost associated with each row. */ + fun costColumnName(costColumnName: String) = + costColumnName(JsonField.of(costColumnName)) + + /** Name of the column with the cost associated with each row. */ + @JsonProperty("costColumnName") + @ExcludeMissing + fun costColumnName(costColumnName: JsonField) = apply { + this.costColumnName = costColumnName + } + + /** Name of the column with the ground truths. */ + fun groundTruthColumnName(groundTruthColumnName: String) = + groundTruthColumnName(JsonField.of(groundTruthColumnName)) + + /** Name of the column with the ground truths. */ + @JsonProperty("groundTruthColumnName") + @ExcludeMissing + fun groundTruthColumnName(groundTruthColumnName: JsonField) = apply { + this.groundTruthColumnName = groundTruthColumnName + } + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** + * Array of input variable names. Each input variable should be a dataset column. + */ + fun inputVariableNames(inputVariableNames: List) = + inputVariableNames(JsonField.of(inputVariableNames)) + + /** + * Array of input variable names. Each input variable should be a dataset column. + */ + @JsonProperty("inputVariableNames") + @ExcludeMissing + fun inputVariableNames(inputVariableNames: JsonField>) = apply { + this.inputVariableNames = inputVariableNames + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun latencyColumnName(latencyColumnName: JsonField) = apply { + this.latencyColumnName = latencyColumnName + } + + /** Object with metadata. */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + + /** Name of the column with the model outputs. */ + fun outputColumnName(outputColumnName: String) = + outputColumnName(JsonField.of(outputColumnName)) + + /** Name of the column with the model outputs. */ + @JsonProperty("outputColumnName") + @ExcludeMissing + fun outputColumnName(outputColumnName: JsonField) = apply { + this.outputColumnName = outputColumnName + } + + /** Prompt for the LLM. */ + fun prompt(prompt: List) = prompt(JsonField.of(prompt)) + + /** Prompt for the LLM. */ + @JsonProperty("prompt") + @ExcludeMissing + fun prompt(prompt: JsonField>) = apply { this.prompt = prompt } + + /** + * Name of the column with the questions. Applies to RAG use cases. Providing the + * question enables RAG-specific metrics. + */ + fun questionColumnName(questionColumnName: String) = + questionColumnName(JsonField.of(questionColumnName)) + + /** + * Name of the column with the questions. Applies to RAG use cases. Providing the + * question enables RAG-specific metrics. + */ + @JsonProperty("questionColumnName") + @ExcludeMissing + fun questionColumnName(questionColumnName: JsonField) = apply { + this.questionColumnName = questionColumnName + } + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + fun timestampColumnName(timestampColumnName: String) = + timestampColumnName(JsonField.of(timestampColumnName)) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): LlmData = + LlmData( + numOfTokenColumnName, + contextColumnName, + costColumnName, + groundTruthColumnName, + inferenceIdColumnName, + inputVariableNames.map { it.toUnmodifiable() }, + latencyColumnName, + metadata, + outputColumnName, + prompt.map { it.toUnmodifiable() }, + questionColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Prompt.Builder::class) + @NoAutoDetect + class Prompt + private constructor( + private val role: JsonField, + private val content: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Role of the prompt. */ + fun role(): Optional = Optional.ofNullable(role.getNullable("role")) + + /** Content of the prompt. */ + fun content(): Optional = + Optional.ofNullable(content.getNullable("content")) + + /** Role of the prompt. */ + @JsonProperty("role") @ExcludeMissing fun _role() = role + + /** Content of the prompt. */ + @JsonProperty("content") @ExcludeMissing fun _content() = content + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Prompt = apply { + if (!validated) { + role() + content() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Prompt && + this.role == other.role && + this.content == other.content && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + role, + content, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var role: JsonField = JsonMissing.of() + private var content: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(prompt: Prompt) = apply { + this.role = prompt.role + this.content = prompt.content + additionalProperties(prompt.additionalProperties) + } + + /** Role of the prompt. */ + fun role(role: String) = role(JsonField.of(role)) + + /** Role of the prompt. */ + @JsonProperty("role") + @ExcludeMissing + fun role(role: JsonField) = apply { this.role = role } + + /** Content of the prompt. */ + fun content(content: String) = content(JsonField.of(content)) + + /** Content of the prompt. */ + @JsonProperty("content") + @ExcludeMissing + fun content(content: JsonField) = apply { this.content = content } + + 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(): Prompt = + Prompt( + role, + content, + additionalProperties.toUnmodifiable(), + ) + } + } + } + + @JsonDeserialize(builder = TabularClassificationData.Builder::class) + @NoAutoDetect + class TabularClassificationData + private constructor( + private val categoricalFeatureNames: JsonField>, + private val classNames: JsonField>, + private val featureNames: JsonField>, + private val inferenceIdColumnName: JsonField, + private val labelColumnName: JsonField, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val predictionsColumnName: JsonField, + private val predictionScoresColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + fun categoricalFeatureNames(): Optional> = + Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(): List = classNames.getRequired("classNames") + + /** Array with all input feature names. */ + fun featureNames(): Optional> = + Optional.ofNullable(featureNames.getNullable("featureNames")) + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun _categoricalFeatureNames() = categoricalFeatureNames + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + @JsonProperty("classNames") @ExcludeMissing fun _classNames() = classNames + + /** Array with all input feature names. */ + @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = featureNames + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. + */ + @JsonProperty("labelColumnName") + @ExcludeMissing + fun _labelColumnName() = labelColumnName + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun _predictionsColumnName() = predictionsColumnName + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + fun _predictionScoresColumnName() = predictionScoresColumnName + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun _timestampColumnName() = timestampColumnName + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TabularClassificationData = apply { + if (!validated) { + categoricalFeatureNames() + classNames() + featureNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TabularClassificationData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.classNames == other.classNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + categoricalFeatureNames, + classNames, + featureNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "TabularClassificationData{categoricalFeatureNames=$categoricalFeatureNames, classNames=$classNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var categoricalFeatureNames: JsonField> = JsonMissing.of() + private var classNames: JsonField> = JsonMissing.of() + private var featureNames: JsonField> = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var labelColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var predictionsColumnName: JsonField = JsonMissing.of() + private var predictionScoresColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tabularClassificationData: TabularClassificationData) = apply { + this.categoricalFeatureNames = tabularClassificationData.categoricalFeatureNames + this.classNames = tabularClassificationData.classNames + this.featureNames = tabularClassificationData.featureNames + this.inferenceIdColumnName = tabularClassificationData.inferenceIdColumnName + this.labelColumnName = tabularClassificationData.labelColumnName + this.latencyColumnName = tabularClassificationData.latencyColumnName + this.metadata = tabularClassificationData.metadata + this.predictionsColumnName = tabularClassificationData.predictionsColumnName + this.predictionScoresColumnName = + tabularClassificationData.predictionScoresColumnName + this.timestampColumnName = tabularClassificationData.timestampColumnName + additionalProperties(tabularClassificationData.additionalProperties) + } + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. + */ + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = + apply { + this.categoricalFeatureNames = categoricalFeatureNames + } + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(classNames: List) = classNames(JsonField.of(classNames)) + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + @JsonProperty("classNames") + @ExcludeMissing + fun classNames(classNames: JsonField>) = apply { + this.classNames = classNames + } + + /** Array with all input feature names. */ + fun featureNames(featureNames: List) = + featureNames(JsonField.of(featureNames)) + + /** Array with all input feature names. */ + @JsonProperty("featureNames") + @ExcludeMissing + fun featureNames(featureNames: JsonField>) = apply { + this.featureNames = featureNames + } + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(labelColumnName: String) = + labelColumnName(JsonField.of(labelColumnName)) + + /** + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. + */ + @JsonProperty("labelColumnName") + @ExcludeMissing + fun labelColumnName(labelColumnName: JsonField) = apply { + this.labelColumnName = labelColumnName + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun latencyColumnName(latencyColumnName: JsonField) = apply { + this.latencyColumnName = latencyColumnName + } + + /** Object with metadata. */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun predictionsColumnName(predictionsColumnName: JsonField) = apply { + this.predictionsColumnName = predictionsColumnName + } + + /** + * Name of the column with the model's predictions as **lists of class + * probabilities**. + */ + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + + /** + * Name of the column with the model's predictions as **lists of class + * probabilities**. + */ + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = + apply { + this.predictionScoresColumnName = predictionScoresColumnName + } + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + fun timestampColumnName(timestampColumnName: String) = + timestampColumnName(JsonField.of(timestampColumnName)) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): TabularClassificationData = + TabularClassificationData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + classNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = TabularRegressionData.Builder::class) + @NoAutoDetect + class TabularRegressionData + private constructor( + private val categoricalFeatureNames: JsonField>, + private val featureNames: JsonField>, + private val inferenceIdColumnName: JsonField, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val predictionsColumnName: JsonField, + private val targetColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + fun categoricalFeatureNames(): Optional> = + Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + + /** Array with all input feature names. */ + fun featureNames(): Optional> = + Optional.ofNullable(featureNames.getNullable("featureNames")) + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model's predictions. */ + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + + /** Name of the column with the targets (ground truth values). */ + fun targetColumnName(): Optional = + Optional.ofNullable(targetColumnName.getNullable("targetColumnName")) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun _categoricalFeatureNames() = categoricalFeatureNames + + /** Array with all input feature names. */ + @JsonProperty("featureNames") @ExcludeMissing fun _featureNames() = featureNames + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model's predictions. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun _predictionsColumnName() = predictionsColumnName + + /** Name of the column with the targets (ground truth values). */ + @JsonProperty("targetColumnName") + @ExcludeMissing + fun _targetColumnName() = targetColumnName + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun _timestampColumnName() = timestampColumnName + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TabularRegressionData = apply { + if (!validated) { + categoricalFeatureNames() + featureNames() + inferenceIdColumnName() + latencyColumnName() + predictionsColumnName() + targetColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TabularRegressionData && + this.categoricalFeatureNames == other.categoricalFeatureNames && + this.featureNames == other.featureNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.targetColumnName == other.targetColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + categoricalFeatureNames, + featureNames, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var categoricalFeatureNames: JsonField> = JsonMissing.of() + private var featureNames: JsonField> = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var predictionsColumnName: JsonField = JsonMissing.of() + private var targetColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tabularRegressionData: TabularRegressionData) = apply { + this.categoricalFeatureNames = tabularRegressionData.categoricalFeatureNames + this.featureNames = tabularRegressionData.featureNames + this.inferenceIdColumnName = tabularRegressionData.inferenceIdColumnName + this.latencyColumnName = tabularRegressionData.latencyColumnName + this.metadata = tabularRegressionData.metadata + this.predictionsColumnName = tabularRegressionData.predictionsColumnName + this.targetColumnName = tabularRegressionData.targetColumnName + this.timestampColumnName = tabularRegressionData.timestampColumnName + additionalProperties(tabularRegressionData.additionalProperties) + } + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + + /** + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. + */ + @JsonProperty("categoricalFeatureNames") + @ExcludeMissing + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = + apply { + this.categoricalFeatureNames = categoricalFeatureNames + } + + /** Array with all input feature names. */ + fun featureNames(featureNames: List) = + featureNames(JsonField.of(featureNames)) + + /** Array with all input feature names. */ + @JsonProperty("featureNames") + @ExcludeMissing + fun featureNames(featureNames: JsonField>) = apply { + this.featureNames = featureNames + } + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun latencyColumnName(latencyColumnName: JsonField) = apply { + this.latencyColumnName = latencyColumnName + } + + /** Object with metadata. */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + + /** Name of the column with the model's predictions. */ + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) + + /** Name of the column with the model's predictions. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun predictionsColumnName(predictionsColumnName: JsonField) = apply { + this.predictionsColumnName = predictionsColumnName + } + + /** Name of the column with the targets (ground truth values). */ + fun targetColumnName(targetColumnName: String) = + targetColumnName(JsonField.of(targetColumnName)) + + /** Name of the column with the targets (ground truth values). */ + @JsonProperty("targetColumnName") + @ExcludeMissing + fun targetColumnName(targetColumnName: JsonField) = apply { + this.targetColumnName = targetColumnName + } + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + fun timestampColumnName(timestampColumnName: String) = + timestampColumnName(JsonField.of(timestampColumnName)) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): TabularRegressionData = + TabularRegressionData( + categoricalFeatureNames.map { it.toUnmodifiable() }, + featureNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + targetColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = TextClassificationData.Builder::class) + @NoAutoDetect + class TextClassificationData + private constructor( + private val classNames: JsonField>, + private val inferenceIdColumnName: JsonField, + private val labelColumnName: JsonField, + private val latencyColumnName: JsonField, + private val metadata: JsonValue, + private val predictionsColumnName: JsonField, + private val predictionScoresColumnName: JsonField, + private val textColumnName: JsonField, + private val timestampColumnName: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(): List = classNames.getRequired("classNames") + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) + + /** + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) + + /** Name of the column with the latencies. */ + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) + + /** Name of the column with the text data. */ + fun textColumnName(): Optional = + Optional.ofNullable(textColumnName.getNullable("textColumnName")) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + @JsonProperty("classNames") @ExcludeMissing fun _classNames() = classNames + + /** + * Name of the column with the inference ids. This is useful if you want to update rows + * at a later point in time. If not provided, a unique id is generated by Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun _inferenceIdColumnName() = inferenceIdColumnName + + /** + * Name of the column with the labels. The data in this column must be **zero-indexed + * integers**, matching the list provided in `classNames`. + */ + @JsonProperty("labelColumnName") + @ExcludeMissing + fun _labelColumnName() = labelColumnName + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun _latencyColumnName() = latencyColumnName + + /** Object with metadata. */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun _predictionsColumnName() = predictionsColumnName + + /** + * Name of the column with the model's predictions as **lists of class probabilities**. + */ + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + fun _predictionScoresColumnName() = predictionScoresColumnName + + /** Name of the column with the text data. */ + @JsonProperty("textColumnName") @ExcludeMissing fun _textColumnName() = textColumnName + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun _timestampColumnName() = timestampColumnName + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TextClassificationData = apply { + if (!validated) { + classNames() + inferenceIdColumnName() + labelColumnName() + latencyColumnName() + predictionsColumnName() + predictionScoresColumnName() + textColumnName() + timestampColumnName() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TextClassificationData && + this.classNames == other.classNames && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.labelColumnName == other.labelColumnName && + this.latencyColumnName == other.latencyColumnName && + this.metadata == other.metadata && + this.predictionsColumnName == other.predictionsColumnName && + this.predictionScoresColumnName == other.predictionScoresColumnName && + this.textColumnName == other.textColumnName && + this.timestampColumnName == other.timestampColumnName && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + classNames, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var classNames: JsonField> = JsonMissing.of() + private var inferenceIdColumnName: JsonField = JsonMissing.of() + private var labelColumnName: JsonField = JsonMissing.of() + private var latencyColumnName: JsonField = JsonMissing.of() + private var metadata: JsonValue = JsonMissing.of() + private var predictionsColumnName: JsonField = JsonMissing.of() + private var predictionScoresColumnName: JsonField = JsonMissing.of() + private var textColumnName: JsonField = JsonMissing.of() + private var timestampColumnName: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(textClassificationData: TextClassificationData) = apply { + this.classNames = textClassificationData.classNames + this.inferenceIdColumnName = textClassificationData.inferenceIdColumnName + this.labelColumnName = textClassificationData.labelColumnName + this.latencyColumnName = textClassificationData.latencyColumnName + this.metadata = textClassificationData.metadata + this.predictionsColumnName = textClassificationData.predictionsColumnName + this.predictionScoresColumnName = + textClassificationData.predictionScoresColumnName + this.textColumnName = textClassificationData.textColumnName + this.timestampColumnName = textClassificationData.timestampColumnName + additionalProperties(textClassificationData.additionalProperties) + } + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + fun classNames(classNames: List) = classNames(JsonField.of(classNames)) + + /** + * List of class names indexed by label integer in the dataset. E.g. + * ["Retained", "Exited"] when 0, 1 are in your label column. + */ + @JsonProperty("classNames") + @ExcludeMissing + fun classNames(classNames: JsonField>) = apply { + this.classNames = classNames + } + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) + + /** + * Name of the column with the inference ids. This is useful if you want to update + * rows at a later point in time. If not provided, a unique id is generated by + * Openlayer. + */ + @JsonProperty("inferenceIdColumnName") + @ExcludeMissing + fun inferenceIdColumnName(inferenceIdColumnName: JsonField) = apply { + this.inferenceIdColumnName = inferenceIdColumnName + } + + /** + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. + */ + fun labelColumnName(labelColumnName: String) = + labelColumnName(JsonField.of(labelColumnName)) + + /** + * Name of the column with the labels. The data in this column must be + * **zero-indexed integers**, matching the list provided in `classNames`. + */ + @JsonProperty("labelColumnName") + @ExcludeMissing + fun labelColumnName(labelColumnName: JsonField) = apply { + this.labelColumnName = labelColumnName + } + + /** Name of the column with the latencies. */ + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) + + /** Name of the column with the latencies. */ + @JsonProperty("latencyColumnName") + @ExcludeMissing + fun latencyColumnName(latencyColumnName: JsonField) = apply { + this.latencyColumnName = latencyColumnName + } + + /** Object with metadata. */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) + + /** Name of the column with the model's predictions as **zero-indexed integers**. */ + @JsonProperty("predictionsColumnName") + @ExcludeMissing + fun predictionsColumnName(predictionsColumnName: JsonField) = apply { + this.predictionsColumnName = predictionsColumnName + } + + /** + * Name of the column with the model's predictions as **lists of class + * probabilities**. + */ + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + + /** + * Name of the column with the model's predictions as **lists of class + * probabilities**. + */ + @JsonProperty("predictionScoresColumnName") + @ExcludeMissing + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = + apply { + this.predictionScoresColumnName = predictionScoresColumnName + } + + /** Name of the column with the text data. */ + fun textColumnName(textColumnName: String) = + textColumnName(JsonField.of(textColumnName)) + + /** Name of the column with the text data. */ + @JsonProperty("textColumnName") + @ExcludeMissing + fun textColumnName(textColumnName: JsonField) = apply { + this.textColumnName = textColumnName + } + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + fun timestampColumnName(timestampColumnName: String) = + timestampColumnName(JsonField.of(timestampColumnName)) + + /** + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If + * not provided, the upload timestamp is used. + */ + @JsonProperty("timestampColumnName") + @ExcludeMissing + fun timestampColumnName(timestampColumnName: JsonField) = apply { + this.timestampColumnName = timestampColumnName + } + + 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(): TextClassificationData = + TextClassificationData( + classNames.map { it.toUnmodifiable() }, + inferenceIdColumnName, + labelColumnName, + latencyColumnName, + metadata, + predictionsColumnName, + predictionScoresColumnName, + textColumnName, + timestampColumnName, + additionalProperties.toUnmodifiable(), + ) + } + } + } + + @JsonDeserialize(builder = Row.Builder::class) + @NoAutoDetect + class Row + private constructor( + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Row && this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode + } + + override fun toString() = "Row{additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(row: Row) = apply { additionalProperties(row.additionalProperties) } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Row = Row(additionalProperties.toUnmodifiable()) + } + } +} 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 new file mode 100644 index 0000000..087ceda --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -0,0 +1,161 @@ +// 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.util.Objects + +@JsonDeserialize(builder = InferencePipelineDataStreamResponse.Builder::class) +@NoAutoDetect +class InferencePipelineDataStreamResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun success(): Success = success.getRequired("success") + + @JsonProperty("success") @ExcludeMissing fun _success() = success + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineDataStreamResponse = apply { + if (!validated) { + success() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineDataStreamResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode + } + + override fun toString() = + "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var success: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse + ) = apply { + this.success = inferencePipelineDataStreamResponse.success + additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) + } + + fun success(success: Success) = success(JsonField.of(success)) + + @JsonProperty("success") + @ExcludeMissing + fun success(success: JsonField) = apply { this.success = success } + + 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(): InferencePipelineDataStreamResponse = + InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) + } + + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Success && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val TRUE = Success(JsonField.of(true)) + + @JvmStatic fun of(value: Boolean) = Success(JsonField.of(value)) + } + + enum class Known { + TRUE, + } + + enum class Value { + TRUE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + TRUE -> Value.TRUE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + TRUE -> Known.TRUE + else -> throw OpenlayerInvalidDataException("Unknown Success: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..e82d5a1 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -0,0 +1,369 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +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.errors.OpenlayerInvalidDataException +import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional + +class InferencePipelineTestResultListParams +constructor( + private val inferencePipelineId: String, + private val page: Long?, + private val perPage: Long?, + private val status: Status?, + private val type: Type?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun inferencePipelineId(): String = inferencePipelineId + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + fun status(): Optional = Optional.ofNullable(status) + + fun type(): Optional = Optional.ofNullable(type) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + this.status?.let { params.put("status", listOf(it.toString())) } + this.type?.let { params.put("type", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> inferencePipelineId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListParams && + this.inferencePipelineId == other.inferencePipelineId && + this.page == other.page && + this.perPage == other.perPage && + this.status == other.status && + this.type == other.type && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + inferencePipelineId, + page, + perPage, + status, + type, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "InferencePipelineTestResultListParams{inferencePipelineId=$inferencePipelineId, page=$page, perPage=$perPage, status=$status, type=$type, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var inferencePipelineId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var status: Status? = null + private var type: Type? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + inferencePipelineTestResultListParams: InferencePipelineTestResultListParams + ) = apply { + this.inferencePipelineId = inferencePipelineTestResultListParams.inferencePipelineId + this.page = inferencePipelineTestResultListParams.page + this.perPage = inferencePipelineTestResultListParams.perPage + this.status = inferencePipelineTestResultListParams.status + this.type = inferencePipelineTestResultListParams.type + additionalQueryParams(inferencePipelineTestResultListParams.additionalQueryParams) + additionalHeaders(inferencePipelineTestResultListParams.additionalHeaders) + additionalBodyProperties(inferencePipelineTestResultListParams.additionalBodyProperties) + } + + fun inferencePipelineId(inferencePipelineId: String) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + /** + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. + */ + fun status(status: Status) = apply { this.status = status } + + /** + * Filter objects by test type. Available types are `integrity`, `consistency`, + * `performance`, `fairness`, and `robustness`. + */ + fun type(type: Type) = apply { this.type = type } + + 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(): InferencePipelineTestResultListParams = + InferencePipelineTestResultListParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + page, + perPage, + status, + type, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + 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 other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val INTEGRITY = Type(JsonField.of("integrity")) + + @JvmField val CONSISTENCY = Type(JsonField.of("consistency")) + + @JvmField val PERFORMANCE = Type(JsonField.of("performance")) + + @JvmField val FAIRNESS = Type(JsonField.of("fairness")) + + @JvmField val ROBUSTNESS = Type(JsonField.of("robustness")) + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + } + + enum class Value { + INTEGRITY, + CONSISTENCY, + PERFORMANCE, + FAIRNESS, + ROBUSTNESS, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + INTEGRITY -> Value.INTEGRITY + CONSISTENCY -> Value.CONSISTENCY + PERFORMANCE -> Value.PERFORMANCE + FAIRNESS -> Value.FAIRNESS + ROBUSTNESS -> Value.ROBUSTNESS + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + INTEGRITY -> Known.INTEGRITY + CONSISTENCY -> Known.CONSISTENCY + PERFORMANCE -> Known.PERFORMANCE + FAIRNESS -> Known.FAIRNESS + ROBUSTNESS -> Known.ROBUSTNESS + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} 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 new file mode 100644 index 0000000..045ce71 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -0,0 +1,1666 @@ +// 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.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.BaseDeserializer +import com.openlayer.api.core.BaseSerializer +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.getOrThrow +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 = InferencePipelineTestResultListResponse.Builder::class) +@NoAutoDetect +class InferencePipelineTestResultListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InferencePipelineTestResultListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is InferencePipelineTestResultListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse + ) = apply { + this._meta = inferencePipelineTestResultListResponse._meta + this.items = inferencePipelineTestResultListResponse.items + additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): InferencePipelineTestResultListResponse = + InferencePipelineTestResultListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + private constructor( + private val id: JsonField, + private val goal: JsonField, + private val goalId: JsonField, + private val projectVersionId: JsonField, + private val inferencePipelineId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val dateDataStarts: JsonField, + private val dateDataEnds: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Project version (commit) id. */ + fun id(): String = id.getRequired("id") + + fun goal(): Optional = Optional.ofNullable(goal.getNullable("goal")) + + /** The test id. */ + fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) + + /** The project version (commit) id. */ + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + + /** The inference pipeline id. */ + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The data start date. */ + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + + /** The data end date. */ + fun dateDataEnds(): Optional = + Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + + /** The status of the test. */ + fun status(): Status = status.getRequired("status") + + /** The status message. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + /** Project version (commit) id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal + + /** The test id. */ + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId + + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun _inferencePipelineId() = inferencePipelineId + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The data start date. */ + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts + + /** The data end date. */ + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds + + /** The status of the test. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + goal().map { it.validate() } + goalId() + projectVersionId() + inferencePipelineId() + dateCreated() + dateUpdated() + dateDataStarts() + dateDataEnds() + status() + statusMessage() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.goal == other.goal && + this.goalId == other.goalId && + this.projectVersionId == other.projectVersionId && + this.inferencePipelineId == other.inferencePipelineId && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateDataStarts == other.dateDataStarts && + this.dateDataEnds == other.dateDataEnds && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Item{id=$id, goal=$goal, goalId=$goalId, projectVersionId=$projectVersionId, inferencePipelineId=$inferencePipelineId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateDataStarts=$dateDataStarts, dateDataEnds=$dateDataEnds, status=$status, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var goal: JsonField = JsonMissing.of() + private var goalId: JsonField = JsonMissing.of() + private var projectVersionId: JsonField = JsonMissing.of() + private var inferencePipelineId: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var dateDataStarts: JsonField = JsonMissing.of() + private var dateDataEnds: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + this.id = item.id + this.goal = item.goal + this.goalId = item.goalId + this.projectVersionId = item.projectVersionId + this.inferencePipelineId = item.inferencePipelineId + this.dateCreated = item.dateCreated + this.dateUpdated = item.dateUpdated + this.dateDataStarts = item.dateDataStarts + this.dateDataEnds = item.dateDataEnds + this.status = item.status + this.statusMessage = item.statusMessage + additionalProperties(item.additionalProperties) + } + + /** Project version (commit) id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** Project version (commit) id. */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + fun goal(goal: Goal) = goal(JsonField.of(goal)) + + @JsonProperty("goal") + @ExcludeMissing + fun goal(goal: JsonField) = apply { this.goal = goal } + + /** The test id. */ + fun goalId(goalId: String) = goalId(JsonField.of(goalId)) + + /** The test id. */ + @JsonProperty("goalId") + @ExcludeMissing + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } + + /** The project version (commit) id. */ + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) + + /** The project version (commit) id. */ + @JsonProperty("projectVersionId") + @ExcludeMissing + fun projectVersionId(projectVersionId: JsonField) = apply { + this.projectVersionId = projectVersionId + } + + /** The inference pipeline id. */ + fun inferencePipelineId(inferencePipelineId: String) = + inferencePipelineId(JsonField.of(inferencePipelineId)) + + /** The inference pipeline id. */ + @JsonProperty("inferencePipelineId") + @ExcludeMissing + fun inferencePipelineId(inferencePipelineId: JsonField) = apply { + this.inferencePipelineId = inferencePipelineId + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The data start date. */ + fun dateDataStarts(dateDataStarts: OffsetDateTime) = + dateDataStarts(JsonField.of(dateDataStarts)) + + /** The data start date. */ + @JsonProperty("dateDataStarts") + @ExcludeMissing + fun dateDataStarts(dateDataStarts: JsonField) = apply { + this.dateDataStarts = dateDataStarts + } + + /** The data end date. */ + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) + + /** The data end date. */ + @JsonProperty("dateDataEnds") + @ExcludeMissing + fun dateDataEnds(dateDataEnds: JsonField) = apply { + this.dateDataEnds = dateDataEnds + } + + /** The status of the test. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the test. */ + @JsonProperty("status") + @ExcludeMissing + fun status(status: JsonField) = apply { this.status = status } + + /** The status message. */ + fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + + /** The status message. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + 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(): Item = + Item( + id, + goal, + goalId, + projectVersionId, + inferencePipelineId, + dateCreated, + dateUpdated, + dateDataStarts, + dateDataEnds, + status, + statusMessage, + additionalProperties.toUnmodifiable(), + ) + } + + 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 other is Status && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RUNNING = Status(JsonField.of("running")) + + @JvmField val PASSING = Status(JsonField.of("passing")) + + @JvmField val FAILING = Status(JsonField.of("failing")) + + @JvmField val SKIPPED = Status(JsonField.of("skipped")) + + @JvmField val ERROR = Status(JsonField.of("error")) + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + } + + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = Goal.Builder::class) + @NoAutoDetect + class Goal + private constructor( + private val id: JsonField, + private val number: JsonField, + private val name: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonValue, + private val evaluationWindow: JsonField, + private val delayWindow: JsonField, + private val type: JsonField, + private val subtype: JsonField, + private val creatorId: JsonField, + private val originProjectVersionId: JsonField, + private val thresholds: JsonField>, + private val archived: JsonField, + private val dateArchived: JsonField, + private val suggested: JsonField, + private val commentCount: JsonField, + private val usesMlModel: JsonField, + private val usesValidationDataset: JsonField, + private val usesTrainingDataset: JsonField, + private val usesReferenceDataset: JsonField, + private val usesProductionData: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The test id. */ + fun id(): String = id.getRequired("id") + + /** The test number. */ + fun number(): Long = number.getRequired("number") + + /** The test name. */ + fun name(): String = name.getRequired("name") + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + fun evaluationWindow(): Optional = + Optional.ofNullable(evaluationWindow.getNullable("evaluationWindow")) + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) + + /** The test type. */ + fun type(): String = type.getRequired("type") + + /** The test subtype. */ + fun subtype(): String = subtype.getRequired("subtype") + + /** The test creator id. */ + fun creatorId(): Optional = + Optional.ofNullable(creatorId.getNullable("creatorId")) + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(): Optional = + Optional.ofNullable(originProjectVersionId.getNullable("originProjectVersionId")) + + fun thresholds(): List = thresholds.getRequired("thresholds") + + /** Whether the test is archived. */ + fun archived(): Optional = + Optional.ofNullable(archived.getNullable("archived")) + + /** The date the test was archived. */ + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) + + /** Whether the test is suggested or user-created. */ + fun suggested(): Boolean = suggested.getRequired("suggested") + + /** The number of comments on the test. */ + fun commentCount(): Long = commentCount.getRequired("commentCount") + + /** Whether the test uses an ML model. */ + fun usesMlModel(): Optional = + Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(): Optional = + Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(): Optional = + Optional.ofNullable(usesReferenceDataset.getNullable("usesReferenceDataset")) + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) + + /** The test id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The test number. */ + @JsonProperty("number") @ExcludeMissing fun _number() = number + + /** The test name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The test description. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description + + /** The evaluation window in seconds. Only applies to tests that use production data. */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun _evaluationWindow() = evaluationWindow + + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow + + /** The test type. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The test subtype. */ + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + + /** The test creator id. */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun _originProjectVersionId() = originProjectVersionId + + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds + + /** Whether the test is archived. */ + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived + + /** The date the test was archived. */ + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived + + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested + + /** The number of comments on the test. */ + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount + + /** Whether the test uses an ML model. */ + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun _usesValidationDataset() = usesValidationDataset + + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun _usesTrainingDataset() = usesTrainingDataset + + /** Whether the test uses a reference dataset (monitoring mode only). */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun _usesReferenceDataset() = usesReferenceDataset + + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun _usesProductionData() = usesProductionData + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Goal = apply { + if (!validated) { + id() + number() + name() + dateCreated() + dateUpdated() + evaluationWindow() + delayWindow() + type() + subtype() + creatorId() + originProjectVersionId() + thresholds().forEach { it.validate() } + archived() + dateArchived() + suggested() + commentCount() + usesMlModel() + usesValidationDataset() + usesTrainingDataset() + usesReferenceDataset() + usesProductionData() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Goal && + this.id == other.id && + this.number == other.number && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.evaluationWindow == other.evaluationWindow && + this.delayWindow == other.delayWindow && + this.type == other.type && + this.subtype == other.subtype && + this.creatorId == other.creatorId && + this.originProjectVersionId == other.originProjectVersionId && + this.thresholds == other.thresholds && + this.archived == other.archived && + this.dateArchived == other.dateArchived && + this.suggested == other.suggested && + this.commentCount == other.commentCount && + this.usesMlModel == other.usesMlModel && + this.usesValidationDataset == other.usesValidationDataset && + this.usesTrainingDataset == other.usesTrainingDataset && + this.usesReferenceDataset == other.usesReferenceDataset && + this.usesProductionData == other.usesProductionData && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Goal{id=$id, number=$number, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, evaluationWindow=$evaluationWindow, delayWindow=$delayWindow, type=$type, subtype=$subtype, creatorId=$creatorId, originProjectVersionId=$originProjectVersionId, thresholds=$thresholds, archived=$archived, dateArchived=$dateArchived, suggested=$suggested, commentCount=$commentCount, usesMlModel=$usesMlModel, usesValidationDataset=$usesValidationDataset, usesTrainingDataset=$usesTrainingDataset, usesReferenceDataset=$usesReferenceDataset, usesProductionData=$usesProductionData, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var number: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var description: JsonValue = JsonMissing.of() + private var evaluationWindow: JsonField = JsonMissing.of() + private var delayWindow: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var subtype: JsonField = JsonMissing.of() + private var creatorId: JsonField = JsonMissing.of() + private var originProjectVersionId: JsonField = JsonMissing.of() + private var thresholds: JsonField> = JsonMissing.of() + private var archived: JsonField = JsonMissing.of() + private var dateArchived: JsonField = JsonMissing.of() + private var suggested: JsonField = JsonMissing.of() + private var commentCount: JsonField = JsonMissing.of() + private var usesMlModel: JsonField = JsonMissing.of() + private var usesValidationDataset: JsonField = JsonMissing.of() + private var usesTrainingDataset: JsonField = JsonMissing.of() + private var usesReferenceDataset: JsonField = JsonMissing.of() + private var usesProductionData: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(goal: Goal) = apply { + this.id = goal.id + this.number = goal.number + this.name = goal.name + this.dateCreated = goal.dateCreated + this.dateUpdated = goal.dateUpdated + this.description = goal.description + this.evaluationWindow = goal.evaluationWindow + this.delayWindow = goal.delayWindow + this.type = goal.type + this.subtype = goal.subtype + this.creatorId = goal.creatorId + this.originProjectVersionId = goal.originProjectVersionId + this.thresholds = goal.thresholds + this.archived = goal.archived + this.dateArchived = goal.dateArchived + this.suggested = goal.suggested + this.commentCount = goal.commentCount + this.usesMlModel = goal.usesMlModel + this.usesValidationDataset = goal.usesValidationDataset + this.usesTrainingDataset = goal.usesTrainingDataset + this.usesReferenceDataset = goal.usesReferenceDataset + this.usesProductionData = goal.usesProductionData + additionalProperties(goal.additionalProperties) + } + + /** The test id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The test id. */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + /** The test number. */ + fun number(number: Long) = number(JsonField.of(number)) + + /** The test number. */ + @JsonProperty("number") + @ExcludeMissing + fun number(number: JsonField) = apply { this.number = number } + + /** The test name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The test name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The test description. */ + @JsonProperty("description") + @ExcludeMissing + fun description(description: JsonValue) = apply { this.description = description } + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(JsonField.of(evaluationWindow)) + + /** + * The evaluation window in seconds. Only applies to tests that use production data. + */ + @JsonProperty("evaluationWindow") + @ExcludeMissing + fun evaluationWindow(evaluationWindow: JsonField) = apply { + this.evaluationWindow = evaluationWindow + } + + /** The delay window in seconds. Only applies to tests that use production data. */ + fun delayWindow(delayWindow: Double) = delayWindow(JsonField.of(delayWindow)) + + /** The delay window in seconds. Only applies to tests that use production data. */ + @JsonProperty("delayWindow") + @ExcludeMissing + fun delayWindow(delayWindow: JsonField) = apply { + this.delayWindow = delayWindow + } + + /** The test type. */ + fun type(type: String) = type(JsonField.of(type)) + + /** The test type. */ + @JsonProperty("type") + @ExcludeMissing + fun type(type: JsonField) = apply { this.type = type } + + /** The test subtype. */ + fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + + /** The test subtype. */ + @JsonProperty("subtype") + @ExcludeMissing + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + + /** The test creator id. */ + fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) + + /** The test creator id. */ + @JsonProperty("creatorId") + @ExcludeMissing + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The project version (commit) id where the test was created. */ + fun originProjectVersionId(originProjectVersionId: String) = + originProjectVersionId(JsonField.of(originProjectVersionId)) + + /** The project version (commit) id where the test was created. */ + @JsonProperty("originProjectVersionId") + @ExcludeMissing + fun originProjectVersionId(originProjectVersionId: JsonField) = apply { + this.originProjectVersionId = originProjectVersionId + } + + fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) + + @JsonProperty("thresholds") + @ExcludeMissing + fun thresholds(thresholds: JsonField>) = apply { + this.thresholds = thresholds + } + + /** Whether the test is archived. */ + fun archived(archived: Boolean) = archived(JsonField.of(archived)) + + /** Whether the test is archived. */ + @JsonProperty("archived") + @ExcludeMissing + fun archived(archived: JsonField) = apply { this.archived = archived } + + /** The date the test was archived. */ + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) + + /** The date the test was archived. */ + @JsonProperty("dateArchived") + @ExcludeMissing + fun dateArchived(dateArchived: JsonField) = apply { + this.dateArchived = dateArchived + } + + /** Whether the test is suggested or user-created. */ + fun suggested(suggested: Boolean) = suggested(JsonField.of(suggested)) + + /** Whether the test is suggested or user-created. */ + @JsonProperty("suggested") + @ExcludeMissing + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } + + /** The number of comments on the test. */ + fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) + + /** The number of comments on the test. */ + @JsonProperty("commentCount") + @ExcludeMissing + fun commentCount(commentCount: JsonField) = apply { + this.commentCount = commentCount + } + + /** Whether the test uses an ML model. */ + fun usesMlModel(usesMlModel: Boolean) = usesMlModel(JsonField.of(usesMlModel)) + + /** Whether the test uses an ML model. */ + @JsonProperty("usesMlModel") + @ExcludeMissing + fun usesMlModel(usesMlModel: JsonField) = apply { + this.usesMlModel = usesMlModel + } + + /** Whether the test uses a validation dataset. */ + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) + + /** Whether the test uses a validation dataset. */ + @JsonProperty("usesValidationDataset") + @ExcludeMissing + fun usesValidationDataset(usesValidationDataset: JsonField) = apply { + this.usesValidationDataset = usesValidationDataset + } + + /** Whether the test uses a training dataset. */ + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) + + /** Whether the test uses a training dataset. */ + @JsonProperty("usesTrainingDataset") + @ExcludeMissing + fun usesTrainingDataset(usesTrainingDataset: JsonField) = apply { + this.usesTrainingDataset = usesTrainingDataset + } + + /** Whether the test uses a reference dataset (monitoring mode only). */ + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) + + /** Whether the test uses a reference dataset (monitoring mode only). */ + @JsonProperty("usesReferenceDataset") + @ExcludeMissing + fun usesReferenceDataset(usesReferenceDataset: JsonField) = apply { + this.usesReferenceDataset = usesReferenceDataset + } + + /** Whether the test uses production data (monitoring mode only). */ + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) + + /** Whether the test uses production data (monitoring mode only). */ + @JsonProperty("usesProductionData") + @ExcludeMissing + fun usesProductionData(usesProductionData: JsonField) = apply { + this.usesProductionData = usesProductionData + } + + 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(): Goal = + Goal( + id, + number, + name, + dateCreated, + dateUpdated, + description, + evaluationWindow, + delayWindow, + type, + subtype, + creatorId, + originProjectVersionId, + thresholds.map { it.toUnmodifiable() }, + archived, + dateArchived, + suggested, + commentCount, + usesMlModel, + usesValidationDataset, + usesTrainingDataset, + usesReferenceDataset, + usesProductionData, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Threshold.Builder::class) + @NoAutoDetect + class Threshold + private constructor( + private val measurement: JsonField, + private val insightName: JsonField, + private val insightParameters: JsonField>, + private val operator: JsonField, + private val value: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The measurement to be evaluated. */ + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) + + /** The insight name to be evaluated. */ + fun insightName(): Optional = + Optional.ofNullable(insightName.getNullable("insightName")) + + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) + + /** The operator to be used for the evaluation. */ + fun operator(): Optional = + Optional.ofNullable(operator.getNullable("operator")) + + /** The value to be compared. */ + fun value(): Optional = Optional.ofNullable(value.getNullable("value")) + + /** The measurement to be evaluated. */ + @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement + + /** The insight name to be evaluated. */ + @JsonProperty("insightName") @ExcludeMissing fun _insightName() = insightName + + @JsonProperty("insightParameters") + @ExcludeMissing + fun _insightParameters() = insightParameters + + /** The operator to be used for the evaluation. */ + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator + + /** The value to be compared. */ + @JsonProperty("value") @ExcludeMissing fun _value() = value + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Threshold = apply { + if (!validated) { + measurement() + insightName() + insightParameters() + operator() + value() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Threshold && + this.measurement == other.measurement && + this.insightName == other.insightName && + this.insightParameters == other.insightParameters && + this.operator == other.operator && + this.value == other.value && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + measurement, + insightName, + insightParameters, + operator, + value, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var measurement: JsonField = JsonMissing.of() + private var insightName: JsonField = JsonMissing.of() + private var insightParameters: JsonField> = JsonMissing.of() + private var operator: JsonField = JsonMissing.of() + private var value: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(threshold: Threshold) = apply { + this.measurement = threshold.measurement + this.insightName = threshold.insightName + this.insightParameters = threshold.insightParameters + this.operator = threshold.operator + this.value = threshold.value + additionalProperties(threshold.additionalProperties) + } + + /** The measurement to be evaluated. */ + fun measurement(measurement: String) = measurement(JsonField.of(measurement)) + + /** The measurement to be evaluated. */ + @JsonProperty("measurement") + @ExcludeMissing + fun measurement(measurement: JsonField) = apply { + this.measurement = measurement + } + + /** The insight name to be evaluated. */ + fun insightName(insightName: String) = insightName(JsonField.of(insightName)) + + /** The insight name to be evaluated. */ + @JsonProperty("insightName") + @ExcludeMissing + fun insightName(insightName: JsonField) = apply { + this.insightName = insightName + } + + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) + + @JsonProperty("insightParameters") + @ExcludeMissing + fun insightParameters(insightParameters: JsonField>) = apply { + this.insightParameters = insightParameters + } + + /** The operator to be used for the evaluation. */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** The operator to be used for the evaluation. */ + @JsonProperty("operator") + @ExcludeMissing + fun operator(operator: JsonField) = apply { this.operator = operator } + + /** The value to be compared. */ + fun value(value: Value) = value(JsonField.of(value)) + + /** The value to be compared. */ + @JsonProperty("value") + @ExcludeMissing + fun value(value: JsonField) = apply { this.value = value } + + 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(): Threshold = + Threshold( + measurement, + insightName, + insightParameters.map { it.toUnmodifiable() }, + operator, + value, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(using = Value.Deserializer::class) + @JsonSerialize(using = Value.Serializer::class) + class Value + private constructor( + private val double: Double? = null, + private val boolean: Boolean? = null, + private val string: String? = null, + private val strings: List? = null, + private val _json: JsonValue? = null, + ) { + + private var validated: Boolean = false + + fun double(): Optional = Optional.ofNullable(double) + + fun boolean(): Optional = Optional.ofNullable(boolean) + + fun string(): Optional = Optional.ofNullable(string) + + fun strings(): Optional> = Optional.ofNullable(strings) + + fun isDouble(): Boolean = double != null + + fun isBoolean(): Boolean = boolean != null + + fun isString(): Boolean = string != null + + fun isStrings(): Boolean = strings != null + + fun asDouble(): Double = double.getOrThrow("double") + + fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + + fun asString(): String = string.getOrThrow("string") + + fun asStrings(): List = strings.getOrThrow("strings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + double != null -> visitor.visitDouble(double) + boolean != null -> visitor.visitBoolean(boolean) + string != null -> visitor.visitString(string) + strings != null -> visitor.visitStrings(strings) + else -> visitor.unknown(_json) + } + } + + fun validate(): Value = apply { + if (!validated) { + if ( + double == null && + boolean == null && + string == null && + strings == null + ) { + throw OpenlayerInvalidDataException("Unknown Value: $_json") + } + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Value && + this.double == other.double && + this.boolean == other.boolean && + this.string == other.string && + this.strings == other.strings + } + + override fun hashCode(): Int { + return Objects.hash( + double, + boolean, + string, + strings, + ) + } + + override fun toString(): String { + return when { + double != null -> "Value{double=$double}" + boolean != null -> "Value{boolean=$boolean}" + string != null -> "Value{string=$string}" + strings != null -> "Value{strings=$strings}" + _json != null -> "Value{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Value") + } + } + + companion object { + + @JvmStatic fun ofDouble(double: Double) = Value(double = double) + + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + + @JvmStatic fun ofString(string: String) = Value(string = string) + + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) + } + + interface Visitor { + + fun visitDouble(double: Double): T + + fun visitBoolean(boolean: Boolean): T + + fun visitString(string: String): T + + fun visitStrings(strings: List): T + + fun unknown(json: JsonValue?): T { + throw OpenlayerInvalidDataException("Unknown Value: $json") + } + } + + class Deserializer : BaseDeserializer(Value::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Value { + val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(double = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(boolean = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef())?.let { + return Value(string = it, _json = json) + } + tryDeserialize(node, jacksonTypeRef>())?.let { + return Value(strings = it, _json = json) + } + + return Value(_json = json) + } + } + + class Serializer : BaseSerializer(Value::class) { + + override fun serialize( + value: Value, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.double != null -> generator.writeObject(value.double) + value.boolean != null -> generator.writeObject(value.boolean) + value.string != null -> generator.writeObject(value.string) + value.strings != null -> generator.writeObject(value.strings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Value") + } + } + } + } + } + } + } +} 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 new file mode 100644 index 0000000..9266137 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -0,0 +1,179 @@ +// File generated from our OpenAPI spec by Stainless. + +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.models.* +import java.util.Objects +import java.util.Optional + +class ProjectCommitListParams +constructor( + private val projectId: String, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectId(): String = projectId + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCommitListParams && + this.projectId == other.projectId && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectId, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectCommitListParams{projectId=$projectId, page=$page, perPage=$perPage, 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 page: Long? = null + private var perPage: Long? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCommitListParams: ProjectCommitListParams) = apply { + this.projectId = projectCommitListParams.projectId + this.page = projectCommitListParams.page + this.perPage = projectCommitListParams.perPage + additionalQueryParams(projectCommitListParams.additionalQueryParams) + additionalHeaders(projectCommitListParams.additionalHeaders) + additionalBodyProperties(projectCommitListParams.additionalBodyProperties) + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + 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(): ProjectCommitListParams = + ProjectCommitListParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..da9d1fd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -0,0 +1,1308 @@ +// 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 = ProjectCommitListResponse.Builder::class) +@NoAutoDetect +class ProjectCommitListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectCommitListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCommitListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCommitListResponse: ProjectCommitListResponse) = apply { + this._meta = projectCommitListResponse._meta + this.items = projectCommitListResponse.items + additionalProperties(projectCommitListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): ProjectCommitListResponse = + ProjectCommitListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + 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 + + private var hashCode: Int = 0 + + /** 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(): Item = 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) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + 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 + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + dateCreated, + status, + statusMessage, + projectId, + storageUri, + commit, + deploymentStatus, + mlModelId, + validationDatasetId, + trainingDatasetId, + archived, + dateArchived, + passingGoalCount, + failingGoalCount, + totalGoalCount, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Item{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}" + + 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(item: Item) = apply { + this.id = item.id + this.dateCreated = item.dateCreated + this.status = item.status + this.statusMessage = item.statusMessage + this.projectId = item.projectId + this.storageUri = item.storageUri + this.commit = item.commit + this.deploymentStatus = item.deploymentStatus + this.mlModelId = item.mlModelId + this.validationDatasetId = item.validationDatasetId + this.trainingDatasetId = item.trainingDatasetId + this.archived = item.archived + this.dateArchived = item.dateArchived + this.passingGoalCount = item.passingGoalCount + this.failingGoalCount = item.failingGoalCount + this.totalGoalCount = item.totalGoalCount + this.links = item.links + additionalProperties(item.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(): Item = + Item( + 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 + + private var hashCode: Int = 0 + + /** 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) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return 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 + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + authorId, + dateCreated, + fileSize, + message, + mlModelId, + validationDatasetId, + trainingDatasetId, + storageUri, + gitCommitSha, + gitCommitRef, + gitCommitUrl, + additionalProperties, + ) + } + 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}" + + 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(), + ) + } + } + + 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 other is Status && this.value == other.value + } + + 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 + + private var hashCode: Int = 0 + + 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) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + 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()) + } + } + } +} 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 new file mode 100644 index 0000000..cab7c08 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -0,0 +1,449 @@ +// 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.util.Objects +import java.util.Optional + +class ProjectInferencePipelineCreateParams +constructor( + private val projectId: String, + private val description: String?, + private val name: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectId(): String = projectId + + fun description(): Optional = Optional.ofNullable(description) + + fun name(): String = name + + @JvmSynthetic + internal fun getBody(): ProjectInferencePipelineCreateBody { + return ProjectInferencePipelineCreateBody( + description, + name, + 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 = ProjectInferencePipelineCreateBody.Builder::class) + @NoAutoDetect + class ProjectInferencePipelineCreateBody + internal constructor( + private val description: String?, + private val name: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The inference pipeline description. */ + @JsonProperty("description") fun description(): String? = description + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(): String? = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateBody && + this.description == other.description && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + description, + name, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var description: String? = null + private var name: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody + ) = apply { + this.description = projectInferencePipelineCreateBody.description + this.name = projectInferencePipelineCreateBody.name + additionalProperties(projectInferencePipelineCreateBody.additionalProperties) + } + + /** The inference pipeline description. */ + @JsonProperty("description") + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + 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(): ProjectInferencePipelineCreateBody = + ProjectInferencePipelineCreateBody( + description, + checkNotNull(name) { "`name` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateParams && + this.projectId == other.projectId && + this.description == other.description && + this.name == other.name && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectId, + description, + name, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectInferencePipelineCreateParams{projectId=$projectId, description=$description, name=$name, 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 description: String? = null + private var name: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams + ) = apply { + this.projectId = projectInferencePipelineCreateParams.projectId + this.description = projectInferencePipelineCreateParams.description + this.name = projectInferencePipelineCreateParams.name + additionalQueryParams(projectInferencePipelineCreateParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineCreateParams.additionalHeaders) + additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** The inference pipeline description. */ + fun description(description: String) = apply { this.description = description } + + /** The inference pipeline name. */ + fun name(name: String) = apply { this.name = name } + + 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(): ProjectInferencePipelineCreateParams = + ProjectInferencePipelineCreateParams( + 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(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("app") fun app(): String? = app + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + 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() + ) + } + } + + 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 other is Status && this.value == other.value + } + + 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() + } +} 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 new file mode 100644 index 0000000..acd34bb --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -0,0 +1,613 @@ +// 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 = ProjectInferencePipelineCreateResponse.Builder::class) +@NoAutoDetect +class ProjectInferencePipelineCreateResponse +private constructor( + private val id: JsonField, + private val projectId: JsonField, + private val name: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val dateLastSampleReceived: JsonField, + private val description: JsonField, + private val dateLastEvaluated: JsonField, + private val dateOfNextEvaluation: JsonField, + private val passingGoalCount: JsonField, + private val failingGoalCount: JsonField, + private val totalGoalCount: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val links: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** The inference pipeline name. */ + fun name(): String = name.getRequired("name") + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The last data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** The inference pipeline description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The number of tests passing. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + + /** The status of test evaluation for the inference pipeline. */ + fun status(): Status = status.getRequired("status") + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The last data sample received date. */ + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun _dateLastSampleReceived() = dateLastSampleReceived + + /** The inference pipeline description. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description + + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectInferencePipelineCreateResponse = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineCreateResponse && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var dateLastSampleReceived: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var passingGoalCount: JsonField = JsonMissing.of() + private var failingGoalCount: JsonField = JsonMissing.of() + private var totalGoalCount: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse + ) = apply { + this.id = projectInferencePipelineCreateResponse.id + this.projectId = projectInferencePipelineCreateResponse.projectId + this.name = projectInferencePipelineCreateResponse.name + this.dateCreated = projectInferencePipelineCreateResponse.dateCreated + this.dateUpdated = projectInferencePipelineCreateResponse.dateUpdated + this.dateLastSampleReceived = + projectInferencePipelineCreateResponse.dateLastSampleReceived + this.description = projectInferencePipelineCreateResponse.description + this.dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated + this.dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation + this.passingGoalCount = projectInferencePipelineCreateResponse.passingGoalCount + this.failingGoalCount = projectInferencePipelineCreateResponse.failingGoalCount + this.totalGoalCount = projectInferencePipelineCreateResponse.totalGoalCount + this.status = projectInferencePipelineCreateResponse.status + this.statusMessage = projectInferencePipelineCreateResponse.statusMessage + this.links = projectInferencePipelineCreateResponse.links + additionalProperties(projectInferencePipelineCreateResponse.additionalProperties) + } + + /** The inference pipeline id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = + dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + + /** The last data sample received date. */ + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } + + /** The inference pipeline description. */ + fun description(description: String) = description(JsonField.of(description)) + + /** The inference pipeline description. */ + @JsonProperty("description") + @ExcludeMissing + fun description(description: JsonField) = apply { this.description = description } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = + dateLastEvaluated(JsonField.of(dateLastEvaluated)) + + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** The status of test evaluation for the inference pipeline. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") + @ExcludeMissing + fun status(status: JsonField) = apply { this.status = status } + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + 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(): ProjectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + 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) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + 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()) + } + } + + 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 other is Status && this.value == other.value + } + + 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() + } +} 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 new file mode 100644 index 0000000..1b909ab --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -0,0 +1,194 @@ +// File generated from our OpenAPI spec by Stainless. + +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.models.* +import java.util.Objects +import java.util.Optional + +class ProjectInferencePipelineListParams +constructor( + private val projectId: String, + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun projectId(): String = projectId + + fun name(): Optional = Optional.ofNullable(name) + + fun page(): Optional = Optional.ofNullable(page) + + fun perPage(): Optional = Optional.ofNullable(perPage) + + @JvmSynthetic + internal fun getQueryParams(): Map> { + val params = mutableMapOf>() + this.name?.let { params.put("name", listOf(it.toString())) } + this.page?.let { params.put("page", listOf(it.toString())) } + this.perPage?.let { params.put("perPage", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() + } + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> projectId + else -> "" + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListParams && + this.projectId == other.projectId && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + projectId, + name, + page, + perPage, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ProjectInferencePipelineListParams{projectId=$projectId, name=$name, page=$page, perPage=$perPage, 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 name: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectInferencePipelineListParams: ProjectInferencePipelineListParams) = + apply { + this.projectId = projectInferencePipelineListParams.projectId + this.name = projectInferencePipelineListParams.name + this.page = projectInferencePipelineListParams.page + this.perPage = projectInferencePipelineListParams.perPage + additionalQueryParams(projectInferencePipelineListParams.additionalQueryParams) + additionalHeaders(projectInferencePipelineListParams.additionalHeaders) + additionalBodyProperties( + projectInferencePipelineListParams.additionalBodyProperties + ) + } + + fun projectId(projectId: String) = apply { this.projectId = projectId } + + /** Filter list of items by name. */ + fun name(name: String) = apply { this.name = name } + + /** The page to return in a paginated query. */ + fun page(page: Long) = apply { this.page = page } + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long) = apply { this.perPage = perPage } + + 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(): ProjectInferencePipelineListParams = + ProjectInferencePipelineListParams( + checkNotNull(projectId) { "`projectId` is required but was not set" }, + name, + page, + perPage, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } +} 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 new file mode 100644 index 0000000..cb9e840 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -0,0 +1,897 @@ +// 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 = ProjectInferencePipelineListResponse.Builder::class) +@NoAutoDetect +class ProjectInferencePipelineListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + fun _meta(): _Meta = _meta.getRequired("_meta") + + fun items(): List = items.getRequired("items") + + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta + + @JsonProperty("items") @ExcludeMissing fun _items() = items + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ProjectInferencePipelineListResponse = apply { + if (!validated) { + _meta().validate() + items().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectInferencePipelineListResponse && + this._meta == other._meta && + this.items == other.items && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var _meta: JsonField<_Meta> = JsonMissing.of() + private var items: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + projectInferencePipelineListResponse: ProjectInferencePipelineListResponse + ) = apply { + this._meta = projectInferencePipelineListResponse._meta + this.items = projectInferencePipelineListResponse.items + additionalProperties(projectInferencePipelineListResponse.additionalProperties) + } + + fun _meta(_meta: _Meta) = _meta(JsonField.of(_meta)) + + @JsonProperty("_meta") + @ExcludeMissing + fun _meta(_meta: JsonField<_Meta>) = apply { this._meta = _meta } + + fun items(items: List) = items(JsonField.of(items)) + + @JsonProperty("items") + @ExcludeMissing + fun items(items: JsonField>) = apply { this.items = items } + + 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(): ProjectInferencePipelineListResponse = + ProjectInferencePipelineListResponse( + _meta, + items.map { it.toUnmodifiable() }, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = _Meta.Builder::class) + @NoAutoDetect + class _Meta + private constructor( + private val page: JsonField, + private val perPage: JsonField, + private val totalItems: JsonField, + private val totalPages: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The current page. */ + fun page(): Long = page.getRequired("page") + + /** The number of items per page. */ + fun perPage(): Long = perPage.getRequired("perPage") + + /** The total number of items. */ + fun totalItems(): Long = totalItems.getRequired("totalItems") + + /** The total number of pages. */ + fun totalPages(): Long = totalPages.getRequired("totalPages") + + /** The current page. */ + @JsonProperty("page") @ExcludeMissing fun _page() = page + + /** The number of items per page. */ + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage + + /** The total number of items. */ + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems + + /** The total number of pages. */ + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): _Meta = apply { + if (!validated) { + page() + perPage() + totalItems() + totalPages() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is _Meta && + this.page == other.page && + this.perPage == other.perPage && + this.totalItems == other.totalItems && + this.totalPages == other.totalPages && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + page, + perPage, + totalItems, + totalPages, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var page: JsonField = JsonMissing.of() + private var perPage: JsonField = JsonMissing.of() + private var totalItems: JsonField = JsonMissing.of() + private var totalPages: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(_meta: _Meta) = apply { + this.page = _meta.page + this.perPage = _meta.perPage + this.totalItems = _meta.totalItems + this.totalPages = _meta.totalPages + additionalProperties(_meta.additionalProperties) + } + + /** The current page. */ + fun page(page: Long) = page(JsonField.of(page)) + + /** The current page. */ + @JsonProperty("page") + @ExcludeMissing + fun page(page: JsonField) = apply { this.page = page } + + /** The number of items per page. */ + fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) + + /** The number of items per page. */ + @JsonProperty("perPage") + @ExcludeMissing + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } + + /** The total number of items. */ + fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) + + /** The total number of items. */ + @JsonProperty("totalItems") + @ExcludeMissing + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } + + /** The total number of pages. */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** The total number of pages. */ + @JsonProperty("totalPages") + @ExcludeMissing + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } + + 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(): _Meta = + _Meta( + page, + perPage, + totalItems, + totalPages, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + private constructor( + private val id: JsonField, + private val projectId: JsonField, + private val name: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val dateLastSampleReceived: JsonField, + private val description: JsonField, + private val dateLastEvaluated: JsonField, + private val dateOfNextEvaluation: JsonField, + private val passingGoalCount: JsonField, + private val failingGoalCount: JsonField, + private val totalGoalCount: JsonField, + private val status: JsonField, + private val statusMessage: JsonField, + private val links: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The inference pipeline id. */ + fun id(): String = id.getRequired("id") + + /** The project id. */ + fun projectId(): String = projectId.getRequired("projectId") + + /** The inference pipeline name. */ + fun name(): String = name.getRequired("name") + + /** The creation date. */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** The last updated date. */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** The last data sample received date. */ + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + + /** The inference pipeline description. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** The last test evaluation date. */ + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + + /** The number of tests passing. */ + fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") + + /** The number of tests failing. */ + fun failingGoalCount(): Long = failingGoalCount.getRequired("failingGoalCount") + + /** The total number of tests. */ + fun totalGoalCount(): Long = totalGoalCount.getRequired("totalGoalCount") + + /** The status of test evaluation for the inference pipeline. */ + fun status(): Status = status.getRequired("status") + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) + + fun links(): Links = links.getRequired("links") + + /** The inference pipeline id. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The project id. */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId + + /** The inference pipeline name. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The creation date. */ + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated + + /** The last updated date. */ + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated + + /** The last data sample received date. */ + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun _dateLastSampleReceived() = dateLastSampleReceived + + /** The inference pipeline description. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description + + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated() = dateLastEvaluated + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation() = dateOfNextEvaluation + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage + + @JsonProperty("links") @ExcludeMissing fun _links() = links + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + projectId() + name() + dateCreated() + dateUpdated() + dateLastSampleReceived() + description() + dateLastEvaluated() + dateOfNextEvaluation() + passingGoalCount() + failingGoalCount() + totalGoalCount() + status() + statusMessage() + links().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.projectId == other.projectId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.dateLastSampleReceived == other.dateLastSampleReceived && + this.description == other.description && + this.dateLastEvaluated == other.dateLastEvaluated && + this.dateOfNextEvaluation == other.dateOfNextEvaluation && + this.passingGoalCount == other.passingGoalCount && + this.failingGoalCount == other.failingGoalCount && + this.totalGoalCount == other.totalGoalCount && + this.status == other.status && + this.statusMessage == other.statusMessage && + this.links == other.links && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Item{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var dateLastSampleReceived: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var passingGoalCount: JsonField = JsonMissing.of() + private var failingGoalCount: JsonField = JsonMissing.of() + private var totalGoalCount: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var links: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + this.id = item.id + this.projectId = item.projectId + this.name = item.name + this.dateCreated = item.dateCreated + this.dateUpdated = item.dateUpdated + this.dateLastSampleReceived = item.dateLastSampleReceived + this.description = item.description + this.dateLastEvaluated = item.dateLastEvaluated + this.dateOfNextEvaluation = item.dateOfNextEvaluation + this.passingGoalCount = item.passingGoalCount + this.failingGoalCount = item.failingGoalCount + this.totalGoalCount = item.totalGoalCount + this.status = item.status + this.statusMessage = item.statusMessage + this.links = item.links + additionalProperties(item.additionalProperties) + } + + /** The inference pipeline id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** The inference pipeline id. */ + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + /** 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 inference pipeline name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The inference pipeline name. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** The creation date. */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** The last updated date. */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The last data sample received date. */ + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = + dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + + /** The last data sample received date. */ + @JsonProperty("dateLastSampleReceived") + @ExcludeMissing + fun dateLastSampleReceived(dateLastSampleReceived: JsonField) = apply { + this.dateLastSampleReceived = dateLastSampleReceived + } + + /** The inference pipeline description. */ + fun description(description: String) = description(JsonField.of(description)) + + /** The inference pipeline description. */ + @JsonProperty("description") + @ExcludeMissing + fun description(description: JsonField) = apply { + this.description = description + } + + /** The last test evaluation date. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = + dateLastEvaluated(JsonField.of(dateLastEvaluated)) + + /** The last test evaluation date. */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** The next test evaluation date. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + + /** The next test evaluation date. */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** The number of tests passing. */ + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) + + /** The number of tests passing. */ + @JsonProperty("passingGoalCount") + @ExcludeMissing + fun passingGoalCount(passingGoalCount: JsonField) = apply { + this.passingGoalCount = passingGoalCount + } + + /** The number of tests failing. */ + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) + + /** The number of tests failing. */ + @JsonProperty("failingGoalCount") + @ExcludeMissing + fun failingGoalCount(failingGoalCount: JsonField) = apply { + this.failingGoalCount = failingGoalCount + } + + /** The total number of tests. */ + fun totalGoalCount(totalGoalCount: Long) = totalGoalCount(JsonField.of(totalGoalCount)) + + /** The total number of tests. */ + @JsonProperty("totalGoalCount") + @ExcludeMissing + fun totalGoalCount(totalGoalCount: JsonField) = apply { + this.totalGoalCount = totalGoalCount + } + + /** The status of test evaluation for the inference pipeline. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of test evaluation for the inference pipeline. */ + @JsonProperty("status") + @ExcludeMissing + fun status(status: JsonField) = apply { this.status = status } + + /** The status message of test evaluation for the inference pipeline. */ + fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) + + /** The status message of test evaluation for the inference pipeline. */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + 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(): Item = + Item( + id, + projectId, + name, + dateCreated, + dateUpdated, + dateLastSampleReceived, + description, + dateLastEvaluated, + dateOfNextEvaluation, + passingGoalCount, + failingGoalCount, + totalGoalCount, + status, + statusMessage, + links, + additionalProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Links.Builder::class) + @NoAutoDetect + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + 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) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + this.app == other.app && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + + 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()) + } + } + + 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 other is Status && this.value == other.value + } + + 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() + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt index 1eaf12d..dde3ea2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsync.kt @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.commits -interface TestResultServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse +import java.util.concurrent.CompletableFuture + +interface TestResultServiceAsync { + + /** List the test results for a project commit (project version). */ + @JvmOverloads + fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt index 49a793d..ac4c25f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/commits/TestResultServiceAsyncImpl.kt @@ -3,9 +3,17 @@ package com.openlayer.api.services.async.commits import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the test results for a project commit (project version). */ + override fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt index 2e301ea..26d5be9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsync.kt @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -interface DataServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse +import java.util.concurrent.CompletableFuture + +interface DataServiceAsync { + + /** Stream production data to an inference pipeline. */ + @JvmOverloads + fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt index 331f7d8..33d3bfc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/DataServiceAsyncImpl.kt @@ -3,9 +3,18 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl constructor( @@ -13,4 +22,35 @@ constructor( ) : DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Stream production data to an inference pipeline. */ + override fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt index 94500d8..5d526af 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsync.kt @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -interface TestResultServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse +import java.util.concurrent.CompletableFuture + +interface TestResultServiceAsync { + + /** List the latest test results for an inference pipeline. */ + @JvmOverloads + fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt index b167dc4..0b4305b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/TestResultServiceAsyncImpl.kt @@ -3,9 +3,17 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the latest test results for an inference pipeline. */ + override fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt index 7a39f1f..cc723f2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsync.kt @@ -4,4 +4,17 @@ package com.openlayer.api.services.async.projects -interface CommitServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse +import java.util.concurrent.CompletableFuture + +interface CommitServiceAsync { + + /** List the commits (project versions) in a project. */ + @JvmOverloads + fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt index 8963663..9fb60aa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/CommitServiceAsyncImpl.kt @@ -3,9 +3,17 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the commits (project versions) in a project. */ + override fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt index 39d03aa..a0a6c63 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsync.kt @@ -4,4 +4,26 @@ package com.openlayer.api.services.async.projects -interface InferencePipelineServiceAsync +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.ProjectInferencePipelineListResponse +import java.util.concurrent.CompletableFuture + +interface InferencePipelineServiceAsync { + + /** Create an inference pipeline in a project. */ + @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** List the inference pipelines in a project. */ + @JvmOverloads + fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt index 77cb45d..262589d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/projects/InferencePipelineServiceAsyncImpl.kt @@ -3,9 +3,20 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.ProjectInferencePipelineListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl constructor( @@ -13,4 +24,65 @@ constructor( ) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Create an inference pipeline in a project. */ + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the inference pipelines in a project. */ + override fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt index 6f22d7a..5ad32ef 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultService.kt @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.commits -interface TestResultService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse + +interface TestResultService { + + /** List the test results for a project commit (project version). */ + @JvmOverloads + fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CommitTestResultListResponse +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt index fa049ad..01739b4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceImpl.kt @@ -3,9 +3,16 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( @@ -13,4 +20,33 @@ constructor( ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the test results for a project commit (project version). */ + override fun list( + params: CommitTestResultListParams, + requestOptions: RequestOptions + ): CommitTestResultListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("versions", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt index be45c79..e165559 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataService.kt @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -interface DataService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse + +interface DataService { + + /** Stream production data to an inference pipeline. */ + @JvmOverloads + fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions = RequestOptions.none() + ): InferencePipelineDataStreamResponse +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt index 0729faa..34cc6ce 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceImpl.kt @@ -3,9 +3,17 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineDataStreamParams +import com.openlayer.api.models.InferencePipelineDataStreamResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class DataServiceImpl constructor( @@ -13,4 +21,34 @@ constructor( ) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val streamHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Stream production data to an inference pipeline. */ + override fun stream( + params: InferencePipelineDataStreamParams, + requestOptions: RequestOptions + ): InferencePipelineDataStreamResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("inference-pipelines", params.getPathParam(0), "data-stream") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { streamHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt index 909a068..24e0ca5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultService.kt @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -interface TestResultService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse + +interface TestResultService { + + /** List the latest test results for an inference pipeline. */ + @JvmOverloads + fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): InferencePipelineTestResultListResponse +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt index 7deba57..675b14f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceImpl.kt @@ -3,9 +3,16 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( @@ -13,4 +20,33 @@ constructor( ) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the latest test results for an inference pipeline. */ + override fun list( + params: InferencePipelineTestResultListParams, + requestOptions: RequestOptions + ): InferencePipelineTestResultListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("inference-pipelines", params.getPathParam(0), "results") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt index c16b4ca..c9fb11e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitService.kt @@ -4,4 +4,16 @@ package com.openlayer.api.services.blocking.projects -interface CommitService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse + +interface CommitService { + + /** List the commits (project versions) in a project. */ + @JvmOverloads + fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectCommitListResponse +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt index 0a54d59..6cb0342 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceImpl.kt @@ -3,9 +3,16 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class CommitServiceImpl constructor( @@ -13,4 +20,33 @@ constructor( ) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the commits (project versions) in a project. */ + override fun list( + params: ProjectCommitListParams, + requestOptions: RequestOptions + ): ProjectCommitListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "versions") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt index e1f61c9..93989fb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineService.kt @@ -4,4 +4,25 @@ package com.openlayer.api.services.blocking.projects -interface InferencePipelineService +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.ProjectInferencePipelineListResponse + +interface InferencePipelineService { + + /** Create an inference pipeline in a project. */ + @JvmOverloads + fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectInferencePipelineCreateResponse + + /** List the inference pipelines in a project. */ + @JvmOverloads + fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectInferencePipelineListResponse +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt index 3b4bc5d..cb8655e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceImpl.kt @@ -3,9 +3,19 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.models.ProjectInferencePipelineCreateParams +import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +import com.openlayer.api.models.ProjectInferencePipelineListParams +import com.openlayer.api.models.ProjectInferencePipelineListResponse import com.openlayer.api.services.errorHandler +import com.openlayer.api.services.json +import com.openlayer.api.services.jsonHandler +import com.openlayer.api.services.withErrorHandler class InferencePipelineServiceImpl constructor( @@ -13,4 +23,63 @@ constructor( ) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Create an inference pipeline in a project. */ + override fun create( + params: ProjectInferencePipelineCreateParams, + requestOptions: RequestOptions + ): ProjectInferencePipelineCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** List the inference pipelines in a project. */ + override fun list( + params: ProjectInferencePipelineListParams, + requestOptions: RequestOptions + ): ProjectInferencePipelineListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects", params.getPathParam(0), "inference-pipelines") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt new file mode 100644 index 0000000..a011d78 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListParamsTest.kt @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class CommitTestResultListParamsTest { + + @Test + fun createCommitTestResultListParams() { + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + } + + @Test + fun getQueryParams() { + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("includeArchived", listOf("true")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("status", listOf(CommitTestResultListParams.Status.RUNNING.toString())) + expected.put("type", listOf(CommitTestResultListParams.Type.INTEGRITY.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(params).isNotNull + // path param "projectVersionId" + 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/CommitTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt new file mode 100644 index 0000000..05c6717 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/CommitTestResultListResponseTest.kt @@ -0,0 +1,161 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class CommitTestResultListResponseTest { + + @Test + fun createCommitTestResultListResponse() { + val commitTestResultListResponse = + CommitTestResultListResponse.builder() + ._meta( + CommitTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .items( + listOf( + CommitTestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitTestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + CommitTestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(123L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .number(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + CommitTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + CommitTestResultListResponse.Item.Goal.Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + ) + .build() + assertThat(commitTestResultListResponse).isNotNull + assertThat(commitTestResultListResponse._meta()) + .isEqualTo( + CommitTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(commitTestResultListResponse.items()) + .containsExactly( + CommitTestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(CommitTestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + CommitTestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(123L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .number(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + CommitTestResultListResponse.Item.Goal.Threshold.builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + CommitTestResultListResponse.Item.Goal.Threshold.Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt new file mode 100644 index 0000000..de558c5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParamsTest.kt @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineDataStreamParamsTest { + + @Test + fun createInferencePipelineDataStreamParams() { + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + } + + @Test + fun getBody() { + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()) + .isEqualTo( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt.builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + assertThat(body.rows()) + .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.config()) + .isEqualTo( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + assertThat(body.rows()) + .isEqualTo(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + } + + @Test + fun getPathParam() { + val params = + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + assertThat(params).isNotNull + // path param "inferencePipelineId" + 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/InferencePipelineDataStreamResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt new file mode 100644 index 0000000..5d5c07f --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponseTest.kt @@ -0,0 +1,20 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineDataStreamResponseTest { + + @Test + fun createInferencePipelineDataStreamResponse() { + val inferencePipelineDataStreamResponse = + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) + .build() + assertThat(inferencePipelineDataStreamResponse).isNotNull + assertThat(inferencePipelineDataStreamResponse.success()) + .isEqualTo(InferencePipelineDataStreamResponse.Success.TRUE) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt new file mode 100644 index 0000000..6de2ac0 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParamsTest.kt @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineTestResultListParamsTest { + + @Test + fun createInferencePipelineTestResultListParams() { + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + } + + @Test + fun getQueryParams() { + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put( + "status", + listOf(InferencePipelineTestResultListParams.Status.RUNNING.toString()) + ) + expected.put( + "type", + listOf(InferencePipelineTestResultListParams.Type.INTEGRITY.toString()) + ) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(params).isNotNull + // path param "inferencePipelineId" + 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/InferencePipelineTestResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt new file mode 100644 index 0000000..d9eadbb --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponseTest.kt @@ -0,0 +1,167 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.core.JsonValue +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class InferencePipelineTestResultListResponseTest { + + @Test + fun createInferencePipelineTestResultListResponse() { + val inferencePipelineTestResultListResponse = + InferencePipelineTestResultListResponse.builder() + ._meta( + InferencePipelineTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .items( + listOf( + InferencePipelineTestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineTestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + InferencePipelineTestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(123L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .number(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + InferencePipelineTestResultListResponse.Item.Goal + .Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + InferencePipelineTestResultListResponse.Item + .Goal + .Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + ) + .build() + assertThat(inferencePipelineTestResultListResponse).isNotNull + assertThat(inferencePipelineTestResultListResponse._meta()) + .isEqualTo( + InferencePipelineTestResultListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(inferencePipelineTestResultListResponse.items()) + .containsExactly( + InferencePipelineTestResultListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataEnds(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateDataStarts(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .inferencePipelineId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .projectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(InferencePipelineTestResultListResponse.Item.Status.RUNNING) + .statusMessage("Test successfully processed.") + .goal( + InferencePipelineTestResultListResponse.Item.Goal.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commentCount(123L) + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description( + JsonValue.from( + "This test checks for duplicate rows in the dataset." + ) + ) + .name("No duplicate rows") + .number(123L) + .originProjectVersionId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .subtype("duplicateRowCount") + .suggested(true) + .thresholds( + listOf( + InferencePipelineTestResultListResponse.Item.Goal.Threshold + .builder() + .insightName("duplicateRowCount") + .insightParameters( + listOf(JsonValue.from(mapOf())) + ) + .measurement("duplicateRowCount") + .operator("<=") + .value( + InferencePipelineTestResultListResponse.Item.Goal + .Threshold + .Value + .ofDouble(42.23) + ) + .build() + ) + ) + .type("integrity") + .archived(true) + .delayWindow(42.23) + .evaluationWindow(42.23) + .usesMlModel(true) + .usesProductionData(true) + .usesReferenceDataset(true) + .usesTrainingDataset(true) + .usesValidationDataset(true) + .build() + ) + .goalId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt new file mode 100644 index 0000000..17d2e0a --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListParamsTest.kt @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectCommitListParamsTest { + + @Test + fun createProjectCommitListParams() { + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + } + + @Test + fun getQueryParams() { + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .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/ProjectCommitListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt new file mode 100644 index 0000000..72defbb --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCommitListResponseTest.kt @@ -0,0 +1,124 @@ +// 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 ProjectCommitListResponseTest { + + @Test + fun createProjectCommitListResponse() { + val projectCommitListResponse = + ProjectCommitListResponse.builder() + ._meta( + ProjectCommitListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .items( + listOf( + ProjectCommitListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + ProjectCommitListResponse.Item.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("string") + .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(ProjectCommitListResponse.Item.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( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + ) + .build() + assertThat(projectCommitListResponse).isNotNull + assertThat(projectCommitListResponse._meta()) + .isEqualTo( + ProjectCommitListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectCommitListResponse.items()) + .containsExactly( + ProjectCommitListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .commit( + ProjectCommitListResponse.Item.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("string") + .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(ProjectCommitListResponse.Item.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( + ProjectCommitListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .build() + ) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt new file mode 100644 index 0000000..0e96084 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParamsTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectInferencePipelineCreateParamsTest { + + @Test + fun createProjectInferencePipelineCreateParams() { + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() + } + + @Test + fun getBody() { + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.description()).isEqualTo("This pipeline is used for production.") + assertThat(body.name()).isEqualTo("production") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("production") + } + + @Test + fun getPathParam() { + val params = + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("production") + .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/ProjectInferencePipelineCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt new file mode 100644 index 0000000..2398c71 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponseTest.kt @@ -0,0 +1,71 @@ +// 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 ProjectInferencePipelineCreateResponseTest { + + @Test + fun createProjectInferencePipelineCreateResponse() { + val projectInferencePipelineCreateResponse = + ProjectInferencePipelineCreateResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(123L) + .links( + ProjectInferencePipelineCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineCreateResponse.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + assertThat(projectInferencePipelineCreateResponse).isNotNull + assertThat(projectInferencePipelineCreateResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateLastSampleReceived()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectInferencePipelineCreateResponse.description()) + .contains("This pipeline is used for production.") + assertThat(projectInferencePipelineCreateResponse.failingGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.links()) + .isEqualTo( + ProjectInferencePipelineCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(projectInferencePipelineCreateResponse.name()).isEqualTo("production") + assertThat(projectInferencePipelineCreateResponse.passingGoalCount()).isEqualTo(123L) + assertThat(projectInferencePipelineCreateResponse.projectId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectInferencePipelineCreateResponse.status()) + .isEqualTo(ProjectInferencePipelineCreateResponse.Status.QUEUED) + assertThat(projectInferencePipelineCreateResponse.statusMessage()) + .contains("Tests successfully evaluated") + assertThat(projectInferencePipelineCreateResponse.totalGoalCount()).isEqualTo(123L) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt new file mode 100644 index 0000000..170fc1b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParamsTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models + +import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectInferencePipelineListParamsTest { + + @Test + fun createProjectInferencePipelineListParams() { + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + } + + @Test + fun getQueryParams() { + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("string")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) + } + + @Test + fun getPathParam() { + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .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/ProjectInferencePipelineListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt new file mode 100644 index 0000000..37bb0ca --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponseTest.kt @@ -0,0 +1,92 @@ +// 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 ProjectInferencePipelineListResponseTest { + + @Test + fun createProjectInferencePipelineListResponse() { + val projectInferencePipelineListResponse = + ProjectInferencePipelineListResponse.builder() + ._meta( + ProjectInferencePipelineListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .items( + listOf( + ProjectInferencePipelineListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived( + OffsetDateTime.parse("2024-03-22T11:31:01.185Z") + ) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(123L) + .links( + ProjectInferencePipelineListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + ) + ) + .build() + assertThat(projectInferencePipelineListResponse).isNotNull + assertThat(projectInferencePipelineListResponse._meta()) + .isEqualTo( + ProjectInferencePipelineListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectInferencePipelineListResponse.items()) + .containsExactly( + ProjectInferencePipelineListResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastEvaluated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateLastSampleReceived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .description("This pipeline is used for production.") + .failingGoalCount(123L) + .links( + ProjectInferencePipelineListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6/inference-pipeline/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .name("production") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(ProjectInferencePipelineListResponse.Item.Status.QUEUED) + .statusMessage("Tests successfully evaluated") + .totalGoalCount(123L) + .build() + ) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt index 9b8edf9..4dfd4b0 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ErrorHandlingTest.kt @@ -16,6 +16,7 @@ import com.google.common.collect.ListMultimap import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.core.JsonString +import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper import com.openlayer.api.errors.BadRequestException import com.openlayer.api.errors.InternalServerException @@ -28,7 +29,6 @@ import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException import com.openlayer.api.models.* -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.assertj.core.api.InstanceOfAssertFactories @@ -56,99 +56,81 @@ class ErrorHandlingTest { } @Test - fun projectsCreate200() { + fun dataStream200() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() val expected = - ProjectCreateResponse.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectCreateResponse.Source.WEB) - .taskType(ProjectCreateResponse.TaskType.LLM_BASE) - .versionCount(123L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .description("My project description.") - .gitRepo( - ProjectCreateResponse.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) .build() stubFor(post(anyUrl()).willReturn(ok().withBody(toJson(expected)))) - assertThat(client.projects().create(params)).isEqualTo(expected) + assertThat(client.inferencePipelines().data().stream(params)).isEqualTo(expected) } @Test - fun projectsCreate400() { + fun dataStream400() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -156,35 +138,44 @@ class ErrorHandlingTest { .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate401() { + fun dataStream401() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -192,35 +183,44 @@ class ErrorHandlingTest { .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertUnauthorized(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate403() { + fun dataStream403() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -228,35 +228,44 @@ class ErrorHandlingTest { .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate404() { + fun dataStream404() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -264,35 +273,44 @@ class ErrorHandlingTest { .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate422() { + fun dataStream422() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -300,7 +318,7 @@ class ErrorHandlingTest { .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertUnprocessableEntity( e, @@ -311,28 +329,37 @@ class ErrorHandlingTest { } @Test - fun projectsCreate429() { + fun dataStream429() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -340,35 +367,44 @@ class ErrorHandlingTest { .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) } @Test - fun projectsCreate500() { + fun dataStream500() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -376,7 +412,7 @@ class ErrorHandlingTest { .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) @@ -385,26 +421,35 @@ class ErrorHandlingTest { @Test fun unexpectedStatusCode() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor( @@ -412,7 +457,7 @@ class ErrorHandlingTest { .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) ) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertUnexpectedStatusCodeException( e, @@ -426,31 +471,40 @@ class ErrorHandlingTest { @Test fun invalidBody() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor(post(anyUrl()).willReturn(status(200).withBody("Not JSON"))) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertThat(e) .isInstanceOf(OpenlayerException::class.java) @@ -461,31 +515,40 @@ class ErrorHandlingTest { @Test fun invalidErrorBody() { val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .build() stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) - assertThatThrownBy({ client.projects().create(params) }) + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) }) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt index 170e43e..4378175 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/ServiceParamsTest.kt @@ -21,7 +21,6 @@ import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper import com.openlayer.api.models.* -import java.time.OffsetDateTime import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -42,7 +41,7 @@ class ServiceParamsTest { } @Test - fun projectsCreateWithAdditionalParams() { + fun dataStreamWithAdditionalParams() { val additionalHeaders = mutableMapOf>() additionalHeaders.put("x-test-header", listOf("abc1234")) @@ -56,70 +55,43 @@ class ServiceParamsTest { additionalBodyProperties.put("testBodyProperty", JsonString.of("ghi890")) val params = - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .gitRepo( - ProjectCreateParams.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) .additionalHeaders(additionalHeaders) .additionalBodyProperties(additionalBodyProperties) .additionalQueryParams(additionalQueryParams) .build() val apiResponse = - ProjectCreateResponse.builder() - .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .developmentGoalCount(123L) - .goalCount(123L) - .inferencePipelineCount(123L) - .links( - ProjectCreateResponse.Links.builder() - .app( - "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" - ) - .build() - ) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectCreateResponse.Source.WEB) - .taskType(ProjectCreateResponse.TaskType.LLM_BASE) - .versionCount(123L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .description("My project description.") - .gitRepo( - ProjectCreateResponse.GitRepo.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .gitId(123L) - .name("string") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("string") - .url("string") - .branch("string") - .rootDir("string") - .build() - ) + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) .build() stubFor( @@ -130,7 +102,7 @@ class ServiceParamsTest { .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) ) - client.projects().create(params) + client.inferencePipelines().data().stream(params) verify(postRequestedFor(anyUrl())) } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt index 752695d..1f87370 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/commits/TestResultServiceTest.kt @@ -3,7 +3,34 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class TestResultServiceTest +@ExtendWith(TestServerExtension::class) +class TestResultServiceTest { + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.commits().testResults() + val commitTestResultListResponse = + testResultService.list( + CommitTestResultListParams.builder() + .projectVersionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeArchived(true) + .page(123L) + .perPage(100L) + .status(CommitTestResultListParams.Status.RUNNING) + .type(CommitTestResultListParams.Type.INTEGRITY) + .build() + ) + println(commitTestResultListResponse) + commitTestResultListResponse.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt index b8c0866..0b70b54 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/DataServiceTest.kt @@ -3,7 +3,57 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonValue import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class DataServiceTest +@ExtendWith(TestServerExtension::class) +class DataServiceTest { + + @Test + fun callStream() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val dataService = client.inferencePipelines().data() + val inferencePipelineDataStreamResponse = + dataService.stream( + InferencePipelineDataStreamParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .config( + InferencePipelineDataStreamParams.Config.ofLlmData( + InferencePipelineDataStreamParams.Config.LlmData.builder() + .outputColumnName("output") + .contextColumnName("context") + .costColumnName("cost") + .groundTruthColumnName("ground_truth") + .inferenceIdColumnName("id") + .inputVariableNames(listOf("string")) + .latencyColumnName("latency") + .metadata(JsonValue.from(mapOf())) + .numOfTokenColumnName("num_tokens") + .prompt( + listOf( + InferencePipelineDataStreamParams.Config.LlmData.Prompt + .builder() + .content("{{ user_query }}") + .role("user") + .build() + ) + ) + .questionColumnName("question") + .timestampColumnName("timestamp") + .build() + ) + ) + .rows(listOf(InferencePipelineDataStreamParams.Row.builder().build())) + .build() + ) + println(inferencePipelineDataStreamResponse) + inferencePipelineDataStreamResponse.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt index f9bdd02..67a11f1 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/TestResultServiceTest.kt @@ -3,7 +3,33 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class TestResultServiceTest +@ExtendWith(TestServerExtension::class) +class TestResultServiceTest { + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val testResultService = client.inferencePipelines().testResults() + val inferencePipelineTestResultListResponse = + testResultService.list( + InferencePipelineTestResultListParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .status(InferencePipelineTestResultListParams.Status.RUNNING) + .type(InferencePipelineTestResultListParams.Type.INTEGRITY) + .build() + ) + println(inferencePipelineTestResultListResponse) + inferencePipelineTestResultListResponse.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt index 231f03f..83a9c12 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/CommitServiceTest.kt @@ -3,7 +3,31 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class CommitServiceTest +@ExtendWith(TestServerExtension::class) +class CommitServiceTest { + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val commitService = client.projects().commits() + val projectCommitListResponse = + commitService.list( + ProjectCommitListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(123L) + .perPage(100L) + .build() + ) + println(projectCommitListResponse) + projectCommitListResponse.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt index 778a046..5ee7b4e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/projects/InferencePipelineServiceTest.kt @@ -3,7 +3,52 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.* +import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest +@ExtendWith(TestServerExtension::class) +class InferencePipelineServiceTest { + + @Test + fun callCreate() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineCreateResponse = + inferencePipelineService.create( + ProjectInferencePipelineCreateParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("This pipeline is used for production.") + .name("production") + .build() + ) + println(projectInferencePipelineCreateResponse) + projectInferencePipelineCreateResponse.validate() + } + + @Test + fun callList() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val inferencePipelineService = client.projects().inferencePipelines() + val projectInferencePipelineListResponse = + inferencePipelineService.list( + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("string") + .page(123L) + .perPage(100L) + .build() + ) + println(projectInferencePipelineListResponse) + projectInferencePipelineListResponse.validate() + } +}