diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt index 841664d..13779b0 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OkHttpClient.kt @@ -4,28 +4,27 @@ import com.google.common.collect.ListMultimap import com.google.common.collect.MultimapBuilder import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpRequestBody import com.openlayer.api.core.http.HttpResponse -import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.io.InputStream import java.net.Proxy import java.time.Duration import java.util.concurrent.CompletableFuture -import java.util.concurrent.TimeUnit import okhttp3.Call import okhttp3.Callback -import okhttp3.HttpUrl -import okhttp3.Response -import okhttp3.Request -import okhttp3.RequestBody -import okhttp3.MediaType import okhttp3.Headers +import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaType +import okhttp3.Request +import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.Response import okio.BufferedSink class OkHttpClient @@ -34,7 +33,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient { val timeout = requestOptions.timeout ?: return okHttpClient - return okHttpClient.newBuilder() + return okHttpClient + .newBuilder() .connectTimeout(timeout) .readTimeout(timeout) .writeTimeout(timeout) @@ -76,7 +76,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val override fun onFailure(call: Call, e: IOException) { future.completeExceptionally(OpenlayerIoException("Request failed", e)) } - }) + } + ) return future } diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt index 59c6cec..1dff803 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClient.kt @@ -3,25 +3,20 @@ package com.openlayer.api.client.okhttp import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.Multimap +import com.openlayer.api.client.OpenlayerClient +import com.openlayer.api.client.OpenlayerClientImpl +import com.openlayer.api.core.ClientOptions import java.net.Proxy import java.time.Clock import java.time.Duration -import java.util.Optional -import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpClient -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.OpenlayerClientImpl class OpenlayerOkHttpClient private constructor() { companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() - @JvmStatic - fun fromEnv(): OpenlayerClient = builder().fromEnv().build() + @JvmStatic fun fromEnv(): OpenlayerClient = builder().fromEnv().build() } class Builder { @@ -37,21 +32,15 @@ class OpenlayerOkHttpClient private constructor() { this.baseUrl = baseUrl } - fun jsonMapper(jsonMapper: JsonMapper) = apply { - clientOptions.jsonMapper(jsonMapper) - } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } - fun clock(clock: Clock) = apply { - clientOptions.clock(clock) - } + fun clock(clock: Clock) = apply { clientOptions.clock(clock) } fun headers(headers: Map>) = apply { clientOptions.headers(headers) } - fun putHeader(name: String, value: String) = apply { - clientOptions.putHeader(name, value) - } + fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) } fun putHeaders(name: String, values: Iterable) = apply { clientOptions.putHeaders(name, values) @@ -61,42 +50,34 @@ class OpenlayerOkHttpClient private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { - clientOptions.removeHeader(name) - } + fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } - fun timeout(timeout: Duration) = apply { - this.timeout = timeout - } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } - fun maxRetries(maxRetries: Int) = apply { - clientOptions.maxRetries(maxRetries) - } + fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } - fun proxy(proxy: Proxy) = apply { - this.proxy = proxy - } + fun proxy(proxy: Proxy) = apply { this.proxy = proxy } fun responseValidation(responseValidation: Boolean) = apply { clientOptions.responseValidation(responseValidation) } - fun apiKey(apiKey: String?) = apply { - clientOptions.apiKey(apiKey) - } + fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } - fun fromEnv() = apply { - clientOptions.fromEnv() - } + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): OpenlayerClient { - return OpenlayerClientImpl(clientOptions - .httpClient(OkHttpClient.builder() - .baseUrl(baseUrl) - .timeout(timeout) - .proxy(proxy) - .build()) - .build()) + return OpenlayerClientImpl( + clientOptions + .httpClient( + OkHttpClient.builder() + .baseUrl(baseUrl) + .timeout(timeout) + .proxy(proxy) + .build() + ) + .build() + ) } } } diff --git a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt index ec87b53..0866f95 100644 --- a/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt +++ b/openlayer-java-client-okhttp/src/main/kotlin/com/openlayer/api/client/okhttp/OpenlayerOkHttpClientAsync.kt @@ -3,25 +3,20 @@ package com.openlayer.api.client.okhttp import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.Multimap +import com.openlayer.api.client.OpenlayerClientAsync +import com.openlayer.api.client.OpenlayerClientAsyncImpl +import com.openlayer.api.core.ClientOptions import java.net.Proxy import java.time.Clock import java.time.Duration -import java.util.Optional -import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpClient -import com.openlayer.api.client.OpenlayerClientAsync -import com.openlayer.api.client.OpenlayerClientAsyncImpl class OpenlayerOkHttpClientAsync private constructor() { companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() - @JvmStatic - fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() + @JvmStatic fun fromEnv(): OpenlayerClientAsync = builder().fromEnv().build() } class Builder { @@ -37,21 +32,15 @@ class OpenlayerOkHttpClientAsync private constructor() { this.baseUrl = baseUrl } - fun jsonMapper(jsonMapper: JsonMapper) = apply { - clientOptions.jsonMapper(jsonMapper) - } + fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } - fun clock(clock: Clock) = apply { - clientOptions.clock(clock) - } + fun clock(clock: Clock) = apply { clientOptions.clock(clock) } fun headers(headers: Map>) = apply { clientOptions.headers(headers) } - fun putHeader(name: String, value: String) = apply { - clientOptions.putHeader(name, value) - } + fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) } fun putHeaders(name: String, values: Iterable) = apply { clientOptions.putHeaders(name, values) @@ -61,42 +50,34 @@ class OpenlayerOkHttpClientAsync private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { - clientOptions.removeHeader(name) - } + fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } - fun timeout(timeout: Duration) = apply { - this.timeout = timeout - } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } - fun maxRetries(maxRetries: Int) = apply { - clientOptions.maxRetries(maxRetries) - } + fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } - fun proxy(proxy: Proxy) = apply { - this.proxy = proxy - } + fun proxy(proxy: Proxy) = apply { this.proxy = proxy } fun responseValidation(responseValidation: Boolean) = apply { clientOptions.responseValidation(responseValidation) } - fun apiKey(apiKey: String?) = apply { - clientOptions.apiKey(apiKey) - } + fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } - fun fromEnv() = apply { - clientOptions.fromEnv() - } + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): OpenlayerClientAsync { - return OpenlayerClientAsyncImpl(clientOptions - .httpClient(OkHttpClient.builder() - .baseUrl(baseUrl) - .timeout(timeout) - .proxy(proxy) - .build()) - .build()) + return OpenlayerClientAsyncImpl( + clientOptions + .httpClient( + OkHttpClient.builder() + .baseUrl(baseUrl) + .timeout(timeout) + .proxy(proxy) + .build() + ) + .build() + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index 95dd8b6..3a24286 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -4,27 +4,8 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture -import com.openlayer.api.core.ClientOptions -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.core.JsonField -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface OpenlayerClient { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index f233b6c..7d8847c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -4,27 +4,8 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture -import com.openlayer.api.core.ClientOptions -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.core.JsonField -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.async.* -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface OpenlayerClientAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index e53190b..d3c13ec 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -2,29 +2,17 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture import com.openlayer.api.core.ClientOptions -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.core.JsonField -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.async.* -import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler -class OpenlayerClientAsyncImpl constructor(private val clientOptions: ClientOptions, ) : OpenlayerClientAsync { +class OpenlayerClientAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : OpenlayerClientAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +22,9 @@ class OpenlayerClientAsyncImpl constructor(private val clientOptions: ClientOpti private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - private val inferencePipelines: InferencePipelineServiceAsync by lazy { InferencePipelineServiceAsyncImpl(clientOptions) } + private val inferencePipelines: InferencePipelineServiceAsync by lazy { + InferencePipelineServiceAsyncImpl(clientOptions) + } private val storage: StorageServiceAsync by lazy { StorageServiceAsyncImpl(clientOptions) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index 2a97eb1..29a6187 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -2,29 +2,17 @@ package com.openlayer.api.client -import java.time.Duration -import java.util.Base64 -import java.util.Optional -import java.util.concurrent.CompletableFuture import com.openlayer.api.core.ClientOptions -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.core.JsonField -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* -import com.openlayer.api.services.emptyHandler import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler -class OpenlayerClientImpl constructor(private val clientOptions: ClientOptions, ) : OpenlayerClient { +class OpenlayerClientImpl +constructor( + private val clientOptions: ClientOptions, +) : OpenlayerClient { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +22,9 @@ class OpenlayerClientImpl constructor(private val clientOptions: ClientOptions, private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - private val inferencePipelines: InferencePipelineService by lazy { InferencePipelineServiceImpl(clientOptions) } + private val inferencePipelines: InferencePipelineService by lazy { + InferencePipelineServiceImpl(clientOptions) + } private val storage: StorageService by lazy { StorageServiceImpl(clientOptions) } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt index 4a98458..0573e16 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/BaseDeserializer.kt @@ -13,9 +13,13 @@ import com.fasterxml.jackson.databind.deser.ContextualDeserializer import com.fasterxml.jackson.databind.deser.std.StdDeserializer import kotlin.reflect.KClass -abstract class BaseDeserializer(type: KClass) : StdDeserializer(type.java), ContextualDeserializer { +abstract class BaseDeserializer(type: KClass) : + StdDeserializer(type.java), ContextualDeserializer { - override fun createContextual(context: DeserializationContext, property: BeanProperty?): JsonDeserializer { + override fun createContextual( + context: DeserializationContext, + property: BeanProperty? + ): JsonDeserializer { return this } @@ -25,7 +29,11 @@ abstract class BaseDeserializer(type: KClass) : StdDeserializer(t protected abstract fun ObjectCodec.deserialize(node: JsonNode): T - protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: TypeReference, validate: (T) -> Unit = {}): T? { + protected fun ObjectCodec.tryDeserialize( + node: JsonNode, + type: TypeReference, + validate: (T) -> Unit = {} + ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) } catch (e: JsonMappingException) { @@ -35,7 +43,11 @@ abstract class BaseDeserializer(type: KClass) : StdDeserializer(t } } - protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: JavaType, validate: (T) -> Unit = {}): T? { + protected fun ObjectCodec.tryDeserialize( + node: JsonNode, + type: JavaType, + validate: (T) -> Unit = {} + ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) } catch (e: JsonMappingException) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt index b3082ae..ed353b4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/ClientOptions.kt @@ -3,35 +3,31 @@ package com.openlayer.api.core import com.fasterxml.jackson.databind.json.JsonMapper -import com.google.common.collect.Multimap -import com.google.common.collect.ListMultimap import com.google.common.collect.ArrayListMultimap -import java.time.Clock -import java.util.Base64 +import com.google.common.collect.ListMultimap import com.openlayer.api.core.http.HttpClient import com.openlayer.api.core.http.RetryingHttpClient +import java.time.Clock -class ClientOptions private constructor( - @get:JvmName("httpClient") val httpClient: HttpClient, - @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, - @get:JvmName("clock") val clock: Clock, - @get:JvmName("baseUrl") val baseUrl: String, - @get:JvmName("apiKey") val apiKey: String?, - @get:JvmName("headers") val headers: ListMultimap, - @get:JvmName("queryParams") val queryParams: ListMultimap, - @get:JvmName("responseValidation") val responseValidation: Boolean, - +class ClientOptions +private constructor( + @get:JvmName("httpClient") val httpClient: HttpClient, + @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, + @get:JvmName("clock") val clock: Clock, + @get:JvmName("baseUrl") val baseUrl: String, + @get:JvmName("apiKey") val apiKey: String?, + @get:JvmName("headers") val headers: ListMultimap, + @get:JvmName("queryParams") val queryParams: ListMultimap, + @get:JvmName("responseValidation") val responseValidation: Boolean, ) { companion object { const val PRODUCTION_URL = "https://api.openlayer.com/v1" - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() - @JvmStatic - fun fromEnv(): ClientOptions = builder().fromEnv().build() + @JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build() } class Builder { @@ -46,21 +42,13 @@ class ClientOptions private constructor( private var maxRetries: Int = 2 private var apiKey: String? = null - fun httpClient(httpClient: HttpClient) = apply { - this.httpClient = httpClient - } + fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } - fun jsonMapper(jsonMapper: JsonMapper) = apply { - this.jsonMapper = jsonMapper - } + fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } - fun baseUrl(baseUrl: String) = apply { - this.baseUrl = baseUrl - } + fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } - fun clock(clock: Clock) = apply { - this.clock = clock - } + fun clock(clock: Clock) = apply { this.clock = clock } fun headers(headers: Map>) = apply { this.headers.clear() @@ -79,9 +67,7 @@ class ClientOptions private constructor( headers.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.headers.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.headers.put(name, mutableListOf()) } fun queryParams(queryParams: Map>) = apply { this.queryParams.clear() @@ -100,61 +86,49 @@ class ClientOptions private constructor( queryParams.forEach(this::putQueryParams) } - fun removeQueryParam(name: String) = apply { - this.queryParams.put(name, mutableListOf()) - } + fun removeQueryParam(name: String) = apply { this.queryParams.put(name, mutableListOf()) } fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } - fun maxRetries(maxRetries: Int) = apply { - this.maxRetries = maxRetries - } + fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } - fun apiKey(apiKey: String?) = apply { - this.apiKey = apiKey - } + fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } - fun fromEnv() = apply { - System.getenv("OPENLAYER_API_KEY")?.let { - apiKey(it) - } - } + fun fromEnv() = apply { System.getenv("OPENLAYER_API_KEY")?.let { apiKey(it) } } fun build(): ClientOptions { - checkNotNull(httpClient) { - "`httpClient` is required but was not set" - } - - val headers = ArrayListMultimap.create() - val queryParams = ArrayListMultimap.create() - headers.put("X-Stainless-Lang", "java") - headers.put("X-Stainless-Arch", getOsArch()) - headers.put("X-Stainless-OS", getOsName()) - headers.put("X-Stainless-OS-Version", getOsVersion()) - headers.put("X-Stainless-Package-Version", getPackageVersion()) - headers.put("X-Stainless-Runtime-Version", getJavaVersion()) - if (!apiKey.isNullOrEmpty()) { - headers.put("Authorization", "Bearer ${apiKey}") - } - this.headers.forEach(headers::replaceValues) - this.queryParams.forEach(queryParams::replaceValues) - - return ClientOptions( - RetryingHttpClient.builder() - .httpClient(httpClient!!) - .clock(clock) - .maxRetries(maxRetries) - .build(), - jsonMapper ?: jsonMapper(), - clock, - baseUrl, - apiKey, - headers.toUnmodifiable(), - queryParams.toUnmodifiable(), - responseValidation, - ) + checkNotNull(httpClient) { "`httpClient` is required but was not set" } + + val headers = ArrayListMultimap.create() + val queryParams = ArrayListMultimap.create() + headers.put("X-Stainless-Lang", "java") + headers.put("X-Stainless-Arch", getOsArch()) + headers.put("X-Stainless-OS", getOsName()) + headers.put("X-Stainless-OS-Version", getOsVersion()) + headers.put("X-Stainless-Package-Version", getPackageVersion()) + headers.put("X-Stainless-Runtime-Version", getJavaVersion()) + if (!apiKey.isNullOrEmpty()) { + headers.put("Authorization", "Bearer ${apiKey}") + } + this.headers.forEach(headers::replaceValues) + this.queryParams.forEach(queryParams::replaceValues) + + return ClientOptions( + RetryingHttpClient.builder() + .httpClient(httpClient!!) + .clock(clock) + .maxRetries(maxRetries) + .build(), + jsonMapper ?: jsonMapper(), + clock, + baseUrl, + apiKey, + headers.toUnmodifiable(), + queryParams.toUnmodifiable(), + responseValidation, + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt index 505acea..bc0d02a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Properties.kt @@ -9,9 +9,12 @@ fun getOsArch(): String { return when (osArch) { null -> "unknown" - "i386", "x32", "x86" -> "x32" - "amd64", "x86_64" -> "x64" - "arm"-> "arm" + "i386", + "x32", + "x86" -> "x32" + "amd64", + "x86_64" -> "x64" + "arm" -> "arm" "aarch64" -> "arm64" else -> "other:${osArch}" } @@ -36,7 +39,7 @@ fun getOsVersion(): String { } fun getPackageVersion(): String { - return Properties::class.java.`package`.implementationVersion ?: "unknown"; + return Properties::class.java.`package`.implementationVersion ?: "unknown" } fun getJavaVersion(): String { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt index 0752435..2b862a3 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/RequestOptions.kt @@ -31,9 +31,7 @@ private constructor( this.responseValidation = responseValidation } - fun timeout(timeout: Duration) = apply { - this.timeout = timeout - } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } fun build(): RequestOptions { return RequestOptions(responseValidation, timeout) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt index 311b40e..8f46e25 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Utils.kt @@ -48,10 +48,10 @@ internal fun ListMultimap.toUnmodifiable(): ListMultimap { internal fun ListMultimap.getRequiredHeader(header: String): String { val value = entries() - .stream() - .filter { entry -> entry.key.equals(header, ignoreCase = true) } - .map { entry -> entry.value } - .findFirst() + .stream() + .filter { entry -> entry.key.equals(header, ignoreCase = true) } + .map { entry -> entry.value } + .findFirst() if (!value.isPresent) { throw OpenlayerInvalidDataException("Could not find $header header") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt index 826a2c8..12b454f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/Values.kt @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.BeanProperty @@ -17,8 +16,6 @@ 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.databind.deser.ContextualDeserializer -import com.fasterxml.jackson.databind.deser.std.StdDeserializer import com.fasterxml.jackson.databind.node.JsonNodeType.ARRAY import com.fasterxml.jackson.databind.node.JsonNodeType.BINARY import com.fasterxml.jackson.databind.node.JsonNodeType.BOOLEAN @@ -29,15 +26,14 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.OBJECT import com.fasterxml.jackson.databind.node.JsonNodeType.POJO import com.fasterxml.jackson.databind.node.JsonNodeType.STRING import com.fasterxml.jackson.databind.ser.std.NullSerializer -import java.util.Optional +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.nio.charset.Charset import java.util.Objects -import java.io.ByteArrayOutputStream +import java.util.Optional import org.apache.hc.core5.http.ContentType -import java.nio.charset.Charset -import com.openlayer.api.errors.OpenlayerInvalidDataException @JsonDeserialize(using = JsonField.Deserializer::class) -sealed class JsonField { +sealed class JsonField { fun isMissing(): Boolean = this is JsonMissing @@ -50,9 +46,9 @@ sealed class JsonField { } /** - * If the "known" value (i.e. matching the type that the SDK expects) is returned - * by the API then this method will return an empty `Optional`, otherwise the - * returned `Optional` is given a `JsonValue`. + * If the "known" value (i.e. matching the type that the SDK expects) is returned by the API + * then this method will return an empty `Optional`, otherwise the returned `Optional` is given + * a `JsonValue`. */ fun asUnknown(): Optional = when (this) { @@ -127,13 +123,12 @@ sealed class JsonField { is JsonValue -> accept(visitor as JsonValue.Visitor) } - interface Visitor: JsonValue.Visitor { + interface Visitor : JsonValue.Visitor { fun visitKnown(value: T): R = visitDefault() } companion object { - @JvmStatic - fun of(value: T): JsonField = KnownValue.of(value) + @JvmStatic fun of(value: T): JsonField = KnownValue.of(value) @JvmStatic fun ofNullable(value: T?): JsonField = @@ -160,11 +155,8 @@ sealed class JsonField { } override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> { - return type?.let { - tryDeserialize(node, type) - }?.let { - of(it) - } ?: JsonValue.fromJsonNode(node) + return type?.let { tryDeserialize(node, type) }?.let { of(it) } + ?: JsonValue.fromJsonNode(node) } override fun getNullValue(context: DeserializationContext): JsonField<*> { @@ -174,11 +166,11 @@ sealed class JsonField { } @JsonDeserialize(using = JsonValue.Deserializer::class) -sealed class JsonValue: JsonField() { +sealed class JsonValue : JsonField() { - fun convert(type: TypeReference): R? = JSON_MAPPER.convertValue(this, type) + fun convert(type: TypeReference): R? = JSON_MAPPER.convertValue(this, type) - fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) + fun convert(type: Class): R? = JSON_MAPPER.convertValue(this, type) fun accept(visitor: Visitor): R = when (this) { @@ -193,12 +185,19 @@ sealed class JsonValue: JsonField() { interface Visitor { fun visitNull(): R = visitDefault() + fun visitMissing(): R = visitDefault() + fun visitBoolean(value: Boolean): R = visitDefault() + fun visitNumber(value: Number): R = visitDefault() + fun visitString(value: String): R = visitDefault() + fun visitArray(values: List): R = visitDefault() + fun visitObject(values: Map): R = visitDefault() + fun visitDefault(): R { throw RuntimeException("Unexpected value") } @@ -224,8 +223,12 @@ sealed class JsonValue: JsonField() { BOOLEAN -> JsonBoolean.of(node.booleanValue()) NUMBER -> JsonNumber.of(node.numberValue()) STRING -> JsonString.of(node.textValue()) - ARRAY -> JsonArray.of(node.elements().asSequence().map { fromJsonNode(it) }.toList()) - OBJECT -> JsonObject.of(node.fields().asSequence().map { it.key to fromJsonNode(it.value) }.toMap()) + ARRAY -> + JsonArray.of(node.elements().asSequence().map { fromJsonNode(it) }.toList()) + OBJECT -> + JsonObject.of( + node.fields().asSequence().map { it.key to fromJsonNode(it.value) }.toMap() + ) BINARY, POJO, null -> throw IllegalStateException("Unexpected JsonNode type: ${node.nodeType}") @@ -243,7 +246,10 @@ sealed class JsonValue: JsonField() { } } -class KnownValue private constructor(@com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T) : JsonField() { +class KnownValue +private constructor( + @com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T +) : JsonField() { override fun equals(other: Any?): Boolean { if (this === other) { @@ -258,7 +264,7 @@ class KnownValue private constructor(@com.fasterxml.jackson.annotation. override fun toString() = value.toString() companion object { - @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) + @JsonCreator @JvmStatic fun of(value: T) = KnownValue(value) } } @@ -273,11 +279,14 @@ class JsonMissing : JsonValue() { @JvmStatic fun of() = INSTANCE } - class Serializer: BaseSerializer(JsonMissing::class) { - override fun serialize(value: JsonMissing, generator: JsonGenerator, provider: SerializerProvider) { + class Serializer : BaseSerializer(JsonMissing::class) { + override fun serialize( + value: JsonMissing, + generator: JsonGenerator, + provider: SerializerProvider + ) { throw RuntimeException("JsonMissing cannot be serialized") } - } } @@ -378,9 +387,7 @@ private constructor( override fun toString() = values.toString() companion object { - @JsonCreator - @JvmStatic - fun of(values: List) = JsonArray(values.toUnmodifiable()) + @JsonCreator @JvmStatic fun of(values: List) = JsonArray(values.toUnmodifiable()) } } @@ -417,18 +424,18 @@ private constructor( ) annotation class ExcludeMissing - @JacksonAnnotationsInside @JsonAutoDetect( getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE) + fieldVisibility = Visibility.NONE +) annotation class NoAutoDetect - -class MultipartFormValue internal constructor( +class MultipartFormValue +internal constructor( val name: String, val value: T, val contentType: ContentType, @@ -439,16 +446,20 @@ class MultipartFormValue internal constructor( override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash( - name, contentType, filename, when (value) { - is ByteArray -> value.contentHashCode() - is String -> value - is Boolean -> value - is Long -> value - is Double -> value - else -> value?.hashCode() - } - ) + hashCode = + Objects.hash( + name, + contentType, + filename, + when (value) { + is ByteArray -> value.contentHashCode() + is String -> value + is Boolean -> value + is Long -> value + is Double -> value + else -> value?.hashCode() + } + ) } return hashCode } @@ -459,7 +470,8 @@ class MultipartFormValue internal constructor( other as MultipartFormValue<*> - if (name != other.name || contentType != other.contentType || filename != other.filename) return false + if (name != other.name || contentType != other.contentType || filename != other.filename) + return false return when { value is ByteArray && other.value is ByteArray -> value contentEquals other.value @@ -471,10 +483,11 @@ class MultipartFormValue internal constructor( return "MultipartFormValue(name='$name', contentType=$contentType, filename=$filename, value=${valueToString()})" } - private fun valueToString(): String = when (value) { - is ByteArray -> "ByteArray of size ${value.size}" - else -> value.toString() - } + private fun valueToString(): String = + when (value) { + is ByteArray -> "ByteArray of size ${value.size}" + else -> value.toString() + } companion object { internal fun fromString( @@ -484,27 +497,27 @@ class MultipartFormValue internal constructor( ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromBoolean( - name: String, - value: Boolean, - contentType: ContentType, + name: String, + value: Boolean, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromLong( - name: String, - value: Long, - contentType: ContentType, + name: String, + value: Long, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromDouble( - name: String, - value: Double, - contentType: ContentType, + name: String, + value: Double, + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) - internal fun fromEnum( - name: String, - value: T, - contentType: ContentType + internal fun fromEnum( + name: String, + value: T, + contentType: ContentType ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromByteArray( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt index a324305..4c099ff 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/BinaryResponseContent.kt @@ -1,9 +1,8 @@ package com.openlayer.api.core.http -import com.google.common.collect.ListMultimap import java.io.Closeable -import java.io.InputStream import java.io.IOException +import java.io.InputStream import java.io.OutputStream interface BinaryResponseContent : Closeable { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt index f492388..b9cac17 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpClient.kt @@ -1,8 +1,8 @@ package com.openlayer.api.core.http +import com.openlayer.api.core.RequestOptions import java.io.Closeable import java.util.concurrent.CompletableFuture -import com.openlayer.api.core.RequestOptions interface HttpClient : Closeable { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt index 53d1d41..243c19a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequest.kt @@ -5,7 +5,6 @@ import com.google.common.collect.ListMultimap import com.google.common.collect.Multimap import com.google.common.collect.MultimapBuilder import com.openlayer.api.core.toUnmodifiable -import com.openlayer.api.core.RequestOptions class HttpRequest private constructor( diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt index 402d902..4f4dbd1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/HttpRequestBody.kt @@ -13,10 +13,11 @@ interface HttpRequestBody : Closeable { fun contentLength(): Long /** - * Determines if a request can be repeated in a meaningful way, for example before doing a retry. + * Determines if a request can be repeated in a meaningful way, for example before doing a + * retry. * - * The most typical case when a request can't be retried is if the request body is being streamed. In this case the - * body data isn't available on subsequent attempts. + * The most typical case when a request can't be retried is if the request body is being + * streamed. In this case the body data isn't available on subsequent attempts. */ fun repeatable(): Boolean diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt index f870b89..a90d6f4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/RetryingHttpClient.kt @@ -3,8 +3,8 @@ package com.openlayer.api.core.http import com.google.common.util.concurrent.MoreExecutors -import com.openlayer.api.errors.OpenlayerIoException import com.openlayer.api.core.RequestOptions +import com.openlayer.api.errors.OpenlayerIoException import java.io.IOException import java.time.Clock import java.time.Duration @@ -24,15 +24,15 @@ import kotlin.math.pow class RetryingHttpClient private constructor( - private val httpClient: HttpClient, - private val clock: Clock, - private val maxRetries: Int, - private val idempotencyHeader: String?, + private val httpClient: HttpClient, + private val clock: Clock, + private val maxRetries: Int, + private val idempotencyHeader: String?, ) : HttpClient { override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, + request: HttpRequest, + requestOptions: RequestOptions, ): HttpResponse { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.execute(request, requestOptions) @@ -44,29 +44,29 @@ private constructor( while (true) { val response = - try { - val response = httpClient.execute(request, requestOptions) - if (++retries > maxRetries || !shouldRetry(response)) { - return response - } - - response - } catch (t: Throwable) { - if (++retries > maxRetries || !shouldRetry(t)) { - throw t - } + try { + val response = httpClient.execute(request, requestOptions) + if (++retries > maxRetries || !shouldRetry(response)) { + return response + } - null + response + } catch (t: Throwable) { + if (++retries > maxRetries || !shouldRetry(t)) { + throw t } + null + } + val backoffMillis = getRetryBackoffMillis(retries, response) Thread.sleep(backoffMillis.toMillis()) } } override fun executeAsync( - request: HttpRequest, - requestOptions: RequestOptions, + request: HttpRequest, + requestOptions: RequestOptions, ): CompletableFuture { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.executeAsync(request, requestOptions) @@ -78,31 +78,31 @@ private constructor( fun wrap(future: CompletableFuture): CompletableFuture { return future - .handleAsync( - fun( - response: HttpResponse?, - throwable: Throwable? - ): CompletableFuture { - if (response != null) { - if (++retries > maxRetries || !shouldRetry(response)) { - return CompletableFuture.completedFuture(response) - } - } else { - if (++retries > maxRetries || !shouldRetry(throwable!!)) { - val failedFuture = CompletableFuture() - failedFuture.completeExceptionally(throwable) - return failedFuture - } - } - - val backoffMillis = getRetryBackoffMillis(retries, response) - return sleepAsync(backoffMillis.toMillis()).thenCompose { - wrap(httpClient.executeAsync(request, requestOptions)) - } - }, - MoreExecutors.directExecutor() - ) - .thenCompose(Function.identity()) + .handleAsync( + fun( + response: HttpResponse?, + throwable: Throwable? + ): CompletableFuture { + if (response != null) { + if (++retries > maxRetries || !shouldRetry(response)) { + return CompletableFuture.completedFuture(response) + } + } else { + if (++retries > maxRetries || !shouldRetry(throwable!!)) { + val failedFuture = CompletableFuture() + failedFuture.completeExceptionally(throwable) + return failedFuture + } + } + + val backoffMillis = getRetryBackoffMillis(retries, response) + return sleepAsync(backoffMillis.toMillis()).thenCompose { + wrap(httpClient.executeAsync(request, requestOptions)) + } + }, + MoreExecutors.directExecutor() + ) + .thenCompose(Function.identity()) } return wrap(httpClient.executeAsync(request, requestOptions)) @@ -158,30 +158,38 @@ private constructor( private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration { // About the Retry-After header: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After - response?.headers()?.let { headers -> - headers.get("Retry-After-Ms").getOrNull(0)?.toFloatOrNull()?.times(TimeUnit.MILLISECONDS.toNanos(1)) + response + ?.headers() + ?.let { headers -> + headers + .get("Retry-After-Ms") + .getOrNull(0) + ?.toFloatOrNull() + ?.times(TimeUnit.MILLISECONDS.toNanos(1)) ?: headers.get("Retry-After").getOrNull(0)?.let { retryAfter -> retryAfter.toFloatOrNull()?.times(TimeUnit.SECONDS.toNanos(1)) - ?: try { - ChronoUnit.MILLIS.between( - OffsetDateTime.now(clock), - OffsetDateTime.parse( - retryAfter, - DateTimeFormatter.RFC_1123_DATE_TIME - ) + ?: try { + ChronoUnit.MILLIS.between( + OffsetDateTime.now(clock), + OffsetDateTime.parse( + retryAfter, + DateTimeFormatter.RFC_1123_DATE_TIME ) - } catch (e: DateTimeParseException) { - null - } + ) + } catch (e: DateTimeParseException) { + null + } } - }?.let { retryAfterNanos -> - // If the API asks us to wait a certain amount of time (and it's a reasonable amount), just - // do what it says. - val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) - if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { - return retryAfter } - } + ?.let { retryAfterNanos -> + // If the API asks us to wait a certain amount of time (and it's a reasonable + // amount), just + // do what it says. + val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) + if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { + return retryAfter + } + } // Apply exponential backoff, but not more than the max. val backoffSeconds = min(0.5 * 2.0.pow(retries - 1), 8.0) @@ -195,12 +203,12 @@ private constructor( private fun sleepAsync(millis: Long): CompletableFuture { val future = CompletableFuture() TIMER.schedule( - object : TimerTask() { - override fun run() { - future.complete(null) - } - }, - millis + object : TimerTask() { + override fun run() { + future.complete(null) + } + }, + millis ) return future } @@ -209,8 +217,7 @@ private constructor( private val TIMER = Timer("RetryingHttpClient", true) - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -229,11 +236,11 @@ private constructor( fun idempotencyHeader(header: String) = apply { this.idempotencyHeader = header } fun build(): HttpClient = - RetryingHttpClient( - checkNotNull(httpClient) { "`httpClient` is required but was not set" }, - clock, - maxRetries, - idempotencyHeader, - ) + RetryingHttpClient( + checkNotNull(httpClient) { "`httpClient` is required but was not set" }, + clock, + maxRetries, + idempotencyHeader, + ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt index c82ec23..f51b5d2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/BadRequestException.kt @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class BadRequestException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 400 + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt index 4108a62..b0c6a67 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/InternalServerException.kt @@ -4,10 +4,11 @@ import com.google.common.collect.ListMultimap class InternalServerException constructor( - private val statusCode: Int, - headers: ListMultimap, - private val error: OpenlayerError, + private val statusCode: Int, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = statusCode + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt index f5dd8ce..9efe856 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/NotFoundException.kt @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class NotFoundException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 404 + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt index 11051a8..59250fe 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerError.kt @@ -5,51 +5,46 @@ package com.openlayer.api.errors import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import java.time.LocalDate -import java.time.OffsetDateTime -import java.util.Objects -import java.util.UUID -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.JsonValue import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable +import java.util.Objects @JsonDeserialize(builder = OpenlayerError.Builder::class) @NoAutoDetect -class OpenlayerError constructor(private val additionalProperties: Map, ) { +class OpenlayerError +constructor( + private val additionalProperties: Map, +) { - @JsonAnyGetter - fun additionalProperties(): Map = additionalProperties + @JsonAnyGetter fun additionalProperties(): Map = additionalProperties fun toBuilder() = Builder() override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is OpenlayerError && - this.additionalProperties == other.additionalProperties + return other is OpenlayerError && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - return Objects.hash(additionalProperties) + return Objects.hash(additionalProperties) } override fun toString() = "OpenlayerError{additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { private var additionalProperties: MutableMap = mutableMapOf() - fun from(error: OpenlayerError) = apply { - additionalProperties(error.additionalProperties) - } + fun from(error: OpenlayerError) = apply { additionalProperties(error.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt index 2f9b4b4..916e4ed 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/OpenlayerServiceException.kt @@ -5,10 +5,11 @@ import com.google.common.collect.ListMultimap abstract class OpenlayerServiceException @JvmOverloads constructor( - private val headers: ListMultimap, - message: String? = null, - cause: Throwable? = null + private val headers: ListMultimap, + message: String? = null, + cause: Throwable? = null ) : OpenlayerException(message, cause) { abstract fun statusCode(): Int + fun headers(): ListMultimap = headers } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt index 511df28..cc7f0d6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/PermissionDeniedException.kt @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class PermissionDeniedException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 403 + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt index c930e91..5b83fd0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/RateLimitException.kt @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class RateLimitException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 429 + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt index 699feed..f0e8f0f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnauthorizedException.kt @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class UnauthorizedException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 401 + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt index f0cef5c..30e8d3a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnexpectedStatusCodeException.kt @@ -3,8 +3,12 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap class UnexpectedStatusCodeException -constructor(private val statusCode: Int, headers: ListMultimap, private val body: String) : - OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { +constructor( + private val statusCode: Int, + headers: ListMultimap, + private val body: String +) : OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { override fun statusCode(): Int = statusCode + fun body() = body } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt index 992665e..87dba98 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/errors/UnprocessableEntityException.kt @@ -4,9 +4,10 @@ import com.google.common.collect.ListMultimap class UnprocessableEntityException constructor( - headers: ListMultimap, - private val error: OpenlayerError, + headers: ListMultimap, + private val error: OpenlayerError, ) : OpenlayerServiceException(headers, "${error}") { override fun statusCode(): Int = 422 + fun error(): OpenlayerError = error } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt index e27c81a..6b1c3e4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListParams.kt @@ -2,51 +2,28 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +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, - +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 @@ -63,34 +40,23 @@ class CommitTestResultListParams constructor( @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() + 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 + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectVersionId - else -> "" - } + return when (index) { + 0 -> projectVersionId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -100,44 +66,44 @@ class CommitTestResultListParams constructor( 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 + 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, - ) + 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}" + 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() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -176,30 +142,22 @@ class CommitTestResultListParams constructor( } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { - this.page = page - } + 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 perPage(perPage: Long) = apply { this.perPage = perPage } /** - * Filter list of test results by status. Available statuses are `running`, - * `passing`, `failing`, `skipped`, and `error`. + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. */ - fun status(status: Status) = apply { - this.status = status - } + 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 type(type: Type) = apply { this.type = type } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -239,9 +197,7 @@ class CommitTestResultListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -252,37 +208,39 @@ class CommitTestResultListParams constructor( 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(), - ) + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -321,39 +279,43 @@ class CommitTestResultListParams constructor( _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 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 { + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Type && - this.value == other.value + return other is Type && this.value == other.value } override fun hashCode() = value.hashCode() @@ -392,23 +354,25 @@ class CommitTestResultListParams constructor( _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 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 index d708086..731f3b5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/CommitTestResultListResponse.kt @@ -5,37 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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, ) { +class CommitTestResultListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +45,9 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +55,43 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): CommitTestResultListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "CommitTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -114,17 +111,13 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + 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 items(items: JsonField>) = apply { this.items = items } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +133,23 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.putAll(additionalProperties) } - fun build(): CommitTestResultListResponse = CommitTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -175,24 +169,16 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +186,49 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + 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 + 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 + 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}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +254,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +262,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +270,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +278,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,32 +294,33 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -356,10 +336,12 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) /** The project version (commit) id. */ - fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -368,35 +350,30 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The data start date. */ - fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) /** The data end date. */ - fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + 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")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** Project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("goal") - @ExcludeMissing - fun _goal() = goal + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun _goalId() = goalId + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun _projectVersionId() = projectVersionId + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -404,34 +381,22 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun _inferencePipelineId() = inferencePipelineId /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun _dateDataStarts() = dateDataStarts + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun _dateDataEnds() = dateDataEnds + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds /** The status of the test. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage @JsonAnyGetter @ExcludeMissing @@ -439,69 +404,70 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): Item = apply { if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -541,17 +507,13 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** Project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + 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 - } + fun goal(goal: JsonField) = apply { this.goal = goal } /** The test id. */ fun goalId(goalId: String) = goalId(JsonField.of(goalId)) @@ -559,12 +521,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test id. */ @JsonProperty("goalId") @ExcludeMissing - fun goalId(goalId: JsonField) = apply { - this.goalId = goalId - } + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = projectVersionId(JsonField.of(projectVersionId)) + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) /** The project version (commit) id. */ @JsonProperty("projectVersionId") @@ -574,7 +535,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = inferencePipelineId(JsonField.of(inferencePipelineId)) + fun inferencePipelineId(inferencePipelineId: String) = + inferencePipelineId(JsonField.of(inferencePipelineId)) /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -604,7 +566,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = dateDataStarts(JsonField.of(dateDataStarts)) + fun dateDataStarts(dateDataStarts: OffsetDateTime) = + dateDataStarts(JsonField.of(dateDataStarts)) /** The data start date. */ @JsonProperty("dateDataStarts") @@ -614,7 +577,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = dateDataEnds(JsonField.of(dateDataEnds)) + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) /** The data end date. */ @JsonProperty("dateDataEnds") @@ -629,9 +593,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The status of the test. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + fun status(status: JsonField) = apply { this.status = status } /** The status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -657,34 +619,37 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -723,54 +688,56 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi _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 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 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, - + 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 @@ -792,14 +759,13 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** 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 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")) + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) /** The test type. */ fun type(): String = type.getRequired("type") @@ -808,18 +774,22 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun subtype(): String = subtype.getRequired("subtype") /** The test creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + 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 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")) + fun archived(): Optional = + Optional.ofNullable(archived.getNullable("archived")) /** The date the test was archived. */ - fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** Whether the test is suggested or user-created. */ fun suggested(): Boolean = suggested.getRequired("suggested") @@ -828,111 +798,81 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun commentCount(): Long = commentCount.getRequired("commentCount") /** Whether the test uses an ML model. */ - fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = + Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + 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")) + 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")) + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** The test id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The test number. */ - @JsonProperty("number") - @ExcludeMissing - fun _number() = number + @JsonProperty("number") @ExcludeMissing fun _number() = number /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The test description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description - /** - * The evaluation window in seconds. Only applies to tests that use production - * data. - */ + /** 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 + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun _type() = type + @JsonProperty("type") @ExcludeMissing fun _type() = type /** The test subtype. */ - @JsonProperty("subtype") - @ExcludeMissing - fun _subtype() = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype /** The test creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @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 + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds /** Whether the test is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived /** The date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun _suggested() = suggested + @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun _commentCount() = commentCount + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") - @ExcludeMissing - fun _usesMlModel() = usesMlModel + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -960,101 +900,102 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi 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 + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1116,9 +1057,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) @@ -1126,9 +1065,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test number. */ @JsonProperty("number") @ExcludeMissing - fun number(number: JsonField) = apply { - this.number = number - } + fun number(number: JsonField) = apply { this.number = number } /** The test name. */ fun name(name: String) = name(JsonField.of(name)) @@ -1136,12 +1073,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) /** The creation date. */ @JsonProperty("dateCreated") @@ -1151,7 +1087,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ @JsonProperty("dateUpdated") @@ -1163,19 +1100,16 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonValue) = apply { - this.description = description - } + fun description(description: JsonValue) = apply { this.description = description } /** - * The evaluation window in seconds. Only applies to tests that use production - * data. + * The evaluation window in seconds. Only applies to tests that use production data. */ - fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(JsonField.of(evaluationWindow)) + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(JsonField.of(evaluationWindow)) /** - * The evaluation window in seconds. Only applies to tests that use production - * data. + * The evaluation window in seconds. Only applies to tests that use production data. */ @JsonProperty("evaluationWindow") @ExcludeMissing @@ -1199,9 +1133,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test type. */ @JsonProperty("type") @ExcludeMissing - fun type(type: JsonField) = apply { - this.type = type - } + fun type(type: JsonField) = apply { this.type = type } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) @@ -1209,9 +1141,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test subtype. */ @JsonProperty("subtype") @ExcludeMissing - fun subtype(subtype: JsonField) = apply { - this.subtype = subtype - } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The test creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -1219,12 +1149,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The test creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + 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)) + fun originProjectVersionId(originProjectVersionId: String) = + originProjectVersionId(JsonField.of(originProjectVersionId)) /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @@ -1247,12 +1176,11 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** Whether the test is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { - this.archived = archived - } + fun archived(archived: JsonField) = apply { this.archived = archived } /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) /** The date the test was archived. */ @JsonProperty("dateArchived") @@ -1267,9 +1195,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** Whether the test is suggested or user-created. */ @JsonProperty("suggested") @ExcludeMissing - fun suggested(suggested: JsonField) = apply { - this.suggested = suggested - } + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) @@ -1292,7 +1218,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -1302,7 +1229,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) /** Whether the test uses a training dataset. */ @JsonProperty("usesTrainingDataset") @@ -1312,7 +1240,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @@ -1322,7 +1251,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi } /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) /** Whether the test uses production data (monitoring mode only). */ @JsonProperty("usesProductionData") @@ -1341,47 +1271,49 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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(), - ) + 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, - + 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 @@ -1389,42 +1321,38 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi private var hashCode: Int = 0 /** The measurement to be evaluated. */ - fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) /** The insight name to be evaluated. */ - fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = + Optional.ofNullable(insightName.getNullable("insightName")) - fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) /** The operator to be used for the evaluation. */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + 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 + @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement /** The insight name to be evaluated. */ - @JsonProperty("insightName") - @ExcludeMissing - fun _insightName() = insightName + @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 + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator /** The value to be compared. */ - @JsonProperty("value") - @ExcludeMissing - fun _value() = value + @JsonProperty("value") @ExcludeMissing fun _value() = value @JsonAnyGetter @ExcludeMissing @@ -1432,51 +1360,52 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun validate(): Threshold = apply { if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + 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 + 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 + 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}" + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1518,7 +1447,8 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.insightName = insightName } - fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) @JsonProperty("insightParameters") @ExcludeMissing @@ -1532,9 +1462,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The operator to be used for the evaluation. */ @JsonProperty("operator") @ExcludeMissing - fun operator(operator: JsonField) = apply { - this.operator = operator - } + fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -1542,9 +1470,7 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi /** The value to be compared. */ @JsonProperty("value") @ExcludeMissing - fun value(value: JsonField) = apply { - this.value = value - } + fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1556,114 +1482,126 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Threshold = Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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) - } + 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 + 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 + 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, - ) + 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") - } + 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 ofDouble(double: Double) = Value(double = double) - @JvmStatic - fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - @JvmStatic - fun ofString(string: String) = Value(string = string) + @JvmStatic fun ofString(string: String) = Value(string = string) - @JvmStatic - fun ofStrings(strings: List) = Value(strings = strings) + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) } interface Visitor { @@ -1677,42 +1615,46 @@ class CommitTestResultListResponse private constructor(private val _meta: JsonFi fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") + 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) + 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") - } + 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 index dbb986c..62d6be9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamParams.kt @@ -4,46 +4,36 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize 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 org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow 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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +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, - +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 @@ -54,42 +44,40 @@ class InferencePipelineDataStreamParams constructor( @JvmSynthetic internal fun getBody(): InferencePipelineDataStreamBody { - return InferencePipelineDataStreamBody( - config, - rows, - additionalBodyProperties, - ) + return InferencePipelineDataStreamBody( + config, + rows, + additionalBodyProperties, + ) } - @JvmSynthetic - internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + 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, ) { + 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 + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ + @JsonProperty("config") fun config(): Config? = config /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") - fun rows(): List? = rows + @JsonProperty("rows") fun rows(): List? = rows @JsonAnyGetter @ExcludeMissing @@ -98,33 +86,34 @@ class InferencePipelineDataStreamParams constructor( 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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + config, + rows, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -134,26 +123,20 @@ class InferencePipelineDataStreamParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamBody: InferencePipelineDataStreamBody) = apply { - this.config = inferencePipelineDataStreamBody.config - this.rows = inferencePipelineDataStreamBody.rows - additionalProperties(inferencePipelineDataStreamBody.additionalProperties) - } + 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**. + * Configuration for the data stream. Depends on your **Openlayer project task type**. */ - @JsonProperty("config") - fun config(config: Config) = apply { - this.config = config - } + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } /** A list of inference data points with inputs and outputs */ - @JsonProperty("rows") - fun rows(rows: List) = apply { - this.rows = rows - } + @JsonProperty("rows") fun rows(rows: List) = apply { this.rows = rows } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -169,15 +152,12 @@ class InferencePipelineDataStreamParams constructor( 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 build(): InferencePipelineDataStreamBody = + InferencePipelineDataStreamBody( + checkNotNull(config) { "`config` is required but was not set" }, + checkNotNull(rows) { "`rows` is required but was not set" }.toUnmodifiable(), + additionalProperties.toUnmodifiable(), + ) } } @@ -188,38 +168,38 @@ class InferencePipelineDataStreamParams constructor( 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 + 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, - ) + 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}" + 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() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -233,55 +213,37 @@ class InferencePipelineDataStreamParams constructor( 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) - } + 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(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(llmData: Config.LlmData) = apply { this.config = Config.ofLlmData(llmData) } - /** - * Configuration for the data stream. Depends on your **Openlayer project task - * type**. - */ + /** 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**. - */ + /** 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**. - */ + /** Configuration for the data stream. Depends on your **Openlayer project task type**. */ fun config(textClassificationData: Config.TextClassificationData) = apply { this.config = Config.ofTextClassificationData(textClassificationData) } @@ -293,9 +255,7 @@ class InferencePipelineDataStreamParams constructor( } /** A list of inference data points with inputs and outputs */ - fun addRow(row: Row) = apply { - this.rows.add(row) - } + fun addRow(row: Row) = apply { this.rows.add(row) } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -335,9 +295,7 @@ class InferencePipelineDataStreamParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -348,193 +306,232 @@ class InferencePipelineDataStreamParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + 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(), - ) + 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, - + 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 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 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) - } + 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 + 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 + 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, - ) + 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") - } + 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 ofLlmData(llmData: LlmData) = Config(llmData = llmData) @JvmStatic - fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = Config(tabularClassificationData = tabularClassificationData) + fun ofTabularClassificationData(tabularClassificationData: TabularClassificationData) = + Config(tabularClassificationData = tabularClassificationData) @JvmStatic - fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = Config(tabularRegressionData = tabularRegressionData) + fun ofTabularRegressionData(tabularRegressionData: TabularRegressionData) = + Config(tabularRegressionData = tabularRegressionData) @JvmStatic - fun ofTextClassificationData(textClassificationData: TextClassificationData) = Config(textClassificationData = textClassificationData) + fun ofTextClassificationData(textClassificationData: TextClassificationData) = + Config(textClassificationData = textClassificationData) } interface Visitor { fun visitLlmData(llmData: LlmData): T - fun visitTabularClassificationData(tabularClassificationData: TabularClassificationData): 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") + 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) + 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") - } + 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, - + 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 @@ -542,32 +539,38 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(): Optional = Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) + 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. + * 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")) + 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")) + fun costColumnName(): Optional = + Optional.ofNullable(costColumnName.getNullable("costColumnName")) /** Name of the column with the ground truths. */ - fun groundTruthColumnName(): Optional = Optional.ofNullable(groundTruthColumnName.getNullable("groundTruthColumnName")) + 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. + * 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")) + 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")) + fun inputVariableNames(): Optional> = + Optional.ofNullable(inputVariableNames.getNullable("inputVariableNames")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + fun latencyColumnName(): Optional = + Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) /** Name of the column with the model outputs. */ fun outputColumnName(): String = outputColumnName.getRequired("outputColumnName") @@ -579,13 +582,15 @@ class InferencePipelineDataStreamParams constructor( * 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")) + 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. + * 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")) + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** Name of the column with the total number of tokens. */ @JsonProperty("numOfTokenColumnName") @@ -593,17 +598,15 @@ class InferencePipelineDataStreamParams constructor( fun _numOfTokenColumnName() = numOfTokenColumnName /** - * Name of the column with the context retrieved. Applies to RAG use cases. - * Providing the context enables RAG-specific metrics. + * 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 + @JsonProperty("costColumnName") @ExcludeMissing fun _costColumnName() = costColumnName /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @@ -611,9 +614,8 @@ class InferencePipelineDataStreamParams constructor( 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. + * 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 @@ -630,9 +632,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model outputs. */ @JsonProperty("outputColumnName") @@ -640,9 +640,7 @@ class InferencePipelineDataStreamParams constructor( fun _outputColumnName() = outputColumnName /** Prompt for the LLM. */ - @JsonProperty("prompt") - @ExcludeMissing - fun _prompt() = prompt + @JsonProperty("prompt") @ExcludeMissing fun _prompt() = prompt /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -653,8 +651,8 @@ class InferencePipelineDataStreamParams constructor( 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. + * 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 @@ -666,71 +664,72 @@ class InferencePipelineDataStreamParams constructor( fun validate(): LlmData = apply { if (!validated) { - numOfTokenColumnName() - contextColumnName() - costColumnName() - groundTruthColumnName() - inferenceIdColumnName() - inputVariableNames() - latencyColumnName() - outputColumnName() - prompt().map { it.forEach { it.validate() } } - questionColumnName() - timestampColumnName() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -767,7 +766,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the total number of tokens. */ - fun numOfTokenColumnName(numOfTokenColumnName: String) = numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) + fun numOfTokenColumnName(numOfTokenColumnName: String) = + numOfTokenColumnName(JsonField.of(numOfTokenColumnName)) /** Name of the column with the total number of tokens. */ @JsonProperty("numOfTokenColumnName") @@ -780,7 +780,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun contextColumnName(contextColumnName: String) = + contextColumnName(JsonField.of(contextColumnName)) /** * Name of the column with the context retrieved. Applies to RAG use cases. @@ -793,7 +794,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the cost associated with each row. */ - fun costColumnName(costColumnName: String) = costColumnName(JsonField.of(costColumnName)) + fun costColumnName(costColumnName: String) = + costColumnName(JsonField.of(costColumnName)) /** Name of the column with the cost associated with each row. */ @JsonProperty("costColumnName") @@ -803,7 +805,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the ground truths. */ - fun groundTruthColumnName(groundTruthColumnName: String) = groundTruthColumnName(JsonField.of(groundTruthColumnName)) + fun groundTruthColumnName(groundTruthColumnName: String) = + groundTruthColumnName(JsonField.of(groundTruthColumnName)) /** Name of the column with the ground truths. */ @JsonProperty("groundTruthColumnName") @@ -817,7 +820,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -830,10 +834,15 @@ class InferencePipelineDataStreamParams constructor( 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. + */ + fun inputVariableNames(inputVariableNames: List) = + inputVariableNames(JsonField.of(inputVariableNames)) - /** Array of input variable names. Each input variable should be a dataset column. */ + /** + * Array of input variable names. Each input variable should be a dataset column. + */ @JsonProperty("inputVariableNames") @ExcludeMissing fun inputVariableNames(inputVariableNames: JsonField>) = apply { @@ -841,7 +850,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -853,12 +863,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonValue) = apply { this.metadata = metadata } /** Name of the column with the model outputs. */ - fun outputColumnName(outputColumnName: String) = outputColumnName(JsonField.of(outputColumnName)) + fun outputColumnName(outputColumnName: String) = + outputColumnName(JsonField.of(outputColumnName)) /** Name of the column with the model outputs. */ @JsonProperty("outputColumnName") @@ -873,15 +882,14 @@ class InferencePipelineDataStreamParams constructor( /** Prompt for the LLM. */ @JsonProperty("prompt") @ExcludeMissing - fun prompt(prompt: JsonField>) = apply { - this.prompt = prompt - } + 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)) + fun questionColumnName(questionColumnName: String) = + questionColumnName(JsonField.of(questionColumnName)) /** * Name of the column with the questions. Applies to RAG use cases. Providing the @@ -894,14 +902,15 @@ class InferencePipelineDataStreamParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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)) + 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. + * 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 @@ -919,30 +928,37 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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(), - ) + 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, ) { + class Prompt + private constructor( + private val role: JsonField, + private val content: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -952,17 +968,14 @@ class InferencePipelineDataStreamParams constructor( fun role(): Optional = Optional.ofNullable(role.getNullable("role")) /** Content of the prompt. */ - fun content(): Optional = Optional.ofNullable(content.getNullable("content")) + fun content(): Optional = + Optional.ofNullable(content.getNullable("content")) /** Role of the prompt. */ - @JsonProperty("role") - @ExcludeMissing - fun _role() = role + @JsonProperty("role") @ExcludeMissing fun _role() = role /** Content of the prompt. */ - @JsonProperty("content") - @ExcludeMissing - fun _content() = content + @JsonProperty("content") @ExcludeMissing fun _content() = content @JsonAnyGetter @ExcludeMissing @@ -970,42 +983,43 @@ class InferencePipelineDataStreamParams constructor( fun validate(): Prompt = apply { if (!validated) { - role() - content() - validated = true + 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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + role, + content, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" + override fun toString() = + "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1027,9 +1041,7 @@ class InferencePipelineDataStreamParams constructor( /** Role of the prompt. */ @JsonProperty("role") @ExcludeMissing - fun role(role: JsonField) = apply { - this.role = role - } + fun role(role: JsonField) = apply { this.role = role } /** Content of the prompt. */ fun content(content: String) = content(JsonField.of(content)) @@ -1037,9 +1049,7 @@ class InferencePipelineDataStreamParams constructor( /** Content of the prompt. */ @JsonProperty("content") @ExcludeMissing - fun content(content: JsonField) = apply { - this.content = content - } + fun content(content: JsonField) = apply { this.content = content } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1051,34 +1061,36 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Prompt = Prompt( - role, - content, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -1086,84 +1098,87 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ - fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + 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. + * 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")) + 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. + * 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")) + 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`. + * 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")) + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + 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")) + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Name of the column with the model's predictions as **lists of class probabilities**. */ - fun predictionScoresColumnName(): Optional = Optional.ofNullable(predictionScoresColumnName.getNullable("predictionScoresColumnName")) + 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. + * 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")) + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * 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. + * 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 + @JsonProperty("classNames") @ExcludeMissing fun _classNames() = classNames /** Array with all input feature names. */ - @JsonProperty("featureNames") - @ExcludeMissing - fun _featureNames() = featureNames + @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. + * 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`. + * 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 @@ -1175,9 +1190,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1185,16 +1198,15 @@ class InferencePipelineDataStreamParams constructor( fun _predictionsColumnName() = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * 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. + * 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 @@ -1206,65 +1218,66 @@ class InferencePipelineDataStreamParams constructor( fun validate(): TabularClassificationData = apply { if (!validated) { - categoricalFeatureNames() - classNames() - featureNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - timestampColumnName() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1291,36 +1304,39 @@ class InferencePipelineDataStreamParams constructor( this.latencyColumnName = tabularClassificationData.latencyColumnName this.metadata = tabularClassificationData.metadata this.predictionsColumnName = tabularClassificationData.predictionsColumnName - this.predictionScoresColumnName = tabularClassificationData.predictionScoresColumnName + 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"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Age", "Geography"]. */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. ["Age", - * "Geography"]. + * 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 - } + 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. + * 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. + * 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 @@ -1329,7 +1345,8 @@ class InferencePipelineDataStreamParams constructor( } /** Array with all input feature names. */ - fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) + fun featureNames(featureNames: List) = + featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ @JsonProperty("featureNames") @@ -1343,7 +1360,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -1360,7 +1378,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun labelColumnName(labelColumnName: String) = + labelColumnName(JsonField.of(labelColumnName)) /** * Name of the column with the labels. The data in this column must be @@ -1373,7 +1392,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -1385,12 +1405,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + 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)) + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1403,7 +1422,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** * Name of the column with the model's predictions as **lists of class @@ -1411,19 +1431,21 @@ class InferencePipelineDataStreamParams constructor( */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { - this.predictionScoresColumnName = predictionScoresColumnName - } + 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. + * 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)) + 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. + * 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 @@ -1441,39 +1463,41 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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(), - ) + 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, - + 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 @@ -1481,53 +1505,56 @@ class InferencePipelineDataStreamParams constructor( private var hashCode: Int = 0 /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. */ - fun categoricalFeatureNames(): Optional> = Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) + fun categoricalFeatureNames(): Optional> = + Optional.ofNullable(categoricalFeatureNames.getNullable("categoricalFeatureNames")) /** Array with all input feature names. */ - fun featureNames(): Optional> = Optional.ofNullable(featureNames.getNullable("featureNames")) + 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. + * 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")) + fun inferenceIdColumnName(): Optional = + Optional.ofNullable(inferenceIdColumnName.getNullable("inferenceIdColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + 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")) + 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")) + 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. + * 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")) + fun timestampColumnName(): Optional = + Optional.ofNullable(timestampColumnName.getNullable("timestampColumnName")) /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * 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 + @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. + * 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 @@ -1539,9 +1566,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @@ -1554,8 +1579,8 @@ class InferencePipelineDataStreamParams constructor( 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. + * 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 @@ -1567,59 +1592,60 @@ class InferencePipelineDataStreamParams constructor( fun validate(): TabularRegressionData = apply { if (!validated) { - categoricalFeatureNames() - featureNames() - inferenceIdColumnName() - latencyColumnName() - predictionsColumnName() - targetColumnName() - timestampColumnName() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1648,23 +1674,26 @@ class InferencePipelineDataStreamParams constructor( } /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * Array with the names of all categorical features in the dataset. E.g. + * ["Gender", "Geography"]. */ - fun categoricalFeatureNames(categoricalFeatureNames: List) = categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) + fun categoricalFeatureNames(categoricalFeatureNames: List) = + categoricalFeatureNames(JsonField.of(categoricalFeatureNames)) /** - * Array with the names of all categorical features in the dataset. E.g. ["Gender", - * "Geography"]. + * 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 - } + fun categoricalFeatureNames(categoricalFeatureNames: JsonField>) = + apply { + this.categoricalFeatureNames = categoricalFeatureNames + } /** Array with all input feature names. */ - fun featureNames(featureNames: List) = featureNames(JsonField.of(featureNames)) + fun featureNames(featureNames: List) = + featureNames(JsonField.of(featureNames)) /** Array with all input feature names. */ @JsonProperty("featureNames") @@ -1678,7 +1707,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -1692,7 +1722,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -1704,12 +1735,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + 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)) + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions. */ @JsonProperty("predictionsColumnName") @@ -1719,7 +1749,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the targets (ground truth values). */ - fun targetColumnName(targetColumnName: String) = targetColumnName(JsonField.of(targetColumnName)) + fun targetColumnName(targetColumnName: String) = + targetColumnName(JsonField.of(targetColumnName)) /** Name of the column with the targets (ground truth values). */ @JsonProperty("targetColumnName") @@ -1729,14 +1760,15 @@ class InferencePipelineDataStreamParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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)) + 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. + * 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 @@ -1754,38 +1786,40 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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(), - ) + 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, - + 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 @@ -1793,65 +1827,69 @@ class InferencePipelineDataStreamParams constructor( 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. + * 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. + * 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")) + 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`. + * 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")) + fun labelColumnName(): Optional = + Optional.ofNullable(labelColumnName.getNullable("labelColumnName")) /** Name of the column with the latencies. */ - fun latencyColumnName(): Optional = Optional.ofNullable(latencyColumnName.getNullable("latencyColumnName")) + 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")) + fun predictionsColumnName(): Optional = + Optional.ofNullable(predictionsColumnName.getNullable("predictionsColumnName")) /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * Name of the column with the model's predictions as **lists of class probabilities**. */ - fun predictionScoresColumnName(): Optional = Optional.ofNullable(predictionScoresColumnName.getNullable("predictionScoresColumnName")) + fun predictionScoresColumnName(): Optional = + Optional.ofNullable( + predictionScoresColumnName.getNullable("predictionScoresColumnName") + ) /** Name of the column with the text data. */ - fun textColumnName(): Optional = Optional.ofNullable(textColumnName.getNullable("textColumnName")) + 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. + * 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")) + 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. + * 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 + @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. + * 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`. + * 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 @@ -1863,9 +1901,7 @@ class InferencePipelineDataStreamParams constructor( fun _latencyColumnName() = latencyColumnName /** Object with metadata. */ - @JsonProperty("metadata") - @ExcludeMissing - fun _metadata() = metadata + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -1873,21 +1909,18 @@ class InferencePipelineDataStreamParams constructor( fun _predictionsColumnName() = predictionsColumnName /** - * Name of the column with the model's predictions as **lists of class - * probabilities**. + * 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 + @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. + * 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 @@ -1899,62 +1932,63 @@ class InferencePipelineDataStreamParams constructor( fun validate(): TextClassificationData = apply { if (!validated) { - classNames() - inferenceIdColumnName() - labelColumnName() - latencyColumnName() - predictionsColumnName() - predictionScoresColumnName() - textColumnName() - timestampColumnName() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1978,21 +2012,22 @@ class InferencePipelineDataStreamParams constructor( this.latencyColumnName = textClassificationData.latencyColumnName this.metadata = textClassificationData.metadata this.predictionsColumnName = textClassificationData.predictionsColumnName - this.predictionScoresColumnName = textClassificationData.predictionScoresColumnName + 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. + * 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. + * 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 @@ -2005,7 +2040,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun inferenceIdColumnName(inferenceIdColumnName: String) = + inferenceIdColumnName(JsonField.of(inferenceIdColumnName)) /** * Name of the column with the inference ids. This is useful if you want to update @@ -2022,7 +2058,8 @@ class InferencePipelineDataStreamParams constructor( * 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)) + fun labelColumnName(labelColumnName: String) = + labelColumnName(JsonField.of(labelColumnName)) /** * Name of the column with the labels. The data in this column must be @@ -2035,7 +2072,8 @@ class InferencePipelineDataStreamParams constructor( } /** Name of the column with the latencies. */ - fun latencyColumnName(latencyColumnName: String) = latencyColumnName(JsonField.of(latencyColumnName)) + fun latencyColumnName(latencyColumnName: String) = + latencyColumnName(JsonField.of(latencyColumnName)) /** Name of the column with the latencies. */ @JsonProperty("latencyColumnName") @@ -2047,12 +2085,11 @@ class InferencePipelineDataStreamParams constructor( /** Object with metadata. */ @JsonProperty("metadata") @ExcludeMissing - fun metadata(metadata: JsonValue) = apply { - this.metadata = metadata - } + 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)) + fun predictionsColumnName(predictionsColumnName: String) = + predictionsColumnName(JsonField.of(predictionsColumnName)) /** Name of the column with the model's predictions as **zero-indexed integers**. */ @JsonProperty("predictionsColumnName") @@ -2065,7 +2102,8 @@ class InferencePipelineDataStreamParams constructor( * Name of the column with the model's predictions as **lists of class * probabilities**. */ - fun predictionScoresColumnName(predictionScoresColumnName: String) = predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) + fun predictionScoresColumnName(predictionScoresColumnName: String) = + predictionScoresColumnName(JsonField.of(predictionScoresColumnName)) /** * Name of the column with the model's predictions as **lists of class @@ -2073,12 +2111,14 @@ class InferencePipelineDataStreamParams constructor( */ @JsonProperty("predictionScoresColumnName") @ExcludeMissing - fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = apply { - this.predictionScoresColumnName = predictionScoresColumnName - } + fun predictionScoresColumnName(predictionScoresColumnName: JsonField) = + apply { + this.predictionScoresColumnName = predictionScoresColumnName + } /** Name of the column with the text data. */ - fun textColumnName(textColumnName: String) = textColumnName(JsonField.of(textColumnName)) + fun textColumnName(textColumnName: String) = + textColumnName(JsonField.of(textColumnName)) /** Name of the column with the text data. */ @JsonProperty("textColumnName") @@ -2088,14 +2128,15 @@ class InferencePipelineDataStreamParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * 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)) + 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. + * 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 @@ -2113,29 +2154,34 @@ class InferencePipelineDataStreamParams constructor( this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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(), - ) + 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, ) { + class Row + private constructor( + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 @@ -2146,27 +2192,25 @@ class InferencePipelineDataStreamParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Row && - this.additionalProperties == other.additionalProperties + return other is Row && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(additionalProperties) + } + return hashCode } override fun toString() = "Row{additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -2174,9 +2218,7 @@ class InferencePipelineDataStreamParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(row: Row) = apply { - additionalProperties(row.additionalProperties) - } + internal fun from(row: Row) = apply { additionalProperties(row.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt index 5b3ebd0..087ceda 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDataStreamResponse.kt @@ -5,37 +5,25 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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, ) { +class InferencePipelineDataStreamResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -43,9 +31,7 @@ class InferencePipelineDataStreamResponse private constructor(private val succes fun success(): Success = success.getRequired("success") - @JsonProperty("success") - @ExcludeMissing - fun _success() = success + @JsonProperty("success") @ExcludeMissing fun _success() = success @JsonAnyGetter @ExcludeMissing @@ -53,36 +39,36 @@ class InferencePipelineDataStreamResponse private constructor(private val succes fun validate(): InferencePipelineDataStreamResponse = apply { if (!validated) { - success() - validated = true + success() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is InferencePipelineDataStreamResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode } - override fun toString() = "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -91,7 +77,9 @@ class InferencePipelineDataStreamResponse private constructor(private val succes private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse) = apply { + internal fun from( + inferencePipelineDataStreamResponse: InferencePipelineDataStreamResponse + ) = apply { this.success = inferencePipelineDataStreamResponse.success additionalProperties(inferencePipelineDataStreamResponse.additionalProperties) } @@ -100,9 +88,7 @@ class InferencePipelineDataStreamResponse private constructor(private val succes @JsonProperty("success") @ExcludeMissing - fun success(success: JsonField) = apply { - this.success = success - } + fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -118,21 +104,24 @@ class InferencePipelineDataStreamResponse private constructor(private val succes this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineDataStreamResponse = InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineDataStreamResponse = + InferencePipelineDataStreamResponse(success, additionalProperties.toUnmodifiable()) } - class Success @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Success && - this.value == other.value + return other is Success && this.value == other.value } override fun hashCode() = value.hashCode() @@ -155,15 +144,17 @@ class InferencePipelineDataStreamResponse private constructor(private val succes _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 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/InferencePipelineRowUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt index cb4d161..a8072f9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParams.kt @@ -4,47 +4,25 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow 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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class InferencePipelineRowUpdateParams constructor( - private val inferencePipelineId: String, - private val inferenceId: String, - private val row: JsonValue, - private val config: Config?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class InferencePipelineRowUpdateParams +constructor( + private val inferencePipelineId: String, + private val inferenceId: String, + private val row: JsonValue, + private val config: Config?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun inferencePipelineId(): String = inferencePipelineId @@ -57,44 +35,44 @@ class InferencePipelineRowUpdateParams constructor( @JvmSynthetic internal fun getBody(): InferencePipelineRowUpdateBody { - return InferencePipelineRowUpdateBody( - row, - config, - additionalBodyProperties, - ) + return InferencePipelineRowUpdateBody( + row, + config, + additionalBodyProperties, + ) } @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.inferenceId.let { - params.put("inferenceId", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.inferenceId.let { params.put("inferenceId", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } @JsonDeserialize(builder = InferencePipelineRowUpdateBody.Builder::class) @NoAutoDetect - class InferencePipelineRowUpdateBody internal constructor(private val row: JsonValue?, private val config: Config?, private val additionalProperties: Map, ) { + class InferencePipelineRowUpdateBody + internal constructor( + private val row: JsonValue?, + private val config: Config?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - @JsonProperty("row") - fun row(): JsonValue? = row + @JsonProperty("row") fun row(): JsonValue? = row - @JsonProperty("config") - fun config(): Config? = config + @JsonProperty("config") fun config(): Config? = config @JsonAnyGetter @ExcludeMissing @@ -103,33 +81,34 @@ class InferencePipelineRowUpdateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRowUpdateBody && - this.row == other.row && - this.config == other.config && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is InferencePipelineRowUpdateBody && + this.row == other.row && + this.config == other.config && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - row, - config, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + row, + config, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -139,21 +118,16 @@ class InferencePipelineRowUpdateParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = apply { - this.row = inferencePipelineRowUpdateBody.row - this.config = inferencePipelineRowUpdateBody.config - additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) - } + internal fun from(inferencePipelineRowUpdateBody: InferencePipelineRowUpdateBody) = + apply { + this.row = inferencePipelineRowUpdateBody.row + this.config = inferencePipelineRowUpdateBody.config + additionalProperties(inferencePipelineRowUpdateBody.additionalProperties) + } - @JsonProperty("row") - fun row(row: JsonValue) = apply { - this.row = row - } + @JsonProperty("row") fun row(row: JsonValue) = apply { this.row = row } - @JsonProperty("config") - fun config(config: Config) = apply { - this.config = config - } + @JsonProperty("config") fun config(config: Config) = apply { this.config = config } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -169,13 +143,12 @@ class InferencePipelineRowUpdateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowUpdateBody = InferencePipelineRowUpdateBody( - checkNotNull(row) { - "`row` is required but was not set" - }, - config, - additionalProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineRowUpdateBody = + InferencePipelineRowUpdateBody( + checkNotNull(row) { "`row` is required but was not set" }, + config, + additionalProperties.toUnmodifiable(), + ) } } @@ -186,40 +159,40 @@ class InferencePipelineRowUpdateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRowUpdateParams && - this.inferencePipelineId == other.inferencePipelineId && - this.row == other.row && - this.config == other.config && - this.inferenceId == other.inferenceId && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is InferencePipelineRowUpdateParams && + this.inferencePipelineId == other.inferencePipelineId && + this.row == other.row && + this.config == other.config && + this.inferenceId == other.inferenceId && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - row, - config, - inferenceId, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + inferencePipelineId, + row, + config, + inferenceId, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "InferencePipelineRowUpdateParams{inferencePipelineId=$inferencePipelineId, row=$row, config=$config, inferenceId=$inferenceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -234,32 +207,27 @@ class InferencePipelineRowUpdateParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = apply { - this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId - this.inferenceId = inferencePipelineRowUpdateParams.inferenceId - this.row = inferencePipelineRowUpdateParams.row - this.config = inferencePipelineRowUpdateParams.config - additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) - additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) - additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) - } + internal fun from(inferencePipelineRowUpdateParams: InferencePipelineRowUpdateParams) = + apply { + this.inferencePipelineId = inferencePipelineRowUpdateParams.inferencePipelineId + this.inferenceId = inferencePipelineRowUpdateParams.inferenceId + this.row = inferencePipelineRowUpdateParams.row + this.config = inferencePipelineRowUpdateParams.config + additionalQueryParams(inferencePipelineRowUpdateParams.additionalQueryParams) + additionalHeaders(inferencePipelineRowUpdateParams.additionalHeaders) + additionalBodyProperties(inferencePipelineRowUpdateParams.additionalBodyProperties) + } fun inferencePipelineId(inferencePipelineId: String) = apply { this.inferencePipelineId = inferencePipelineId } /** Specify the inference id as a query param. */ - fun inferenceId(inferenceId: String) = apply { - this.inferenceId = inferenceId - } + fun inferenceId(inferenceId: String) = apply { this.inferenceId = inferenceId } - fun row(row: JsonValue) = apply { - this.row = row - } + fun row(row: JsonValue) = apply { this.row = row } - fun config(config: Config) = apply { - this.config = config - } + fun config(config: Config) = apply { this.config = config } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -299,9 +267,7 @@ class InferencePipelineRowUpdateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -312,56 +278,52 @@ class InferencePipelineRowUpdateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): InferencePipelineRowUpdateParams = InferencePipelineRowUpdateParams( - checkNotNull(inferencePipelineId) { - "`inferencePipelineId` is required but was not set" - }, - checkNotNull(inferenceId) { - "`inferenceId` is required but was not set" - }, - checkNotNull(row) { - "`row` is required but was not set" - }, - config, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): InferencePipelineRowUpdateParams = + InferencePipelineRowUpdateParams( + checkNotNull(inferencePipelineId) { + "`inferencePipelineId` is required but was not set" + }, + checkNotNull(inferenceId) { "`inferenceId` is required but was not set" }, + checkNotNull(row) { "`row` is required but was not set" }, + config, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } @JsonDeserialize(builder = Config.Builder::class) @NoAutoDetect - class Config private constructor( - private val inferenceIdColumnName: String?, - private val latencyColumnName: String?, - private val timestampColumnName: String?, - private val groundTruthColumnName: String?, - private val humanFeedbackColumnName: String?, - private val additionalProperties: Map, - + class Config + private constructor( + private val inferenceIdColumnName: String?, + private val latencyColumnName: String?, + private val timestampColumnName: String?, + private val groundTruthColumnName: String?, + private val humanFeedbackColumnName: String?, + private val additionalProperties: Map, ) { private var hashCode: Int = 0 /** - * 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. + * 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") fun inferenceIdColumnName(): String? = inferenceIdColumnName /** Name of the column with the latencies. */ - @JsonProperty("latencyColumnName") - fun latencyColumnName(): String? = latencyColumnName + @JsonProperty("latencyColumnName") fun latencyColumnName(): String? = latencyColumnName /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. */ @JsonProperty("timestampColumnName") fun timestampColumnName(): String? = timestampColumnName @@ -381,39 +343,40 @@ class InferencePipelineRowUpdateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.timestampColumnName == other.timestampColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.humanFeedbackColumnName == other.humanFeedbackColumnName && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Config && + this.inferenceIdColumnName == other.inferenceIdColumnName && + this.latencyColumnName == other.latencyColumnName && + this.timestampColumnName == other.timestampColumnName && + this.groundTruthColumnName == other.groundTruthColumnName && + this.humanFeedbackColumnName == other.humanFeedbackColumnName && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - inferenceIdColumnName, - latencyColumnName, - timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" + override fun toString() = + "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -436,9 +399,8 @@ class InferencePipelineRowUpdateParams constructor( } /** - * 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. + * 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") fun inferenceIdColumnName(inferenceIdColumnName: String) = apply { @@ -452,8 +414,8 @@ class InferencePipelineRowUpdateParams constructor( } /** - * Name of the column with the timestamps. Timestamps must be in UNIX sec format. - * If not provided, the upload timestamp is used. + * Name of the column with the timestamps. Timestamps must be in UNIX sec format. If not + * provided, the upload timestamp is used. */ @JsonProperty("timestampColumnName") fun timestampColumnName(timestampColumnName: String) = apply { @@ -486,14 +448,15 @@ class InferencePipelineRowUpdateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Config = Config( - inferenceIdColumnName, - latencyColumnName, - timestampColumnName, - groundTruthColumnName, - humanFeedbackColumnName, - additionalProperties.toUnmodifiable(), - ) + fun build(): Config = + Config( + inferenceIdColumnName, + latencyColumnName, + timestampColumnName, + groundTruthColumnName, + humanFeedbackColumnName, + additionalProperties.toUnmodifiable(), + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt index 04db454..35e877e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponse.kt @@ -5,37 +5,25 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects @JsonDeserialize(builder = InferencePipelineRowUpdateResponse.Builder::class) @NoAutoDetect -class InferencePipelineRowUpdateResponse private constructor(private val success: JsonField, private val additionalProperties: Map, ) { +class InferencePipelineRowUpdateResponse +private constructor( + private val success: JsonField, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -43,9 +31,7 @@ class InferencePipelineRowUpdateResponse private constructor(private val success fun success(): Success = success.getRequired("success") - @JsonProperty("success") - @ExcludeMissing - fun _success() = success + @JsonProperty("success") @ExcludeMissing fun _success() = success @JsonAnyGetter @ExcludeMissing @@ -53,36 +39,36 @@ class InferencePipelineRowUpdateResponse private constructor(private val success fun validate(): InferencePipelineRowUpdateResponse = apply { if (!validated) { - success() - validated = true + success() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is InferencePipelineRowUpdateResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties + return other is InferencePipelineRowUpdateResponse && + this.success == other.success && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode + if (hashCode == 0) { + hashCode = Objects.hash(success, additionalProperties) + } + return hashCode } - override fun toString() = "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -91,18 +77,17 @@ class InferencePipelineRowUpdateResponse private constructor(private val success private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = apply { - this.success = inferencePipelineRowUpdateResponse.success - additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) - } + internal fun from(inferencePipelineRowUpdateResponse: InferencePipelineRowUpdateResponse) = + apply { + this.success = inferencePipelineRowUpdateResponse.success + additionalProperties(inferencePipelineRowUpdateResponse.additionalProperties) + } fun success(success: Success) = success(JsonField.of(success)) @JsonProperty("success") @ExcludeMissing - fun success(success: JsonField) = apply { - this.success = success - } + fun success(success: JsonField) = apply { this.success = success } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -118,21 +103,24 @@ class InferencePipelineRowUpdateResponse private constructor(private val success this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineRowUpdateResponse = InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) + fun build(): InferencePipelineRowUpdateResponse = + InferencePipelineRowUpdateResponse(success, additionalProperties.toUnmodifiable()) } - class Success @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Success + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Success && - this.value == other.value + return other is Success && this.value == other.value } override fun hashCode() = value.hashCode() @@ -155,15 +143,17 @@ class InferencePipelineRowUpdateResponse private constructor(private val success _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 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 index 1f3e874..e82d5a1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListParams.kt @@ -2,50 +2,27 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +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, - +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 @@ -60,31 +37,22 @@ class InferencePipelineTestResultListParams constructor( @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() + 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 + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> inferencePipelineId - else -> "" - } + return when (index) { + 0 -> inferencePipelineId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -94,42 +62,42 @@ class InferencePipelineTestResultListParams constructor( 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 + 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, - ) + 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}" + 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() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -145,7 +113,9 @@ class InferencePipelineTestResultListParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineTestResultListParams: InferencePipelineTestResultListParams) = apply { + internal fun from( + inferencePipelineTestResultListParams: InferencePipelineTestResultListParams + ) = apply { this.inferencePipelineId = inferencePipelineTestResultListParams.inferencePipelineId this.page = inferencePipelineTestResultListParams.page this.perPage = inferencePipelineTestResultListParams.perPage @@ -161,30 +131,22 @@ class InferencePipelineTestResultListParams constructor( } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { - this.page = page - } + 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 perPage(perPage: Long) = apply { this.perPage = perPage } /** - * Filter list of test results by status. Available statuses are `running`, - * `passing`, `failing`, `skipped`, and `error`. + * Filter list of test results by status. Available statuses are `running`, `passing`, + * `failing`, `skipped`, and `error`. */ - fun status(status: Status) = apply { - this.status = status - } + 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 type(type: Type) = apply { this.type = type } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -224,9 +186,7 @@ class InferencePipelineTestResultListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -237,36 +197,40 @@ class InferencePipelineTestResultListParams constructor( 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(), - ) + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -305,39 +269,43 @@ class InferencePipelineTestResultListParams constructor( _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 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 { + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Type && - this.value == other.value + return other is Type && this.value == other.value } override fun hashCode() = value.hashCode() @@ -376,23 +344,25 @@ class InferencePipelineTestResultListParams constructor( _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 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 index 7135f01..045ce71 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineTestResultListResponse.kt @@ -5,37 +5,37 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID import com.openlayer.api.core.BaseDeserializer import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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, ) { +class InferencePipelineTestResultListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +45,9 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +55,43 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): InferencePipelineTestResultListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "InferencePipelineTestResultListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -104,7 +101,9 @@ class InferencePipelineTestResultListResponse private constructor(private val _m private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse) = apply { + internal fun from( + inferencePipelineTestResultListResponse: InferencePipelineTestResultListResponse + ) = apply { this._meta = inferencePipelineTestResultListResponse._meta this.items = inferencePipelineTestResultListResponse.items additionalProperties(inferencePipelineTestResultListResponse.additionalProperties) @@ -114,17 +113,13 @@ class InferencePipelineTestResultListResponse private constructor(private val _m @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + 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 items(items: JsonField>) = apply { this.items = items } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +135,23 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.putAll(additionalProperties) } - fun build(): InferencePipelineTestResultListResponse = InferencePipelineTestResultListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -175,24 +171,16 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +188,49 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + 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 + 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 + 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}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +256,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +264,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +272,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +280,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,32 +296,33 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -356,10 +338,12 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun goalId(): Optional = Optional.ofNullable(goalId.getNullable("goalId")) /** The project version (commit) id. */ - fun projectVersionId(): Optional = Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) + fun projectVersionId(): Optional = + Optional.ofNullable(projectVersionId.getNullable("projectVersionId")) /** The inference pipeline id. */ - fun inferencePipelineId(): Optional = Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) + fun inferencePipelineId(): Optional = + Optional.ofNullable(inferencePipelineId.getNullable("inferencePipelineId")) /** The creation date. */ fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") @@ -368,35 +352,30 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The data start date. */ - fun dateDataStarts(): Optional = Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) + fun dateDataStarts(): Optional = + Optional.ofNullable(dateDataStarts.getNullable("dateDataStarts")) /** The data end date. */ - fun dateDataEnds(): Optional = Optional.ofNullable(dateDataEnds.getNullable("dateDataEnds")) + 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")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** Project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("goal") - @ExcludeMissing - fun _goal() = goal + @JsonProperty("goal") @ExcludeMissing fun _goal() = goal /** The test id. */ - @JsonProperty("goalId") - @ExcludeMissing - fun _goalId() = goalId + @JsonProperty("goalId") @ExcludeMissing fun _goalId() = goalId /** The project version (commit) id. */ - @JsonProperty("projectVersionId") - @ExcludeMissing - fun _projectVersionId() = projectVersionId + @JsonProperty("projectVersionId") @ExcludeMissing fun _projectVersionId() = projectVersionId /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -404,34 +383,22 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun _inferencePipelineId() = inferencePipelineId /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The data start date. */ - @JsonProperty("dateDataStarts") - @ExcludeMissing - fun _dateDataStarts() = dateDataStarts + @JsonProperty("dateDataStarts") @ExcludeMissing fun _dateDataStarts() = dateDataStarts /** The data end date. */ - @JsonProperty("dateDataEnds") - @ExcludeMissing - fun _dateDataEnds() = dateDataEnds + @JsonProperty("dateDataEnds") @ExcludeMissing fun _dateDataEnds() = dateDataEnds /** The status of the test. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage @JsonAnyGetter @ExcludeMissing @@ -439,69 +406,70 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): Item = apply { if (!validated) { - id() - goal().map { it.validate() } - goalId() - projectVersionId() - inferencePipelineId() - dateCreated() - dateUpdated() - dateDataStarts() - dateDataEnds() - status() - statusMessage() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -541,17 +509,13 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** Project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + 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 - } + fun goal(goal: JsonField) = apply { this.goal = goal } /** The test id. */ fun goalId(goalId: String) = goalId(JsonField.of(goalId)) @@ -559,12 +523,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test id. */ @JsonProperty("goalId") @ExcludeMissing - fun goalId(goalId: JsonField) = apply { - this.goalId = goalId - } + fun goalId(goalId: JsonField) = apply { this.goalId = goalId } /** The project version (commit) id. */ - fun projectVersionId(projectVersionId: String) = projectVersionId(JsonField.of(projectVersionId)) + fun projectVersionId(projectVersionId: String) = + projectVersionId(JsonField.of(projectVersionId)) /** The project version (commit) id. */ @JsonProperty("projectVersionId") @@ -574,7 +537,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The inference pipeline id. */ - fun inferencePipelineId(inferencePipelineId: String) = inferencePipelineId(JsonField.of(inferencePipelineId)) + fun inferencePipelineId(inferencePipelineId: String) = + inferencePipelineId(JsonField.of(inferencePipelineId)) /** The inference pipeline id. */ @JsonProperty("inferencePipelineId") @@ -604,7 +568,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The data start date. */ - fun dateDataStarts(dateDataStarts: OffsetDateTime) = dateDataStarts(JsonField.of(dateDataStarts)) + fun dateDataStarts(dateDataStarts: OffsetDateTime) = + dateDataStarts(JsonField.of(dateDataStarts)) /** The data start date. */ @JsonProperty("dateDataStarts") @@ -614,7 +579,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The data end date. */ - fun dateDataEnds(dateDataEnds: OffsetDateTime) = dateDataEnds(JsonField.of(dateDataEnds)) + fun dateDataEnds(dateDataEnds: OffsetDateTime) = + dateDataEnds(JsonField.of(dateDataEnds)) /** The data end date. */ @JsonProperty("dateDataEnds") @@ -629,9 +595,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The status of the test. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + fun status(status: JsonField) = apply { this.status = status } /** The status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -657,34 +621,37 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties.toUnmodifiable(), - ) + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -723,54 +690,56 @@ class InferencePipelineTestResultListResponse private constructor(private val _m _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 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 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, - + 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 @@ -792,14 +761,13 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** 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 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")) + fun delayWindow(): Optional = + Optional.ofNullable(delayWindow.getNullable("delayWindow")) /** The test type. */ fun type(): String = type.getRequired("type") @@ -808,18 +776,22 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun subtype(): String = subtype.getRequired("subtype") /** The test creator id. */ - fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) + 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 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")) + fun archived(): Optional = + Optional.ofNullable(archived.getNullable("archived")) /** The date the test was archived. */ - fun dateArchived(): Optional = Optional.ofNullable(dateArchived.getNullable("dateArchived")) + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** Whether the test is suggested or user-created. */ fun suggested(): Boolean = suggested.getRequired("suggested") @@ -828,111 +800,81 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun commentCount(): Long = commentCount.getRequired("commentCount") /** Whether the test uses an ML model. */ - fun usesMlModel(): Optional = Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) + fun usesMlModel(): Optional = + Optional.ofNullable(usesMlModel.getNullable("usesMlModel")) /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(): Optional = Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) + fun usesValidationDataset(): Optional = + Optional.ofNullable(usesValidationDataset.getNullable("usesValidationDataset")) /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(): Optional = Optional.ofNullable(usesTrainingDataset.getNullable("usesTrainingDataset")) + 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")) + 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")) + fun usesProductionData(): Optional = + Optional.ofNullable(usesProductionData.getNullable("usesProductionData")) /** The test id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The test number. */ - @JsonProperty("number") - @ExcludeMissing - fun _number() = number + @JsonProperty("number") @ExcludeMissing fun _number() = number /** The test name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The test description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description - /** - * The evaluation window in seconds. Only applies to tests that use production - * data. - */ + /** 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 + @JsonProperty("delayWindow") @ExcludeMissing fun _delayWindow() = delayWindow /** The test type. */ - @JsonProperty("type") - @ExcludeMissing - fun _type() = type + @JsonProperty("type") @ExcludeMissing fun _type() = type /** The test subtype. */ - @JsonProperty("subtype") - @ExcludeMissing - fun _subtype() = subtype + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype /** The test creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @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 + @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds /** Whether the test is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived /** The date the test was archived. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived /** Whether the test is suggested or user-created. */ - @JsonProperty("suggested") - @ExcludeMissing - fun _suggested() = suggested + @JsonProperty("suggested") @ExcludeMissing fun _suggested() = suggested /** The number of comments on the test. */ - @JsonProperty("commentCount") - @ExcludeMissing - fun _commentCount() = commentCount + @JsonProperty("commentCount") @ExcludeMissing fun _commentCount() = commentCount /** Whether the test uses an ML model. */ - @JsonProperty("usesMlModel") - @ExcludeMissing - fun _usesMlModel() = usesMlModel + @JsonProperty("usesMlModel") @ExcludeMissing fun _usesMlModel() = usesMlModel /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -960,101 +902,102 @@ class InferencePipelineTestResultListResponse private constructor(private val _m 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 + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1116,9 +1059,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The test number. */ fun number(number: Long) = number(JsonField.of(number)) @@ -1126,9 +1067,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test number. */ @JsonProperty("number") @ExcludeMissing - fun number(number: JsonField) = apply { - this.number = number - } + fun number(number: JsonField) = apply { this.number = number } /** The test name. */ fun name(name: String) = name(JsonField.of(name)) @@ -1136,12 +1075,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) /** The creation date. */ @JsonProperty("dateCreated") @@ -1151,7 +1089,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** The last updated date. */ - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) /** The last updated date. */ @JsonProperty("dateUpdated") @@ -1163,19 +1102,16 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonValue) = apply { - this.description = description - } + fun description(description: JsonValue) = apply { this.description = description } /** - * The evaluation window in seconds. Only applies to tests that use production - * data. + * The evaluation window in seconds. Only applies to tests that use production data. */ - fun evaluationWindow(evaluationWindow: Double) = evaluationWindow(JsonField.of(evaluationWindow)) + fun evaluationWindow(evaluationWindow: Double) = + evaluationWindow(JsonField.of(evaluationWindow)) /** - * The evaluation window in seconds. Only applies to tests that use production - * data. + * The evaluation window in seconds. Only applies to tests that use production data. */ @JsonProperty("evaluationWindow") @ExcludeMissing @@ -1199,9 +1135,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test type. */ @JsonProperty("type") @ExcludeMissing - fun type(type: JsonField) = apply { - this.type = type - } + fun type(type: JsonField) = apply { this.type = type } /** The test subtype. */ fun subtype(subtype: String) = subtype(JsonField.of(subtype)) @@ -1209,9 +1143,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test subtype. */ @JsonProperty("subtype") @ExcludeMissing - fun subtype(subtype: JsonField) = apply { - this.subtype = subtype - } + fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** The test creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -1219,12 +1151,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The test creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + 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)) + fun originProjectVersionId(originProjectVersionId: String) = + originProjectVersionId(JsonField.of(originProjectVersionId)) /** The project version (commit) id where the test was created. */ @JsonProperty("originProjectVersionId") @@ -1247,12 +1178,11 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** Whether the test is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { - this.archived = archived - } + fun archived(archived: JsonField) = apply { this.archived = archived } /** The date the test was archived. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) /** The date the test was archived. */ @JsonProperty("dateArchived") @@ -1267,9 +1197,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** Whether the test is suggested or user-created. */ @JsonProperty("suggested") @ExcludeMissing - fun suggested(suggested: JsonField) = apply { - this.suggested = suggested - } + fun suggested(suggested: JsonField) = apply { this.suggested = suggested } /** The number of comments on the test. */ fun commentCount(commentCount: Long) = commentCount(JsonField.of(commentCount)) @@ -1292,7 +1220,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses a validation dataset. */ - fun usesValidationDataset(usesValidationDataset: Boolean) = usesValidationDataset(JsonField.of(usesValidationDataset)) + fun usesValidationDataset(usesValidationDataset: Boolean) = + usesValidationDataset(JsonField.of(usesValidationDataset)) /** Whether the test uses a validation dataset. */ @JsonProperty("usesValidationDataset") @@ -1302,7 +1231,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses a training dataset. */ - fun usesTrainingDataset(usesTrainingDataset: Boolean) = usesTrainingDataset(JsonField.of(usesTrainingDataset)) + fun usesTrainingDataset(usesTrainingDataset: Boolean) = + usesTrainingDataset(JsonField.of(usesTrainingDataset)) /** Whether the test uses a training dataset. */ @JsonProperty("usesTrainingDataset") @@ -1312,7 +1242,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses a reference dataset (monitoring mode only). */ - fun usesReferenceDataset(usesReferenceDataset: Boolean) = usesReferenceDataset(JsonField.of(usesReferenceDataset)) + fun usesReferenceDataset(usesReferenceDataset: Boolean) = + usesReferenceDataset(JsonField.of(usesReferenceDataset)) /** Whether the test uses a reference dataset (monitoring mode only). */ @JsonProperty("usesReferenceDataset") @@ -1322,7 +1253,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m } /** Whether the test uses production data (monitoring mode only). */ - fun usesProductionData(usesProductionData: Boolean) = usesProductionData(JsonField.of(usesProductionData)) + fun usesProductionData(usesProductionData: Boolean) = + usesProductionData(JsonField.of(usesProductionData)) /** Whether the test uses production data (monitoring mode only). */ @JsonProperty("usesProductionData") @@ -1341,47 +1273,49 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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(), - ) + 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, - + 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 @@ -1389,42 +1323,38 @@ class InferencePipelineTestResultListResponse private constructor(private val _m private var hashCode: Int = 0 /** The measurement to be evaluated. */ - fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) + fun measurement(): Optional = + Optional.ofNullable(measurement.getNullable("measurement")) /** The insight name to be evaluated. */ - fun insightName(): Optional = Optional.ofNullable(insightName.getNullable("insightName")) + fun insightName(): Optional = + Optional.ofNullable(insightName.getNullable("insightName")) - fun insightParameters(): Optional> = Optional.ofNullable(insightParameters.getNullable("insightParameters")) + fun insightParameters(): Optional> = + Optional.ofNullable(insightParameters.getNullable("insightParameters")) /** The operator to be used for the evaluation. */ - fun operator(): Optional = Optional.ofNullable(operator.getNullable("operator")) + 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 + @JsonProperty("measurement") @ExcludeMissing fun _measurement() = measurement /** The insight name to be evaluated. */ - @JsonProperty("insightName") - @ExcludeMissing - fun _insightName() = insightName + @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 + @JsonProperty("operator") @ExcludeMissing fun _operator() = operator /** The value to be compared. */ - @JsonProperty("value") - @ExcludeMissing - fun _value() = value + @JsonProperty("value") @ExcludeMissing fun _value() = value @JsonAnyGetter @ExcludeMissing @@ -1432,51 +1362,52 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun validate(): Threshold = apply { if (!validated) { - measurement() - insightName() - insightParameters() - operator() - value() - validated = true + 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 + 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 + 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}" + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1518,7 +1449,8 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.insightName = insightName } - fun insightParameters(insightParameters: List) = insightParameters(JsonField.of(insightParameters)) + fun insightParameters(insightParameters: List) = + insightParameters(JsonField.of(insightParameters)) @JsonProperty("insightParameters") @ExcludeMissing @@ -1532,9 +1464,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The operator to be used for the evaluation. */ @JsonProperty("operator") @ExcludeMissing - fun operator(operator: JsonField) = apply { - this.operator = operator - } + fun operator(operator: JsonField) = apply { this.operator = operator } /** The value to be compared. */ fun value(value: Value) = value(JsonField.of(value)) @@ -1542,9 +1472,7 @@ class InferencePipelineTestResultListResponse private constructor(private val _m /** The value to be compared. */ @JsonProperty("value") @ExcludeMissing - fun value(value: JsonField) = apply { - this.value = value - } + fun value(value: JsonField) = apply { this.value = value } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1556,114 +1484,126 @@ class InferencePipelineTestResultListResponse private constructor(private val _m this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun build(): Threshold = Threshold( - measurement, - insightName, - insightParameters.map { it.toUnmodifiable() }, - operator, - value, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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) - } + 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 + 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 + 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, - ) + 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") - } + 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 ofDouble(double: Double) = Value(double = double) - @JvmStatic - fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) - @JvmStatic - fun ofString(string: String) = Value(string = string) + @JvmStatic fun ofString(string: String) = Value(string = string) - @JvmStatic - fun ofStrings(strings: List) = Value(strings = strings) + @JvmStatic fun ofStrings(strings: List) = Value(strings = strings) } interface Visitor { @@ -1677,42 +1617,46 @@ class InferencePipelineTestResultListResponse private constructor(private val _m fun visitStrings(strings: List): T fun unknown(json: JsonValue?): T { - throw OpenlayerInvalidDataException("Unknown Value: $json") + 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) + 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") - } + 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 index 011a534..9266137 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListParams.kt @@ -2,48 +2,21 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +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, - +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 @@ -54,25 +27,20 @@ class ProjectCommitListParams constructor( @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() + 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 + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -82,38 +50,38 @@ class ProjectCommitListParams constructor( 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 + 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, - ) + 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}" + 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() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -136,19 +104,13 @@ class ProjectCommitListParams constructor( additionalBodyProperties(projectCommitListParams.additionalBodyProperties) } - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + fun projectId(projectId: String) = apply { this.projectId = projectId } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { - this.page = page - } + 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 perPage(perPage: Long) = apply { this.perPage = perPage } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -188,9 +150,7 @@ class ProjectCommitListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -201,19 +161,19 @@ class ProjectCommitListParams constructor( 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(), - ) + 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 index 482f11f..da9d1fd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCommitListResponse.kt @@ -5,37 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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, ) { +class ProjectCommitListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +36,9 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +46,43 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): ProjectCommitListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectCommitListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -114,17 +102,13 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + 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 items(items: JsonField>) = apply { this.items = items } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +124,23 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCommitListResponse = ProjectCommitListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -175,24 +160,16 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +177,49 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + 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 + 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 + 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}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +245,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +253,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +261,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +269,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,38 +285,39 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -360,13 +331,14 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField 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`. + * 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")) + fun statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) /** The project id. */ fun projectId(): String = projectId.getRequired("projectId") @@ -378,22 +350,26 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun commit(): Commit = commit.getRequired("commit") /** The deployment status associated with the commit's model. */ - fun deploymentStatus(): Optional = Optional.ofNullable(deploymentStatus.getNullable("deploymentStatus")) + 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")) + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The training dataset id. */ - fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + 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")) + fun dateArchived(): Optional = + Optional.ofNullable(dateArchived.getNullable("dateArchived")) /** The number of tests that are passing for the commit. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -407,52 +383,34 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun links(): Optional = Optional.ofNullable(links.getNullable("links")) /** The project version (commit) id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The project version (commit) creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @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`. + * 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 + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The commit status message. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri /** The details of a commit (project version). */ - @JsonProperty("commit") - @ExcludeMissing - fun _commit() = commit + @JsonProperty("commit") @ExcludeMissing fun _commit() = commit /** The deployment status associated with the commit's model. */ - @JsonProperty("deploymentStatus") - @ExcludeMissing - fun _deploymentStatus() = deploymentStatus + @JsonProperty("deploymentStatus") @ExcludeMissing fun _deploymentStatus() = deploymentStatus /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -465,33 +423,21 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun _trainingDatasetId() = trainingDatasetId /** Whether the commit is archived. */ - @JsonProperty("archived") - @ExcludeMissing - fun _archived() = archived + @JsonProperty("archived") @ExcludeMissing fun _archived() = archived /** The commit archive date. */ - @JsonProperty("dateArchived") - @ExcludeMissing - fun _dateArchived() = dateArchived + @JsonProperty("dateArchived") @ExcludeMissing fun _dateArchived() = dateArchived /** The number of tests that are passing for the commit. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount /** The number of tests that are failing for the commit. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount /** The total number of tests for the commit. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -499,87 +445,88 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField 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 + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -631,9 +578,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The project version (commit) id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The project version (commit) creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -646,20 +591,18 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** - * The commit status. Initially, the commit is `queued`, then, it switches to - * `running`. Finally, it can be `paused`, `failed`, or `completed`. + * 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`. + * 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 - } + fun status(status: JsonField) = apply { this.status = status } /** The commit status message. */ fun statusMessage(statusMessage: String) = statusMessage(JsonField.of(statusMessage)) @@ -677,9 +620,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + 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)) @@ -687,9 +628,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The storage URI where the commit bundle is stored. */ @JsonProperty("storageUri") @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { - this.storageUri = storageUri - } + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } /** The details of a commit (project version). */ fun commit(commit: Commit) = commit(JsonField.of(commit)) @@ -697,12 +636,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The details of a commit (project version). */ @JsonProperty("commit") @ExcludeMissing - fun commit(commit: JsonField) = apply { - this.commit = commit - } + 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)) + fun deploymentStatus(deploymentStatus: String) = + deploymentStatus(JsonField.of(deploymentStatus)) /** The deployment status associated with the commit's model. */ @JsonProperty("deploymentStatus") @@ -717,12 +655,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The model id. */ @JsonProperty("mlModelId") @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { - this.mlModelId = mlModelId - } + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: String) = + validationDatasetId(JsonField.of(validationDatasetId)) /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -732,7 +669,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String) = + trainingDatasetId(JsonField.of(trainingDatasetId)) /** The training dataset id. */ @JsonProperty("trainingDatasetId") @@ -747,12 +685,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** Whether the commit is archived. */ @JsonProperty("archived") @ExcludeMissing - fun archived(archived: JsonField) = apply { - this.archived = archived - } + fun archived(archived: JsonField) = apply { this.archived = archived } /** The commit archive date. */ - fun dateArchived(dateArchived: OffsetDateTime) = dateArchived(JsonField.of(dateArchived)) + fun dateArchived(dateArchived: OffsetDateTime) = + dateArchived(JsonField.of(dateArchived)) /** The commit archive date. */ @JsonProperty("dateArchived") @@ -762,7 +699,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The number of tests that are passing for the commit. */ - fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests that are passing for the commit. */ @JsonProperty("passingGoalCount") @@ -772,7 +710,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The number of tests that are failing for the commit. */ - fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests that are failing for the commit. */ @JsonProperty("failingGoalCount") @@ -795,9 +734,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -813,46 +750,47 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField 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(), - ) + 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, - + 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 @@ -866,7 +804,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun authorId(): String = authorId.getRequired("authorId") /** The commit creation date. */ - fun dateCreated(): Optional = Optional.ofNullable(dateCreated.getNullable("dateCreated")) + fun dateCreated(): Optional = + Optional.ofNullable(dateCreated.getNullable("dateCreated")) /** The size of the commit bundle in bytes. */ fun fileSize(): Optional = Optional.ofNullable(fileSize.getNullable("fileSize")) @@ -875,55 +814,49 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun message(): String = message.getRequired("message") /** The model id. */ - fun mlModelId(): Optional = Optional.ofNullable(mlModelId.getNullable("mlModelId")) + fun mlModelId(): Optional = + Optional.ofNullable(mlModelId.getNullable("mlModelId")) /** The validation dataset id. */ - fun validationDatasetId(): Optional = Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) + fun validationDatasetId(): Optional = + Optional.ofNullable(validationDatasetId.getNullable("validationDatasetId")) /** The training dataset id. */ - fun trainingDatasetId(): Optional = Optional.ofNullable(trainingDatasetId.getNullable("trainingDatasetId")) + 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")) + fun gitCommitSha(): Optional = + Optional.ofNullable(gitCommitSha.getNullable("gitCommitSha")) /** The ref of the corresponding git commit. */ - fun gitCommitRef(): Optional = Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) + fun gitCommitRef(): Optional = + Optional.ofNullable(gitCommitRef.getNullable("gitCommitRef")) /** The URL of the corresponding git commit. */ - fun gitCommitUrl(): Optional = Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) + fun gitCommitUrl(): Optional = + Optional.ofNullable(gitCommitUrl.getNullable("gitCommitUrl")) /** The commit id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The author id of the commit. */ - @JsonProperty("authorId") - @ExcludeMissing - fun _authorId() = authorId + @JsonProperty("authorId") @ExcludeMissing fun _authorId() = authorId /** The commit creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The size of the commit bundle in bytes. */ - @JsonProperty("fileSize") - @ExcludeMissing - fun _fileSize() = fileSize + @JsonProperty("fileSize") @ExcludeMissing fun _fileSize() = fileSize /** The commit message. */ - @JsonProperty("message") - @ExcludeMissing - fun _message() = message + @JsonProperty("message") @ExcludeMissing fun _message() = message /** The model id. */ - @JsonProperty("mlModelId") - @ExcludeMissing - fun _mlModelId() = mlModelId + @JsonProperty("mlModelId") @ExcludeMissing fun _mlModelId() = mlModelId /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -936,24 +869,16 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun _trainingDatasetId() = trainingDatasetId /** The storage URI where the commit bundle is stored. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri /** The SHA of the corresponding git commit. */ - @JsonProperty("gitCommitSha") - @ExcludeMissing - fun _gitCommitSha() = gitCommitSha + @JsonProperty("gitCommitSha") @ExcludeMissing fun _gitCommitSha() = gitCommitSha /** The ref of the corresponding git commit. */ - @JsonProperty("gitCommitRef") - @ExcludeMissing - fun _gitCommitRef() = gitCommitRef + @JsonProperty("gitCommitRef") @ExcludeMissing fun _gitCommitRef() = gitCommitRef /** The URL of the corresponding git commit. */ - @JsonProperty("gitCommitUrl") - @ExcludeMissing - fun _gitCommitUrl() = gitCommitUrl + @JsonProperty("gitCommitUrl") @ExcludeMissing fun _gitCommitUrl() = gitCommitUrl @JsonAnyGetter @ExcludeMissing @@ -961,72 +886,73 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): Commit = apply { if (!validated) { - id() - authorId() - dateCreated() - fileSize() - message() - mlModelId() - validationDatasetId() - trainingDatasetId() - storageUri() - gitCommitSha() - gitCommitRef() - gitCommitUrl() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1068,9 +994,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The commit id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The author id of the commit. */ fun authorId(authorId: String) = authorId(JsonField.of(authorId)) @@ -1078,12 +1002,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The author id of the commit. */ @JsonProperty("authorId") @ExcludeMissing - fun authorId(authorId: JsonField) = apply { - this.authorId = authorId - } + fun authorId(authorId: JsonField) = apply { this.authorId = authorId } /** The commit creation date. */ - fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) /** The commit creation date. */ @JsonProperty("dateCreated") @@ -1098,9 +1021,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The size of the commit bundle in bytes. */ @JsonProperty("fileSize") @ExcludeMissing - fun fileSize(fileSize: JsonField) = apply { - this.fileSize = fileSize - } + fun fileSize(fileSize: JsonField) = apply { this.fileSize = fileSize } /** The commit message. */ fun message(message: String) = message(JsonField.of(message)) @@ -1108,9 +1029,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The commit message. */ @JsonProperty("message") @ExcludeMissing - fun message(message: JsonField) = apply { - this.message = message - } + fun message(message: JsonField) = apply { this.message = message } /** The model id. */ fun mlModelId(mlModelId: String) = mlModelId(JsonField.of(mlModelId)) @@ -1118,12 +1037,11 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField /** The model id. */ @JsonProperty("mlModelId") @ExcludeMissing - fun mlModelId(mlModelId: JsonField) = apply { - this.mlModelId = mlModelId - } + fun mlModelId(mlModelId: JsonField) = apply { this.mlModelId = mlModelId } /** The validation dataset id. */ - fun validationDatasetId(validationDatasetId: String) = validationDatasetId(JsonField.of(validationDatasetId)) + fun validationDatasetId(validationDatasetId: String) = + validationDatasetId(JsonField.of(validationDatasetId)) /** The validation dataset id. */ @JsonProperty("validationDatasetId") @@ -1133,7 +1051,8 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField } /** The training dataset id. */ - fun trainingDatasetId(trainingDatasetId: String) = trainingDatasetId(JsonField.of(trainingDatasetId)) + fun trainingDatasetId(trainingDatasetId: String) = + trainingDatasetId(JsonField.of(trainingDatasetId)) /** The training dataset id. */ @JsonProperty("trainingDatasetId") @@ -1192,40 +1111,44 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField 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(), - ) + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -1268,32 +1191,38 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField _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 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 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, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -1301,9 +1230,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -1311,36 +1238,35 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1358,9 +1284,7 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1372,9 +1296,10 @@ class ProjectCommitListResponse private constructor(private val _meta: JsonField this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt index c4e23aa..559574f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateParams.kt @@ -5,45 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.models.* +import java.time.OffsetDateTime +import java.util.Objects +import java.util.Optional -class ProjectCreateParams constructor( - private val name: String, - private val taskType: TaskType, - private val description: String?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectCreateParams +constructor( + private val name: String, + private val taskType: TaskType, + private val description: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun name(): String = name @@ -54,43 +37,38 @@ class ProjectCreateParams constructor( @JvmSynthetic internal fun getBody(): ProjectCreateBody { - return ProjectCreateBody( - name, - taskType, - description, - additionalBodyProperties, - ) + return ProjectCreateBody( + name, + taskType, + description, + additionalBodyProperties, + ) } - @JvmSynthetic - internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders @JsonDeserialize(builder = ProjectCreateBody.Builder::class) @NoAutoDetect - class ProjectCreateBody internal constructor( - private val name: String?, - private val taskType: TaskType?, - private val description: String?, - private val additionalProperties: Map, - + class ProjectCreateBody + internal constructor( + private val name: String?, + private val taskType: TaskType?, + private val description: String?, + private val additionalProperties: Map, ) { private var hashCode: Int = 0 /** The project name. */ - @JsonProperty("name") - fun name(): String? = name + @JsonProperty("name") fun name(): String? = name /** The task type of the project. */ - @JsonProperty("taskType") - fun taskType(): TaskType? = taskType + @JsonProperty("taskType") fun taskType(): TaskType? = taskType /** The project description. */ - @JsonProperty("description") - fun description(): String? = description + @JsonProperty("description") fun description(): String? = description @JsonAnyGetter @ExcludeMissing @@ -99,35 +77,36 @@ class ProjectCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is ProjectCreateBody && - this.name == other.name && - this.taskType == other.taskType && - this.description == other.description && - this.additionalProperties == other.additionalProperties + return other is ProjectCreateBody && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - name, - taskType, - description, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + taskType, + description, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -146,22 +125,15 @@ class ProjectCreateParams constructor( } /** The project name. */ - @JsonProperty("name") - fun name(name: String) = apply { - this.name = name - } + @JsonProperty("name") fun name(name: String) = apply { this.name = name } /** The task type of the project. */ @JsonProperty("taskType") - fun taskType(taskType: TaskType) = apply { - this.taskType = taskType - } + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } /** The project description. */ @JsonProperty("description") - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -177,16 +149,13 @@ class ProjectCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCreateBody = ProjectCreateBody( - checkNotNull(name) { - "`name` is required but was not set" - }, - checkNotNull(taskType) { - "`taskType` is required but was not set" - }, - description, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateBody = + ProjectCreateBody( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(taskType) { "`taskType` is required but was not set" }, + description, + additionalProperties.toUnmodifiable(), + ) } } @@ -197,38 +166,38 @@ class ProjectCreateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCreateParams && - this.name == other.name && - this.taskType == other.taskType && - this.description == other.description && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectCreateParams && + this.name == other.name && + this.taskType == other.taskType && + this.description == other.description && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - name, - taskType, - description, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + name, + taskType, + description, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectCreateParams{name=$name, taskType=$taskType, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -252,19 +221,13 @@ class ProjectCreateParams constructor( } /** The project name. */ - fun name(name: String) = apply { - this.name = name - } + fun name(name: String) = apply { this.name = name } /** The task type of the project. */ - fun taskType(taskType: TaskType) = apply { - this.taskType = taskType - } + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } /** The project description. */ - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -304,9 +267,7 @@ class ProjectCreateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -317,33 +278,34 @@ class ProjectCreateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } - fun build(): ProjectCreateParams = ProjectCreateParams( - checkNotNull(name) { - "`name` is required but was not set" - }, - checkNotNull(taskType) { - "`taskType` is required but was not set" - }, - description, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateParams = + ProjectCreateParams( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(taskType) { "`taskType` is required but was not set" }, + description, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: String?, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - @JsonProperty("app") - fun app(): String? = app + @JsonProperty("app") fun app(): String? = app @JsonAnyGetter @ExcludeMissing @@ -352,28 +314,27 @@ class ProjectCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -387,10 +348,7 @@ class ProjectCreateParams constructor( additionalProperties(links.additionalProperties) } - @JsonProperty("app") - fun app(app: String) = apply { - this.app = app - } + @JsonProperty("app") fun app(app: String) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -406,24 +364,28 @@ class ProjectCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(checkNotNull(app) { - "`app` is required but was not set" - }, additionalProperties.toUnmodifiable()) + fun build(): Links = + Links( + checkNotNull(app) { "`app` is required but was not set" }, + additionalProperties.toUnmodifiable() + ) } } - class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && - this.value == other.value + return other is Source && this.value == other.value } override fun hashCode() = value.hashCode() @@ -454,35 +416,39 @@ class ProjectCreateParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -517,81 +483,71 @@ class ProjectCreateParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo private constructor( - private val id: String?, - private val gitId: Long?, - private val dateConnected: OffsetDateTime?, - private val dateUpdated: OffsetDateTime?, - private val branch: String?, - private val name: String?, - private val private_: Boolean?, - private val slug: String?, - private val url: String?, - private val rootDir: String?, - private val projectId: String?, - private val gitAccountId: String?, - private val additionalProperties: Map, - + class GitRepo + private constructor( + private val id: String?, + private val gitId: Long?, + private val dateConnected: OffsetDateTime?, + private val dateUpdated: OffsetDateTime?, + private val branch: String?, + private val name: String?, + private val private_: Boolean?, + private val slug: String?, + private val url: String?, + private val rootDir: String?, + private val projectId: String?, + private val gitAccountId: String?, + private val additionalProperties: Map, ) { private var hashCode: Int = 0 - @JsonProperty("id") - fun id(): String? = id + @JsonProperty("id") fun id(): String? = id - @JsonProperty("gitId") - fun gitId(): Long? = gitId + @JsonProperty("gitId") fun gitId(): Long? = gitId - @JsonProperty("dateConnected") - fun dateConnected(): OffsetDateTime? = dateConnected + @JsonProperty("dateConnected") fun dateConnected(): OffsetDateTime? = dateConnected - @JsonProperty("dateUpdated") - fun dateUpdated(): OffsetDateTime? = dateUpdated + @JsonProperty("dateUpdated") fun dateUpdated(): OffsetDateTime? = dateUpdated - @JsonProperty("branch") - fun branch(): String? = branch + @JsonProperty("branch") fun branch(): String? = branch - @JsonProperty("name") - fun name(): String? = name + @JsonProperty("name") fun name(): String? = name - @JsonProperty("private") - fun private_(): Boolean? = private_ + @JsonProperty("private") fun private_(): Boolean? = private_ - @JsonProperty("slug") - fun slug(): String? = slug + @JsonProperty("slug") fun slug(): String? = slug - @JsonProperty("url") - fun url(): String? = url + @JsonProperty("url") fun url(): String? = url - @JsonProperty("rootDir") - fun rootDir(): String? = rootDir + @JsonProperty("rootDir") fun rootDir(): String? = rootDir - @JsonProperty("projectId") - fun projectId(): String? = projectId + @JsonProperty("projectId") fun projectId(): String? = projectId - @JsonProperty("gitAccountId") - fun gitAccountId(): String? = gitAccountId + @JsonProperty("gitAccountId") fun gitAccountId(): String? = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -600,53 +556,54 @@ class ProjectCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + override fun toString() = + "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -682,15 +639,9 @@ class ProjectCreateParams constructor( additionalProperties(gitRepo.additionalProperties) } - @JsonProperty("id") - fun id(id: String) = apply { - this.id = id - } + @JsonProperty("id") fun id(id: String) = apply { this.id = id } - @JsonProperty("gitId") - fun gitId(gitId: Long) = apply { - this.gitId = gitId - } + @JsonProperty("gitId") fun gitId(gitId: Long) = apply { this.gitId = gitId } @JsonProperty("dateConnected") fun dateConnected(dateConnected: OffsetDateTime) = apply { @@ -698,49 +649,26 @@ class ProjectCreateParams constructor( } @JsonProperty("dateUpdated") - fun dateUpdated(dateUpdated: OffsetDateTime) = apply { - this.dateUpdated = dateUpdated - } + fun dateUpdated(dateUpdated: OffsetDateTime) = apply { this.dateUpdated = dateUpdated } - @JsonProperty("branch") - fun branch(branch: String) = apply { - this.branch = branch - } + @JsonProperty("branch") fun branch(branch: String) = apply { this.branch = branch } - @JsonProperty("name") - fun name(name: String) = apply { - this.name = name - } + @JsonProperty("name") fun name(name: String) = apply { this.name = name } @JsonProperty("private") - fun private_(private_: Boolean) = apply { - this.private_ = private_ - } + fun private_(private_: Boolean) = apply { this.private_ = private_ } - @JsonProperty("slug") - fun slug(slug: String) = apply { - this.slug = slug - } + @JsonProperty("slug") fun slug(slug: String) = apply { this.slug = slug } - @JsonProperty("url") - fun url(url: String) = apply { - this.url = url - } + @JsonProperty("url") fun url(url: String) = apply { this.url = url } - @JsonProperty("rootDir") - fun rootDir(rootDir: String) = apply { - this.rootDir = rootDir - } + @JsonProperty("rootDir") fun rootDir(rootDir: String) = apply { this.rootDir = rootDir } @JsonProperty("projectId") - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + fun projectId(projectId: String) = apply { this.projectId = projectId } @JsonProperty("gitAccountId") - fun gitAccountId(gitAccountId: String) = apply { - this.gitAccountId = gitAccountId - } + fun gitAccountId(gitAccountId: String) = apply { this.gitAccountId = gitAccountId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -756,41 +684,22 @@ class ProjectCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GitRepo = GitRepo( - checkNotNull(id) { - "`id` is required but was not set" - }, - checkNotNull(gitId) { - "`gitId` is required but was not set" - }, - checkNotNull(dateConnected) { - "`dateConnected` is required but was not set" - }, - checkNotNull(dateUpdated) { - "`dateUpdated` is required but was not set" - }, - branch, - checkNotNull(name) { - "`name` is required but was not set" - }, - checkNotNull(private_) { - "`private_` is required but was not set" - }, - checkNotNull(slug) { - "`slug` is required but was not set" - }, - checkNotNull(url) { - "`url` is required but was not set" - }, - rootDir, - checkNotNull(projectId) { - "`projectId` is required but was not set" - }, - checkNotNull(gitAccountId) { - "`gitAccountId` is required but was not set" - }, - additionalProperties.toUnmodifiable(), - ) + fun build(): GitRepo = + GitRepo( + checkNotNull(id) { "`id` is required but was not set" }, + checkNotNull(gitId) { "`gitId` is required but was not set" }, + checkNotNull(dateConnected) { "`dateConnected` is required but was not set" }, + checkNotNull(dateUpdated) { "`dateUpdated` is required but was not set" }, + branch, + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(private_) { "`private_` is required but was not set" }, + checkNotNull(slug) { "`slug` is required but was not set" }, + checkNotNull(url) { "`url` is required but was not set" }, + rootDir, + checkNotNull(projectId) { "`projectId` is required but was not set" }, + checkNotNull(gitAccountId) { "`gitAccountId` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt index edc4a49..eb6afee 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectCreateResponse.kt @@ -5,55 +5,41 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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 = ProjectCreateResponse.Builder::class) @NoAutoDetect -class ProjectCreateResponse private constructor( - private val id: JsonField, - private val workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, - +class ProjectCreateResponse +private constructor( + private val id: JsonField, + private val workspaceId: JsonField, + private val creatorId: JsonField, + private val name: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val inferencePipelineCount: JsonField, + private val goalCount: JsonField, + private val developmentGoalCount: JsonField, + private val monitoringGoalCount: JsonField, + private val links: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -64,7 +50,8 @@ class ProjectCreateResponse private constructor( fun id(): String = id.getRequired("id") /** The workspace id. */ - fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) @@ -79,7 +66,8 @@ class ProjectCreateResponse private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The project description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -91,7 +79,8 @@ class ProjectCreateResponse private constructor( fun versionCount(): Long = versionCount.getRequired("versionCount") /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") /** The total number of tests in the project. */ fun goalCount(): Long = goalCount.getRequired("goalCount") @@ -108,54 +97,34 @@ class ProjectCreateResponse private constructor( fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun _workspaceId() = workspaceId + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing - fun _source() = source + @JsonProperty("source") @ExcludeMissing fun _source() = source /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing - fun _taskType() = taskType + @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing - fun _versionCount() = versionCount + @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -163,9 +132,7 @@ class ProjectCreateResponse private constructor( fun _inferencePipelineCount() = inferencePipelineCount /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun _goalCount() = goalCount + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -178,13 +145,9 @@ class ProjectCreateResponse private constructor( fun _monitoringGoalCount() = monitoringGoalCount /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links - @JsonProperty("gitRepo") - @ExcludeMissing - fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo @JsonAnyGetter @ExcludeMissing @@ -192,84 +155,85 @@ class ProjectCreateResponse private constructor( fun validate(): ProjectCreateResponse = apply { if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + links().validate() + gitRepo().map { it.validate() } + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCreateResponse && - this.id == other.id && - this.workspaceId == other.workspaceId && - this.creatorId == other.creatorId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.source == other.source && - this.taskType == other.taskType && - this.versionCount == other.versionCount && - this.inferencePipelineCount == other.inferencePipelineCount && - this.goalCount == other.goalCount && - this.developmentGoalCount == other.developmentGoalCount && - this.monitoringGoalCount == other.monitoringGoalCount && - this.links == other.links && - this.gitRepo == other.gitRepo && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectCreateResponse && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.links == other.links && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectCreateResponse{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectCreateResponse{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -317,11 +281,7 @@ class ProjectCreateResponse private constructor( fun id(id: String) = id(JsonField.of(id)) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) @@ -329,9 +289,7 @@ class ProjectCreateResponse private constructor( /** The workspace id. */ @JsonProperty("workspaceId") @ExcludeMissing - fun workspaceId(workspaceId: JsonField) = apply { - this.workspaceId = workspaceId - } + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } /** The project creator id. */ fun creatorId(creatorId: String) = creatorId(JsonField.of(creatorId)) @@ -339,9 +297,7 @@ class ProjectCreateResponse private constructor( /** The project creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) @@ -349,9 +305,7 @@ class ProjectCreateResponse private constructor( /** The project name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -379,9 +333,7 @@ class ProjectCreateResponse private constructor( /** The project description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description - } + fun description(description: JsonField) = apply { this.description = description } /** The source of the project. */ fun source(source: Source) = source(JsonField.of(source)) @@ -389,9 +341,7 @@ class ProjectCreateResponse private constructor( /** The source of the project. */ @JsonProperty("source") @ExcludeMissing - fun source(source: JsonField) = apply { - this.source = source - } + fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) @@ -399,9 +349,7 @@ class ProjectCreateResponse private constructor( /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing - fun taskType(taskType: JsonField) = apply { - this.taskType = taskType - } + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) @@ -409,12 +357,11 @@ class ProjectCreateResponse private constructor( /** The number of versions (commits) in the project. */ @JsonProperty("versionCount") @ExcludeMissing - fun versionCount(versionCount: JsonField) = apply { - this.versionCount = versionCount - } + fun versionCount(versionCount: JsonField) = apply { this.versionCount = versionCount } /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -429,12 +376,11 @@ class ProjectCreateResponse private constructor( /** The total number of tests in the project. */ @JsonProperty("goalCount") @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { - this.goalCount = goalCount - } + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -444,7 +390,8 @@ class ProjectCreateResponse private constructor( } /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @@ -459,17 +406,13 @@ class ProjectCreateResponse private constructor( /** Links to the project. */ @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @ExcludeMissing - fun gitRepo(gitRepo: JsonField) = apply { - this.gitRepo = gitRepo - } + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -485,31 +428,36 @@ class ProjectCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectCreateResponse = ProjectCreateResponse( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectCreateResponse = + ProjectCreateResponse( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -517,9 +465,7 @@ class ProjectCreateResponse private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -527,36 +473,35 @@ class ProjectCreateResponse private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -574,9 +519,7 @@ class ProjectCreateResponse private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -596,18 +539,20 @@ class ProjectCreateResponse private constructor( } } - class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && - this.value == other.value + return other is Source && this.value == other.value } override fun hashCode() = value.hashCode() @@ -638,35 +583,39 @@ class ProjectCreateResponse private constructor( _UNKNOWN, } - fun value(): Value = when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -701,42 +650,44 @@ class ProjectCreateResponse private constructor( _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, - + class GitRepo + private constructor( + private val id: JsonField, + private val gitId: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val branch: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val rootDir: JsonField, + private val projectId: JsonField, + private val gitAccountId: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -767,53 +718,29 @@ class ProjectCreateResponse private constructor( fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("gitId") - @ExcludeMissing - fun _gitId() = gitId + @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId - @JsonProperty("dateConnected") - @ExcludeMissing - fun _dateConnected() = dateConnected + @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - @JsonProperty("branch") - @ExcludeMissing - fun _branch() = branch + @JsonProperty("branch") @ExcludeMissing fun _branch() = branch - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("private") - @ExcludeMissing - fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_() = private_ - @JsonProperty("slug") - @ExcludeMissing - fun _slug() = slug + @JsonProperty("slug") @ExcludeMissing fun _slug() = slug - @JsonProperty("url") - @ExcludeMissing - fun _url() = url + @JsonProperty("url") @ExcludeMissing fun _url() = url - @JsonProperty("rootDir") - @ExcludeMissing - fun _rootDir() = rootDir + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - @JsonProperty("gitAccountId") - @ExcludeMissing - fun _gitAccountId() = gitAccountId + @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -821,72 +748,73 @@ class ProjectCreateResponse private constructor( fun validate(): GitRepo = apply { if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + override fun toString() = + "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -926,19 +854,16 @@ class ProjectCreateResponse private constructor( @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) @JsonProperty("gitId") @ExcludeMissing - fun gitId(gitId: JsonField) = apply { - this.gitId = gitId - } + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) @JsonProperty("dateConnected") @ExcludeMissing @@ -958,57 +883,43 @@ class ProjectCreateResponse private constructor( @JsonProperty("branch") @ExcludeMissing - fun branch(branch: JsonField) = apply { - this.branch = branch - } + fun branch(branch: JsonField) = apply { this.branch = branch } fun name(name: String) = name(JsonField.of(name)) @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) @JsonProperty("private") @ExcludeMissing - fun private_(private_: JsonField) = apply { - this.private_ = private_ - } + fun private_(private_: JsonField) = apply { this.private_ = private_ } fun slug(slug: String) = slug(JsonField.of(slug)) @JsonProperty("slug") @ExcludeMissing - fun slug(slug: JsonField) = apply { - this.slug = slug - } + fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) @JsonProperty("url") @ExcludeMissing - fun url(url: JsonField) = apply { - this.url = url - } + fun url(url: JsonField) = apply { this.url = url } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) @JsonProperty("rootDir") @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { - this.rootDir = rootDir - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) @@ -1032,21 +943,22 @@ class ProjectCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties.toUnmodifiable(), - ) + fun build(): GitRepo = + GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + 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 index 9b2a6e5..cab7c08 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateParams.kt @@ -5,45 +5,27 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +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, - +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 @@ -54,39 +36,40 @@ class ProjectInferencePipelineCreateParams constructor( @JvmSynthetic internal fun getBody(): ProjectInferencePipelineCreateBody { - return ProjectInferencePipelineCreateBody( - description, - name, - additionalBodyProperties, - ) + return ProjectInferencePipelineCreateBody( + description, + name, + additionalBodyProperties, + ) } - @JvmSynthetic - internal fun getQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + 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, ) { + 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 + @JsonProperty("description") fun description(): String? = description /** The inference pipeline name. */ - @JsonProperty("name") - fun name(): String? = name + @JsonProperty("name") fun name(): String? = name @JsonAnyGetter @ExcludeMissing @@ -95,33 +78,34 @@ class ProjectInferencePipelineCreateParams constructor( 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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + description, + name, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -131,7 +115,9 @@ class ProjectInferencePipelineCreateParams constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody) = apply { + internal fun from( + projectInferencePipelineCreateBody: ProjectInferencePipelineCreateBody + ) = apply { this.description = projectInferencePipelineCreateBody.description this.name = projectInferencePipelineCreateBody.name additionalProperties(projectInferencePipelineCreateBody.additionalProperties) @@ -139,15 +125,10 @@ class ProjectInferencePipelineCreateParams constructor( /** The inference pipeline description. */ @JsonProperty("description") - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } /** The inference pipeline name. */ - @JsonProperty("name") - fun name(name: String) = apply { - this.name = name - } + @JsonProperty("name") fun name(name: String) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -163,13 +144,12 @@ class ProjectInferencePipelineCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineCreateBody = ProjectInferencePipelineCreateBody( - description, - checkNotNull(name) { - "`name` is required but was not set" - }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectInferencePipelineCreateBody = + ProjectInferencePipelineCreateBody( + description, + checkNotNull(name) { "`name` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) } } @@ -180,38 +160,38 @@ class ProjectInferencePipelineCreateParams constructor( 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 + 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, - ) + 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}" + 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() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -225,7 +205,9 @@ class ProjectInferencePipelineCreateParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams) = apply { + internal fun from( + projectInferencePipelineCreateParams: ProjectInferencePipelineCreateParams + ) = apply { this.projectId = projectInferencePipelineCreateParams.projectId this.description = projectInferencePipelineCreateParams.description this.name = projectInferencePipelineCreateParams.name @@ -234,19 +216,13 @@ class ProjectInferencePipelineCreateParams constructor( additionalBodyProperties(projectInferencePipelineCreateParams.additionalBodyProperties) } - fun projectId(projectId: String) = apply { - this.projectId = projectId - } + fun projectId(projectId: String) = apply { this.projectId = projectId } /** The inference pipeline description. */ - fun description(description: String) = apply { - this.description = description - } + fun description(description: String) = apply { this.description = description } /** The inference pipeline name. */ - fun name(name: String) = apply { - this.name = name - } + fun name(name: String) = apply { this.name = name } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -286,9 +262,7 @@ class ProjectInferencePipelineCreateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -299,32 +273,33 @@ class ProjectInferencePipelineCreateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } + 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(), - ) + 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, ) { + class Links + private constructor( + private val app: String?, + private val additionalProperties: Map, + ) { private var hashCode: Int = 0 - @JsonProperty("app") - fun app(): String? = app + @JsonProperty("app") fun app(): String? = app @JsonAnyGetter @ExcludeMissing @@ -333,28 +308,27 @@ class ProjectInferencePipelineCreateParams constructor( fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -368,10 +342,7 @@ class ProjectInferencePipelineCreateParams constructor( additionalProperties(links.additionalProperties) } - @JsonProperty("app") - fun app(app: String) = apply { - this.app = app - } + @JsonProperty("app") fun app(app: String) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -387,24 +358,28 @@ class ProjectInferencePipelineCreateParams constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Links = Links(checkNotNull(app) { - "`app` is required but was not set" - }, additionalProperties.toUnmodifiable()) + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -447,25 +422,27 @@ class ProjectInferencePipelineCreateParams constructor( _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 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 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 index c6b8166..acd34bb 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineCreateResponse.kt @@ -5,54 +5,40 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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, - +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 @@ -75,16 +61,20 @@ class ProjectInferencePipelineCreateResponse private constructor( fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The last data sample received date. */ - fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) /** The inference pipeline description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -99,34 +89,25 @@ class ProjectInferencePipelineCreateResponse private constructor( 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 statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) fun links(): Links = links.getRequired("links") /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -134,14 +115,10 @@ class ProjectInferencePipelineCreateResponse private constructor( fun _dateLastSampleReceived() = dateLastSampleReceived /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The last test evaluation date. */ - @JsonProperty("dateLastEvaluated") - @ExcludeMissing - fun _dateLastEvaluated() = dateLastEvaluated + @JsonProperty("dateLastEvaluated") @ExcludeMissing fun _dateLastEvaluated() = dateLastEvaluated /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -149,33 +126,21 @@ class ProjectInferencePipelineCreateResponse private constructor( fun _dateOfNextEvaluation() = dateOfNextEvaluation /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -183,81 +148,82 @@ class ProjectInferencePipelineCreateResponse private constructor( fun validate(): ProjectInferencePipelineCreateResponse = apply { if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -280,13 +246,16 @@ class ProjectInferencePipelineCreateResponse private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineCreateResponse: ProjectInferencePipelineCreateResponse) = apply { + 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.dateLastSampleReceived = + projectInferencePipelineCreateResponse.dateLastSampleReceived this.description = projectInferencePipelineCreateResponse.description this.dateLastEvaluated = projectInferencePipelineCreateResponse.dateLastEvaluated this.dateOfNextEvaluation = projectInferencePipelineCreateResponse.dateOfNextEvaluation @@ -303,11 +272,7 @@ class ProjectInferencePipelineCreateResponse private constructor( fun id(id: String) = id(JsonField.of(id)) /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @@ -315,9 +280,7 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) @@ -325,9 +288,7 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -350,7 +311,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = + dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -365,12 +327,11 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The inference pipeline description. */ @JsonProperty("description") @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description - } + fun description(description: JsonField) = apply { this.description = description } /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = dateLastEvaluated(JsonField.of(dateLastEvaluated)) + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = + dateLastEvaluated(JsonField.of(dateLastEvaluated)) /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -380,7 +341,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -390,7 +352,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ @JsonProperty("passingGoalCount") @@ -400,7 +363,8 @@ class ProjectInferencePipelineCreateResponse private constructor( } /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests failing. */ @JsonProperty("failingGoalCount") @@ -425,9 +389,7 @@ class ProjectInferencePipelineCreateResponse private constructor( /** The status of test evaluation for the inference pipeline. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + 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)) @@ -443,9 +405,7 @@ class ProjectInferencePipelineCreateResponse private constructor( @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -461,29 +421,34 @@ class ProjectInferencePipelineCreateResponse private constructor( 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(), - ) + 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, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -491,9 +456,7 @@ class ProjectInferencePipelineCreateResponse private constructor( fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -501,36 +464,35 @@ class ProjectInferencePipelineCreateResponse private constructor( fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -548,9 +510,7 @@ class ProjectInferencePipelineCreateResponse private constructor( @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -570,18 +530,20 @@ class ProjectInferencePipelineCreateResponse private constructor( } } - class Status @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -624,25 +586,27 @@ class ProjectInferencePipelineCreateResponse private constructor( _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 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 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 index b5ed45c..1b909ab 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListParams.kt @@ -2,49 +2,22 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +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, - +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 @@ -57,28 +30,21 @@ class ProjectInferencePipelineListParams constructor( @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() + 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 + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun getPathParam(index: Int): String { - return when (index) { - 0 -> projectId - else -> "" - } + return when (index) { + 0 -> projectId + else -> "" + } } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -88,40 +54,40 @@ class ProjectInferencePipelineListParams constructor( 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 + 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, - ) + 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}" + 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() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -136,34 +102,29 @@ class ProjectInferencePipelineListParams constructor( 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 - } + 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 - } + fun name(name: String) = apply { this.name = name } /** The page to return in a paginated query. */ - fun page(page: Long) = apply { - this.page = page - } + 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 perPage(perPage: Long) = apply { this.perPage = perPage } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -203,9 +164,7 @@ class ProjectInferencePipelineListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -216,20 +175,20 @@ class ProjectInferencePipelineListParams constructor( 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(), - ) + 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 index 5a96dcc..cb9e840 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectInferencePipelineListResponse.kt @@ -5,37 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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, ) { +class ProjectInferencePipelineListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +36,9 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +46,43 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): ProjectInferencePipelineListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _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 + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectInferencePipelineListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -104,7 +92,9 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(projectInferencePipelineListResponse: ProjectInferencePipelineListResponse) = apply { + internal fun from( + projectInferencePipelineListResponse: ProjectInferencePipelineListResponse + ) = apply { this._meta = projectInferencePipelineListResponse._meta this.items = projectInferencePipelineListResponse.items additionalProperties(projectInferencePipelineListResponse.additionalProperties) @@ -114,17 +104,13 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + 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 items(items: JsonField>) = apply { this.items = items } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +126,23 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectInferencePipelineListResponse = ProjectInferencePipelineListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -175,24 +162,16 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +179,49 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + 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 + 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 + 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}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +247,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +255,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +263,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +271,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,36 +287,37 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + 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, - + 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 @@ -367,16 +340,20 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The last data sample received date. */ - fun dateLastSampleReceived(): Optional = Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) + fun dateLastSampleReceived(): Optional = + Optional.ofNullable(dateLastSampleReceived.getNullable("dateLastSampleReceived")) /** The inference pipeline description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The last test evaluation date. */ - fun dateLastEvaluated(): Optional = Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) + fun dateLastEvaluated(): Optional = + Optional.ofNullable(dateLastEvaluated.getNullable("dateLastEvaluated")) /** The next test evaluation date. */ - fun dateOfNextEvaluation(): Optional = Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) + fun dateOfNextEvaluation(): Optional = + Optional.ofNullable(dateOfNextEvaluation.getNullable("dateOfNextEvaluation")) /** The number of tests passing. */ fun passingGoalCount(): Long = passingGoalCount.getRequired("passingGoalCount") @@ -391,34 +368,25 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta 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 statusMessage(): Optional = + Optional.ofNullable(statusMessage.getNullable("statusMessage")) fun links(): Links = links.getRequired("links") /** The inference pipeline id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The project id. */ - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId /** The inference pipeline name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -426,9 +394,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun _dateLastSampleReceived() = dateLastSampleReceived /** The inference pipeline description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -441,33 +407,21 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun _dateOfNextEvaluation() = dateOfNextEvaluation /** The number of tests passing. */ - @JsonProperty("passingGoalCount") - @ExcludeMissing - fun _passingGoalCount() = passingGoalCount + @JsonProperty("passingGoalCount") @ExcludeMissing fun _passingGoalCount() = passingGoalCount /** The number of tests failing. */ - @JsonProperty("failingGoalCount") - @ExcludeMissing - fun _failingGoalCount() = failingGoalCount + @JsonProperty("failingGoalCount") @ExcludeMissing fun _failingGoalCount() = failingGoalCount /** The total number of tests. */ - @JsonProperty("totalGoalCount") - @ExcludeMissing - fun _totalGoalCount() = totalGoalCount + @JsonProperty("totalGoalCount") @ExcludeMissing fun _totalGoalCount() = totalGoalCount /** The status of test evaluation for the inference pipeline. */ - @JsonProperty("status") - @ExcludeMissing - fun _status() = status + @JsonProperty("status") @ExcludeMissing fun _status() = status /** The status message of test evaluation for the inference pipeline. */ - @JsonProperty("statusMessage") - @ExcludeMissing - fun _statusMessage() = statusMessage + @JsonProperty("statusMessage") @ExcludeMissing fun _statusMessage() = statusMessage - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links @JsonAnyGetter @ExcludeMissing @@ -475,81 +429,82 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): Item = apply { if (!validated) { - id() - projectId() - name() - dateCreated() - dateUpdated() - dateLastSampleReceived() - description() - dateLastEvaluated() - dateOfNextEvaluation() - passingGoalCount() - failingGoalCount() - totalGoalCount() - status() - statusMessage() - links().validate() - validated = true + 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 + 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 + 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}" + 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() + @JvmStatic fun builder() = Builder() } class Builder { @@ -597,9 +552,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The inference pipeline id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The project id. */ fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @@ -607,9 +560,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The project id. */ @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } /** The inference pipeline name. */ fun name(name: String) = name(JsonField.of(name)) @@ -617,9 +568,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The inference pipeline name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -642,7 +591,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The last data sample received date. */ - fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) + fun dateLastSampleReceived(dateLastSampleReceived: OffsetDateTime) = + dateLastSampleReceived(JsonField.of(dateLastSampleReceived)) /** The last data sample received date. */ @JsonProperty("dateLastSampleReceived") @@ -662,7 +612,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The last test evaluation date. */ - fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = dateLastEvaluated(JsonField.of(dateLastEvaluated)) + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime) = + dateLastEvaluated(JsonField.of(dateLastEvaluated)) /** The last test evaluation date. */ @JsonProperty("dateLastEvaluated") @@ -672,7 +623,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The next test evaluation date. */ - fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime) = + dateOfNextEvaluation(JsonField.of(dateOfNextEvaluation)) /** The next test evaluation date. */ @JsonProperty("dateOfNextEvaluation") @@ -682,7 +634,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The number of tests passing. */ - fun passingGoalCount(passingGoalCount: Long) = passingGoalCount(JsonField.of(passingGoalCount)) + fun passingGoalCount(passingGoalCount: Long) = + passingGoalCount(JsonField.of(passingGoalCount)) /** The number of tests passing. */ @JsonProperty("passingGoalCount") @@ -692,7 +645,8 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta } /** The number of tests failing. */ - fun failingGoalCount(failingGoalCount: Long) = failingGoalCount(JsonField.of(failingGoalCount)) + fun failingGoalCount(failingGoalCount: Long) = + failingGoalCount(JsonField.of(failingGoalCount)) /** The number of tests failing. */ @JsonProperty("failingGoalCount") @@ -717,9 +671,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta /** The status of test evaluation for the inference pipeline. */ @JsonProperty("status") @ExcludeMissing - fun status(status: JsonField) = apply { - this.status = status - } + 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)) @@ -735,9 +687,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -753,29 +703,34 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta 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(), - ) + 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, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -783,9 +738,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -793,36 +746,35 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -840,9 +792,7 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -854,26 +804,29 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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 { + class Status + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Status && - this.value == other.value + return other is Status && this.value == other.value } override fun hashCode() = value.hashCode() @@ -916,25 +869,27 @@ class ProjectInferencePipelineListResponse private constructor(private val _meta _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 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 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/ProjectListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt index bd79a95..b493cd2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListParams.kt @@ -2,49 +2,26 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.Enum import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonMissing import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes +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 ProjectListParams constructor( - private val name: String?, - private val page: Long?, - private val perPage: Long?, - private val taskType: TaskType?, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class ProjectListParams +constructor( + private val name: String?, + private val page: Long?, + private val perPage: Long?, + private val taskType: TaskType?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun name(): Optional = Optional.ofNullable(name) @@ -57,25 +34,16 @@ class ProjectListParams constructor( @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())) - } - this.taskType?.let { - params.put("taskType", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + 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())) } + this.taskType?.let { params.put("taskType", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams @@ -84,40 +52,40 @@ class ProjectListParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectListParams && - this.name == other.name && - this.page == other.page && - this.perPage == other.perPage && - this.taskType == other.taskType && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is ProjectListParams && + this.name == other.name && + this.page == other.page && + this.perPage == other.perPage && + this.taskType == other.taskType && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - name, - page, - perPage, - taskType, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + name, + page, + perPage, + taskType, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "ProjectListParams{name=$name, page=$page, perPage=$perPage, taskType=$taskType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "ProjectListParams{name=$name, page=$page, perPage=$perPage, taskType=$taskType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -143,24 +111,16 @@ class ProjectListParams constructor( } /** Filter list of items by project name. */ - fun name(name: String) = apply { - this.name = 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 - } + 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 perPage(perPage: Long) = apply { this.perPage = perPage } /** Filter list of items by task type. */ - fun taskType(taskType: TaskType) = apply { - this.taskType = taskType - } + fun taskType(taskType: TaskType) = apply { this.taskType = taskType } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -200,9 +160,7 @@ class ProjectListParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -213,33 +171,37 @@ class ProjectListParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): ProjectListParams = ProjectListParams( - name, - page, - perPage, - taskType, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): ProjectListParams = + ProjectListParams( + name, + page, + perPage, + taskType, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -274,21 +236,23 @@ class ProjectListParams constructor( _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } - - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt index f6e8e92..69c6387 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/ProjectListResponse.kt @@ -5,37 +5,28 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow +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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable 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 = ProjectListResponse.Builder::class) @NoAutoDetect -class ProjectListResponse private constructor(private val _meta: JsonField<_Meta>, private val items: JsonField>, private val additionalProperties: Map, ) { +class ProjectListResponse +private constructor( + private val _meta: JsonField<_Meta>, + private val items: JsonField>, + private val additionalProperties: Map, +) { private var validated: Boolean = false @@ -45,13 +36,9 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun items(): List = items.getRequired("items") - @JsonProperty("_meta") - @ExcludeMissing - fun __meta() = _meta + @JsonProperty("_meta") @ExcludeMissing fun __meta() = _meta - @JsonProperty("items") - @ExcludeMissing - fun _items() = items + @JsonProperty("items") @ExcludeMissing fun _items() = items @JsonAnyGetter @ExcludeMissing @@ -59,42 +46,43 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): ProjectListResponse = apply { if (!validated) { - _meta().validate() - items().forEach { it.validate() } - validated = true + _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 ProjectListResponse && - this._meta == other._meta && - this.items == other.items && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is ProjectListResponse && + 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 + if (hashCode == 0) { + hashCode = + Objects.hash( + _meta, + items, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "ProjectListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" + override fun toString() = + "ProjectListResponse{_meta=$_meta, items=$items, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -114,17 +102,13 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("_meta") @ExcludeMissing - fun _meta(_meta: JsonField<_Meta>) = apply { - this._meta = _meta - } + 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 items(items: JsonField>) = apply { this.items = items } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -140,22 +124,23 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.putAll(additionalProperties) } - fun build(): ProjectListResponse = ProjectListResponse( - _meta, - items.map { it.toUnmodifiable() }, - additionalProperties.toUnmodifiable(), - ) + fun build(): ProjectListResponse = + ProjectListResponse( + _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, - + 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 @@ -175,24 +160,16 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun totalPages(): Long = totalPages.getRequired("totalPages") /** The current page. */ - @JsonProperty("page") - @ExcludeMissing - fun _page() = page + @JsonProperty("page") @ExcludeMissing fun _page() = page /** The number of items per page. */ - @JsonProperty("perPage") - @ExcludeMissing - fun _perPage() = perPage + @JsonProperty("perPage") @ExcludeMissing fun _perPage() = perPage /** The total number of items. */ - @JsonProperty("totalItems") - @ExcludeMissing - fun _totalItems() = totalItems + @JsonProperty("totalItems") @ExcludeMissing fun _totalItems() = totalItems /** The total number of pages. */ - @JsonProperty("totalPages") - @ExcludeMissing - fun _totalPages() = totalPages + @JsonProperty("totalPages") @ExcludeMissing fun _totalPages() = totalPages @JsonAnyGetter @ExcludeMissing @@ -200,48 +177,49 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): _Meta = apply { if (!validated) { - page() - perPage() - totalItems() - totalPages() - validated = true + 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 + 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 + 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}" + override fun toString() = + "_Meta{page=$page, perPage=$perPage, totalItems=$totalItems, totalPages=$totalPages, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -267,9 +245,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The current page. */ @JsonProperty("page") @ExcludeMissing - fun page(page: JsonField) = apply { - this.page = page - } + fun page(page: JsonField) = apply { this.page = page } /** The number of items per page. */ fun perPage(perPage: Long) = perPage(JsonField.of(perPage)) @@ -277,9 +253,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The number of items per page. */ @JsonProperty("perPage") @ExcludeMissing - fun perPage(perPage: JsonField) = apply { - this.perPage = perPage - } + fun perPage(perPage: JsonField) = apply { this.perPage = perPage } /** The total number of items. */ fun totalItems(totalItems: Long) = totalItems(JsonField.of(totalItems)) @@ -287,9 +261,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The total number of items. */ @JsonProperty("totalItems") @ExcludeMissing - fun totalItems(totalItems: JsonField) = apply { - this.totalItems = totalItems - } + fun totalItems(totalItems: JsonField) = apply { this.totalItems = totalItems } /** The total number of pages. */ fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) @@ -297,9 +269,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The total number of pages. */ @JsonProperty("totalPages") @ExcludeMissing - fun totalPages(totalPages: JsonField) = apply { - this.totalPages = totalPages - } + fun totalPages(totalPages: JsonField) = apply { this.totalPages = totalPages } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -315,37 +285,38 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.putAll(additionalProperties) } - fun build(): _Meta = _Meta( - page, - perPage, - totalItems, - totalPages, - additionalProperties.toUnmodifiable(), - ) + 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 workspaceId: JsonField, - private val creatorId: JsonField, - private val name: JsonField, - private val dateCreated: JsonField, - private val dateUpdated: JsonField, - private val description: JsonField, - private val source: JsonField, - private val taskType: JsonField, - private val versionCount: JsonField, - private val inferencePipelineCount: JsonField, - private val goalCount: JsonField, - private val developmentGoalCount: JsonField, - private val monitoringGoalCount: JsonField, - private val links: JsonField, - private val gitRepo: JsonField, - private val additionalProperties: Map, - + class Item + private constructor( + private val id: JsonField, + private val workspaceId: JsonField, + private val creatorId: JsonField, + private val name: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val inferencePipelineCount: JsonField, + private val goalCount: JsonField, + private val developmentGoalCount: JsonField, + private val monitoringGoalCount: JsonField, + private val links: JsonField, + private val gitRepo: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -356,7 +327,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun id(): String = id.getRequired("id") /** The workspace id. */ - fun workspaceId(): Optional = Optional.ofNullable(workspaceId.getNullable("workspaceId")) + fun workspaceId(): Optional = + Optional.ofNullable(workspaceId.getNullable("workspaceId")) /** The project creator id. */ fun creatorId(): Optional = Optional.ofNullable(creatorId.getNullable("creatorId")) @@ -371,7 +343,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") /** The project description. */ - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** The source of the project. */ fun source(): Optional = Optional.ofNullable(source.getNullable("source")) @@ -383,7 +356,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun versionCount(): Long = versionCount.getRequired("versionCount") /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(): Long = inferencePipelineCount.getRequired("inferencePipelineCount") + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") /** The total number of tests in the project. */ fun goalCount(): Long = goalCount.getRequired("goalCount") @@ -400,54 +374,34 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun gitRepo(): Optional = Optional.ofNullable(gitRepo.getNullable("gitRepo")) /** The project id. */ - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The workspace id. */ - @JsonProperty("workspaceId") - @ExcludeMissing - fun _workspaceId() = workspaceId + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId() = workspaceId /** The project creator id. */ - @JsonProperty("creatorId") - @ExcludeMissing - fun _creatorId() = creatorId + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId() = creatorId /** The project name. */ - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The project creation date. */ - @JsonProperty("dateCreated") - @ExcludeMissing - fun _dateCreated() = dateCreated + @JsonProperty("dateCreated") @ExcludeMissing fun _dateCreated() = dateCreated /** The project last updated date. */ - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated /** The project description. */ - @JsonProperty("description") - @ExcludeMissing - fun _description() = description + @JsonProperty("description") @ExcludeMissing fun _description() = description /** The source of the project. */ - @JsonProperty("source") - @ExcludeMissing - fun _source() = source + @JsonProperty("source") @ExcludeMissing fun _source() = source /** The task type of the project. */ - @JsonProperty("taskType") - @ExcludeMissing - fun _taskType() = taskType + @JsonProperty("taskType") @ExcludeMissing fun _taskType() = taskType /** The number of versions (commits) in the project. */ - @JsonProperty("versionCount") - @ExcludeMissing - fun _versionCount() = versionCount + @JsonProperty("versionCount") @ExcludeMissing fun _versionCount() = versionCount /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -455,9 +409,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun _inferencePipelineCount() = inferencePipelineCount /** The total number of tests in the project. */ - @JsonProperty("goalCount") - @ExcludeMissing - fun _goalCount() = goalCount + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount() = goalCount /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -470,13 +422,9 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun _monitoringGoalCount() = monitoringGoalCount /** Links to the project. */ - @JsonProperty("links") - @ExcludeMissing - fun _links() = links + @JsonProperty("links") @ExcludeMissing fun _links() = links - @JsonProperty("gitRepo") - @ExcludeMissing - fun _gitRepo() = gitRepo + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo() = gitRepo @JsonAnyGetter @ExcludeMissing @@ -484,84 +432,85 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): Item = apply { if (!validated) { - id() - workspaceId() - creatorId() - name() - dateCreated() - dateUpdated() - description() - source() - taskType() - versionCount() - inferencePipelineCount() - goalCount() - developmentGoalCount() - monitoringGoalCount() - links().validate() - gitRepo().map { it.validate() } - validated = true + id() + workspaceId() + creatorId() + name() + dateCreated() + dateUpdated() + description() + source() + taskType() + versionCount() + inferencePipelineCount() + goalCount() + developmentGoalCount() + monitoringGoalCount() + links().validate() + gitRepo().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.workspaceId == other.workspaceId && - this.creatorId == other.creatorId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.source == other.source && - this.taskType == other.taskType && - this.versionCount == other.versionCount && - this.inferencePipelineCount == other.inferencePipelineCount && - this.goalCount == other.goalCount && - this.developmentGoalCount == other.developmentGoalCount && - this.monitoringGoalCount == other.monitoringGoalCount && - this.links == other.links && - this.gitRepo == other.gitRepo && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is Item && + this.id == other.id && + this.workspaceId == other.workspaceId && + this.creatorId == other.creatorId && + this.name == other.name && + this.dateCreated == other.dateCreated && + this.dateUpdated == other.dateUpdated && + this.description == other.description && + this.source == other.source && + this.taskType == other.taskType && + this.versionCount == other.versionCount && + this.inferencePipelineCount == other.inferencePipelineCount && + this.goalCount == other.goalCount && + this.developmentGoalCount == other.developmentGoalCount && + this.monitoringGoalCount == other.monitoringGoalCount && + this.links == other.links && + this.gitRepo == other.gitRepo && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "Item{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" + override fun toString() = + "Item{id=$id, workspaceId=$workspaceId, creatorId=$creatorId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, source=$source, taskType=$taskType, versionCount=$versionCount, inferencePipelineCount=$inferencePipelineCount, goalCount=$goalCount, developmentGoalCount=$developmentGoalCount, monitoringGoalCount=$monitoringGoalCount, links=$links, gitRepo=$gitRepo, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -611,9 +560,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The project id. */ @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } /** The workspace id. */ fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) @@ -631,9 +578,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The project creator id. */ @JsonProperty("creatorId") @ExcludeMissing - fun creatorId(creatorId: JsonField) = apply { - this.creatorId = creatorId - } + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } /** The project name. */ fun name(name: String) = name(JsonField.of(name)) @@ -641,9 +586,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The project name. */ @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } /** The project creation date. */ fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) @@ -681,9 +624,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The source of the project. */ @JsonProperty("source") @ExcludeMissing - fun source(source: JsonField) = apply { - this.source = source - } + fun source(source: JsonField) = apply { this.source = source } /** The task type of the project. */ fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) @@ -691,9 +632,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The task type of the project. */ @JsonProperty("taskType") @ExcludeMissing - fun taskType(taskType: JsonField) = apply { - this.taskType = taskType - } + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } /** The number of versions (commits) in the project. */ fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) @@ -706,7 +645,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta } /** The number of inference pipelines in the project. */ - fun inferencePipelineCount(inferencePipelineCount: Long) = inferencePipelineCount(JsonField.of(inferencePipelineCount)) + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) /** The number of inference pipelines in the project. */ @JsonProperty("inferencePipelineCount") @@ -721,12 +661,11 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** The total number of tests in the project. */ @JsonProperty("goalCount") @ExcludeMissing - fun goalCount(goalCount: JsonField) = apply { - this.goalCount = goalCount - } + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } /** The number of tests in the development mode of the project. */ - fun developmentGoalCount(developmentGoalCount: Long) = developmentGoalCount(JsonField.of(developmentGoalCount)) + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) /** The number of tests in the development mode of the project. */ @JsonProperty("developmentGoalCount") @@ -736,7 +675,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta } /** The number of tests in the monitoring mode of the project. */ - fun monitoringGoalCount(monitoringGoalCount: Long) = monitoringGoalCount(JsonField.of(monitoringGoalCount)) + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) /** The number of tests in the monitoring mode of the project. */ @JsonProperty("monitoringGoalCount") @@ -751,17 +691,13 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta /** Links to the project. */ @JsonProperty("links") @ExcludeMissing - fun links(links: JsonField) = apply { - this.links = links - } + fun links(links: JsonField) = apply { this.links = links } fun gitRepo(gitRepo: GitRepo) = gitRepo(JsonField.of(gitRepo)) @JsonProperty("gitRepo") @ExcludeMissing - fun gitRepo(gitRepo: JsonField) = apply { - this.gitRepo = gitRepo - } + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -777,31 +713,36 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.putAll(additionalProperties) } - fun build(): Item = Item( - id, - workspaceId, - creatorId, - name, - dateCreated, - dateUpdated, - description, - source, - taskType, - versionCount, - inferencePipelineCount, - goalCount, - developmentGoalCount, - monitoringGoalCount, - links, - gitRepo, - additionalProperties.toUnmodifiable(), - ) + fun build(): Item = + Item( + id, + workspaceId, + creatorId, + name, + dateCreated, + dateUpdated, + description, + source, + taskType, + versionCount, + inferencePipelineCount, + goalCount, + developmentGoalCount, + monitoringGoalCount, + links, + gitRepo, + additionalProperties.toUnmodifiable(), + ) } /** Links to the project. */ @JsonDeserialize(builder = Links.Builder::class) @NoAutoDetect - class Links private constructor(private val app: JsonField, private val additionalProperties: Map, ) { + class Links + private constructor( + private val app: JsonField, + private val additionalProperties: Map, + ) { private var validated: Boolean = false @@ -809,9 +750,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun app(): String = app.getRequired("app") - @JsonProperty("app") - @ExcludeMissing - fun _app() = app + @JsonProperty("app") @ExcludeMissing fun _app() = app @JsonAnyGetter @ExcludeMissing @@ -819,36 +758,35 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): Links = apply { if (!validated) { - app() - validated = true + app() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties + 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 + if (hashCode == 0) { + hashCode = Objects.hash(app, additionalProperties) + } + return hashCode } override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -866,9 +804,7 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("app") @ExcludeMissing - fun app(app: JsonField) = apply { - this.app = app - } + fun app(app: JsonField) = apply { this.app = app } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -880,26 +816,29 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } } - class Source @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class Source + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is Source && - this.value == other.value + return other is Source && this.value == other.value } override fun hashCode() = value.hashCode() @@ -930,35 +869,39 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta _UNKNOWN, } - fun value(): Value = when (this) { - WEB -> Value.WEB - API -> Value.API - NULL -> Value.NULL - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + NULL -> Value.NULL + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - WEB -> Known.WEB - API -> Known.API - NULL -> Known.NULL - else -> throw OpenlayerInvalidDataException("Unknown Source: $value") - } + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + NULL -> Known.NULL + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } fun asString(): String = _value().asStringOrThrow() } - class TaskType @JsonCreator private constructor(private val value: JsonField, ) : Enum { + class TaskType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + if (this === other) { + return true + } - return other is TaskType && - this.value == other.value + return other is TaskType && this.value == other.value } override fun hashCode() = value.hashCode() @@ -969,7 +912,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JvmField val LLM_BASE = TaskType(JsonField.of("llm-base")) - @JvmField val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) + @JvmField + val TABULAR_CLASSIFICATION = TaskType(JsonField.of("tabular-classification")) @JvmField val TABULAR_REGRESSION = TaskType(JsonField.of("tabular-regression")) @@ -993,42 +937,44 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta _UNKNOWN, } - fun value(): Value = when (this) { - LLM_BASE -> Value.LLM_BASE - TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Value.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION - else -> Value._UNKNOWN - } + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } - fun known(): Known = when (this) { - LLM_BASE -> Known.LLM_BASE - TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION - TABULAR_REGRESSION -> Known.TABULAR_REGRESSION - TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION - else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") - } + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } fun asString(): String = _value().asStringOrThrow() } @JsonDeserialize(builder = GitRepo.Builder::class) @NoAutoDetect - class GitRepo private constructor( - private val id: JsonField, - private val gitId: JsonField, - private val dateConnected: JsonField, - private val dateUpdated: JsonField, - private val branch: JsonField, - private val name: JsonField, - private val private_: JsonField, - private val slug: JsonField, - private val url: JsonField, - private val rootDir: JsonField, - private val projectId: JsonField, - private val gitAccountId: JsonField, - private val additionalProperties: Map, - + class GitRepo + private constructor( + private val id: JsonField, + private val gitId: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val branch: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val rootDir: JsonField, + private val projectId: JsonField, + private val gitAccountId: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -1059,53 +1005,29 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") - @JsonProperty("id") - @ExcludeMissing - fun _id() = id + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("gitId") - @ExcludeMissing - fun _gitId() = gitId + @JsonProperty("gitId") @ExcludeMissing fun _gitId() = gitId - @JsonProperty("dateConnected") - @ExcludeMissing - fun _dateConnected() = dateConnected + @JsonProperty("dateConnected") @ExcludeMissing fun _dateConnected() = dateConnected - @JsonProperty("dateUpdated") - @ExcludeMissing - fun _dateUpdated() = dateUpdated + @JsonProperty("dateUpdated") @ExcludeMissing fun _dateUpdated() = dateUpdated - @JsonProperty("branch") - @ExcludeMissing - fun _branch() = branch + @JsonProperty("branch") @ExcludeMissing fun _branch() = branch - @JsonProperty("name") - @ExcludeMissing - fun _name() = name + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("private") - @ExcludeMissing - fun _private_() = private_ + @JsonProperty("private") @ExcludeMissing fun _private_() = private_ - @JsonProperty("slug") - @ExcludeMissing - fun _slug() = slug + @JsonProperty("slug") @ExcludeMissing fun _slug() = slug - @JsonProperty("url") - @ExcludeMissing - fun _url() = url + @JsonProperty("url") @ExcludeMissing fun _url() = url - @JsonProperty("rootDir") - @ExcludeMissing - fun _rootDir() = rootDir + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir() = rootDir - @JsonProperty("projectId") - @ExcludeMissing - fun _projectId() = projectId + @JsonProperty("projectId") @ExcludeMissing fun _projectId() = projectId - @JsonProperty("gitAccountId") - @ExcludeMissing - fun _gitAccountId() = gitAccountId + @JsonProperty("gitAccountId") @ExcludeMissing fun _gitAccountId() = gitAccountId @JsonAnyGetter @ExcludeMissing @@ -1113,72 +1035,73 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta fun validate(): GitRepo = apply { if (!validated) { - id() - gitId() - dateConnected() - dateUpdated() - branch() - name() - private_() - slug() - url() - rootDir() - projectId() - gitAccountId() - validated = true + id() + gitId() + dateConnected() + dateUpdated() + branch() + name() + private_() + slug() + url() + rootDir() + projectId() + gitAccountId() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is GitRepo && - this.id == other.id && - this.gitId == other.gitId && - this.dateConnected == other.dateConnected && - this.dateUpdated == other.dateUpdated && - this.branch == other.branch && - this.name == other.name && - this.private_ == other.private_ && - this.slug == other.slug && - this.url == other.url && - this.rootDir == other.rootDir && - this.projectId == other.projectId && - this.gitAccountId == other.gitAccountId && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is GitRepo && + this.id == other.id && + this.gitId == other.gitId && + this.dateConnected == other.dateConnected && + this.dateUpdated == other.dateUpdated && + this.branch == other.branch && + this.name == other.name && + this.private_ == other.private_ && + this.slug == other.slug && + this.url == other.url && + this.rootDir == other.rootDir && + this.projectId == other.projectId && + this.gitAccountId == other.gitAccountId && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" + override fun toString() = + "GitRepo{id=$id, gitId=$gitId, dateConnected=$dateConnected, dateUpdated=$dateUpdated, branch=$branch, name=$name, private_=$private_, slug=$slug, url=$url, rootDir=$rootDir, projectId=$projectId, gitAccountId=$gitAccountId, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -1218,19 +1141,16 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("id") @ExcludeMissing - fun id(id: JsonField) = apply { - this.id = id - } + fun id(id: JsonField) = apply { this.id = id } fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) @JsonProperty("gitId") @ExcludeMissing - fun gitId(gitId: JsonField) = apply { - this.gitId = gitId - } + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } - fun dateConnected(dateConnected: OffsetDateTime) = dateConnected(JsonField.of(dateConnected)) + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) @JsonProperty("dateConnected") @ExcludeMissing @@ -1238,7 +1158,8 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.dateConnected = dateConnected } - fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) @JsonProperty("dateUpdated") @ExcludeMissing @@ -1250,57 +1171,43 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta @JsonProperty("branch") @ExcludeMissing - fun branch(branch: JsonField) = apply { - this.branch = branch - } + fun branch(branch: JsonField) = apply { this.branch = branch } fun name(name: String) = name(JsonField.of(name)) @JsonProperty("name") @ExcludeMissing - fun name(name: JsonField) = apply { - this.name = name - } + fun name(name: JsonField) = apply { this.name = name } fun private_(private_: Boolean) = private_(JsonField.of(private_)) @JsonProperty("private") @ExcludeMissing - fun private_(private_: JsonField) = apply { - this.private_ = private_ - } + fun private_(private_: JsonField) = apply { this.private_ = private_ } fun slug(slug: String) = slug(JsonField.of(slug)) @JsonProperty("slug") @ExcludeMissing - fun slug(slug: JsonField) = apply { - this.slug = slug - } + fun slug(slug: JsonField) = apply { this.slug = slug } fun url(url: String) = url(JsonField.of(url)) @JsonProperty("url") @ExcludeMissing - fun url(url: JsonField) = apply { - this.url = url - } + fun url(url: JsonField) = apply { this.url = url } fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) @JsonProperty("rootDir") @ExcludeMissing - fun rootDir(rootDir: JsonField) = apply { - this.rootDir = rootDir - } + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } fun projectId(projectId: String) = projectId(JsonField.of(projectId)) @JsonProperty("projectId") @ExcludeMissing - fun projectId(projectId: JsonField) = apply { - this.projectId = projectId - } + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) @@ -1320,25 +1227,27 @@ class ProjectListResponse private constructor(private val _meta: JsonField<_Meta this.additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): GitRepo = GitRepo( - id, - gitId, - dateConnected, - dateUpdated, - branch, - name, - private_, - slug, - url, - rootDir, - projectId, - gitAccountId, - additionalProperties.toUnmodifiable(), - ) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GitRepo = + GitRepo( + id, + gitId, + dateConnected, + dateUpdated, + branch, + name, + private_, + slug, + url, + rootDir, + projectId, + gitAccountId, + additionalProperties.toUnmodifiable(), + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt index 86d7d09..e5085a5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParams.kt @@ -2,67 +2,37 @@ 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.JsonIgnoreProperties -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.apache.hc.core5.http.ContentType -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow -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.MultipartFormValue -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.core.Enum -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.models.* +import java.util.Objects +import java.util.Optional -class StoragePresignedUrlCreateParams constructor( - private val objectName: String, - private val additionalQueryParams: Map>, - private val additionalHeaders: Map>, - private val additionalBodyProperties: Map, - +class StoragePresignedUrlCreateParams +constructor( + private val objectName: String, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, ) { fun objectName(): String = objectName @JvmSynthetic internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } @JvmSynthetic internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.objectName.let { - params.put("objectName", listOf(it.toString())) - } - params.putAll(additionalQueryParams) - return params.toUnmodifiable() + val params = mutableMapOf>() + this.objectName.let { params.put("objectName", listOf(it.toString())) } + params.putAll(additionalQueryParams) + return params.toUnmodifiable() } - @JvmSynthetic - internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams @@ -71,34 +41,34 @@ class StoragePresignedUrlCreateParams constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StoragePresignedUrlCreateParams && - this.objectName == other.objectName && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateParams && + this.objectName == other.objectName && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties } override fun hashCode(): Int { - return Objects.hash( - objectName, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return Objects.hash( + objectName, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) } - override fun toString() = "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + override fun toString() = + "StoragePresignedUrlCreateParams{objectName=$objectName, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } @NoAutoDetect @@ -110,17 +80,16 @@ class StoragePresignedUrlCreateParams constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = apply { - this.objectName = storagePresignedUrlCreateParams.objectName - additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) - additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) - additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) - } + internal fun from(storagePresignedUrlCreateParams: StoragePresignedUrlCreateParams) = + apply { + this.objectName = storagePresignedUrlCreateParams.objectName + additionalQueryParams(storagePresignedUrlCreateParams.additionalQueryParams) + additionalHeaders(storagePresignedUrlCreateParams.additionalHeaders) + additionalBodyProperties(storagePresignedUrlCreateParams.additionalBodyProperties) + } /** The name of the object. */ - fun objectName(objectName: String) = apply { - this.objectName = objectName - } + fun objectName(objectName: String) = apply { this.objectName = objectName } fun additionalQueryParams(additionalQueryParams: Map>) = apply { this.additionalQueryParams.clear() @@ -160,9 +129,7 @@ class StoragePresignedUrlCreateParams constructor( additionalHeaders.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { - this.additionalHeaders.put(name, mutableListOf()) - } + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -173,17 +140,17 @@ class StoragePresignedUrlCreateParams constructor( this.additionalBodyProperties.put(key, value) } - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun build(): StoragePresignedUrlCreateParams = StoragePresignedUrlCreateParams( - checkNotNull(objectName) { - "`objectName` is required but was not set" - }, - additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), - additionalBodyProperties.toUnmodifiable(), - ) + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): StoragePresignedUrlCreateParams = + StoragePresignedUrlCreateParams( + checkNotNull(objectName) { "`objectName` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt index cdccfb8..57c2fca 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponse.kt @@ -4,43 +4,24 @@ 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.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import java.util.UUID -import com.openlayer.api.core.BaseDeserializer -import com.openlayer.api.core.BaseSerializer -import com.openlayer.api.core.getOrThrow 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.JsonNull -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.Enum -import com.openlayer.api.core.toUnmodifiable import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.toUnmodifiable +import java.util.Objects @JsonDeserialize(builder = StoragePresignedUrlCreateResponse.Builder::class) @NoAutoDetect -class StoragePresignedUrlCreateResponse private constructor( - private val url: JsonField, - private val fields: JsonValue, - private val storageUri: JsonField, - private val additionalProperties: Map, - +class StoragePresignedUrlCreateResponse +private constructor( + private val url: JsonField, + private val fields: JsonValue, + private val storageUri: JsonField, + private val additionalProperties: Map, ) { private var validated: Boolean = false @@ -54,19 +35,13 @@ class StoragePresignedUrlCreateResponse private constructor( fun storageUri(): String = storageUri.getRequired("storageUri") /** The presigned url. */ - @JsonProperty("url") - @ExcludeMissing - fun _url() = url + @JsonProperty("url") @ExcludeMissing fun _url() = url /** Fields to include in the body of the upload. Only needed by s3. */ - @JsonProperty("fields") - @ExcludeMissing - fun _fields() = fields + @JsonProperty("fields") @ExcludeMissing fun _fields() = fields /** The storage URI to send back to the backend after the upload was completed. */ - @JsonProperty("storageUri") - @ExcludeMissing - fun _storageUri() = storageUri + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri() = storageUri @JsonAnyGetter @ExcludeMissing @@ -74,44 +49,45 @@ class StoragePresignedUrlCreateResponse private constructor( fun validate(): StoragePresignedUrlCreateResponse = apply { if (!validated) { - url() - storageUri() - validated = true + url() + storageUri() + validated = true } } fun toBuilder() = Builder().from(this) override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StoragePresignedUrlCreateResponse && - this.url == other.url && - this.fields == other.fields && - this.storageUri == other.storageUri && - this.additionalProperties == other.additionalProperties + if (this === other) { + return true + } + + return other is StoragePresignedUrlCreateResponse && + this.url == other.url && + this.fields == other.fields && + this.storageUri == other.storageUri && + this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash( - url, - fields, - storageUri, - additionalProperties, - ) - } - return hashCode + if (hashCode == 0) { + hashCode = + Objects.hash( + url, + fields, + storageUri, + additionalProperties, + ) + } + return hashCode } - override fun toString() = "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" + override fun toString() = + "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" companion object { - @JvmStatic - fun builder() = Builder() + @JvmStatic fun builder() = Builder() } class Builder { @@ -122,12 +98,13 @@ class StoragePresignedUrlCreateResponse private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(storagePresignedUrlCreateResponse: StoragePresignedUrlCreateResponse) = apply { - this.url = storagePresignedUrlCreateResponse.url - this.fields = storagePresignedUrlCreateResponse.fields - this.storageUri = storagePresignedUrlCreateResponse.storageUri - additionalProperties(storagePresignedUrlCreateResponse.additionalProperties) - } + internal fun from(storagePresignedUrlCreateResponse: StoragePresignedUrlCreateResponse) = + apply { + this.url = storagePresignedUrlCreateResponse.url + this.fields = storagePresignedUrlCreateResponse.fields + this.storageUri = storagePresignedUrlCreateResponse.storageUri + additionalProperties(storagePresignedUrlCreateResponse.additionalProperties) + } /** The presigned url. */ fun url(url: String) = url(JsonField.of(url)) @@ -135,16 +112,12 @@ class StoragePresignedUrlCreateResponse private constructor( /** The presigned url. */ @JsonProperty("url") @ExcludeMissing - fun url(url: JsonField) = apply { - this.url = url - } + fun url(url: JsonField) = apply { this.url = url } /** Fields to include in the body of the upload. Only needed by s3. */ @JsonProperty("fields") @ExcludeMissing - fun fields(fields: JsonValue) = apply { - this.fields = fields - } + fun fields(fields: JsonValue) = apply { this.fields = fields } /** The storage URI to send back to the backend after the upload was completed. */ fun storageUri(storageUri: String) = storageUri(JsonField.of(storageUri)) @@ -152,9 +125,7 @@ class StoragePresignedUrlCreateResponse private constructor( /** The storage URI to send back to the backend after the upload was completed. */ @JsonProperty("storageUri") @ExcludeMissing - fun storageUri(storageUri: JsonField) = apply { - this.storageUri = storageUri - } + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -170,11 +141,12 @@ class StoragePresignedUrlCreateResponse private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): StoragePresignedUrlCreateResponse = StoragePresignedUrlCreateResponse( - url, - fields, - storageUri, - additionalProperties.toUnmodifiable(), - ) + fun build(): StoragePresignedUrlCreateResponse = + StoragePresignedUrlCreateResponse( + url, + fields, + storageUri, + additionalProperties.toUnmodifiable(), + ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt index 4ebcf64..357020c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/Handlers.kt @@ -2,37 +2,33 @@ package com.openlayer.api.services -import java.io.InputStream -import java.io.OutputStream import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.http.BinaryResponseContent import com.openlayer.api.core.http.HttpResponse import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerException -import com.openlayer.api.errors.OpenlayerServiceException -import com.openlayer.api.errors.InternalServerException import com.openlayer.api.errors.BadRequestException +import com.openlayer.api.errors.InternalServerException import com.openlayer.api.errors.NotFoundException +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.OpenlayerException import com.openlayer.api.errors.PermissionDeniedException import com.openlayer.api.errors.RateLimitException import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException +import java.io.InputStream +import java.io.OutputStream -@JvmSynthetic -internal fun emptyHandler(): Handler = EmptyHandler +@JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandler private object EmptyHandler : Handler { override fun handle(response: HttpResponse): Void? = null } -@JvmSynthetic -internal fun stringHandler(): Handler = StringHandler +@JvmSynthetic internal fun stringHandler(): Handler = StringHandler -@JvmSynthetic -internal fun binaryHandler(): Handler = BinaryHandler +@JvmSynthetic internal fun binaryHandler(): Handler = BinaryHandler private object StringHandler : Handler { override fun handle(response: HttpResponse): String { @@ -42,7 +38,7 @@ private object StringHandler : Handler { private object BinaryHandler : Handler { override fun handle(response: HttpResponse): BinaryResponseContent { - return BinaryResponseContentImpl(response); + return BinaryResponseContentImpl(response) } } @@ -81,10 +77,19 @@ internal fun Handler.withErrorHandler(errorHandler: Handler return this@withErrorHandler.handle(response) 400 -> throw BadRequestException(response.headers(), errorHandler.handle(response)) - 401 -> throw UnauthorizedException(response.headers(), errorHandler.handle(response)) - 403 -> throw PermissionDeniedException(response.headers(), errorHandler.handle(response)) + 401 -> + throw UnauthorizedException(response.headers(), errorHandler.handle(response)) + 403 -> + throw PermissionDeniedException( + response.headers(), + errorHandler.handle(response) + ) 404 -> throw NotFoundException(response.headers(), errorHandler.handle(response)) - 422 -> throw UnprocessableEntityException(response.headers(), errorHandler.handle(response)) + 422 -> + throw UnprocessableEntityException( + response.headers(), + errorHandler.handle(response) + ) 429 -> throw RateLimitException(response.headers(), errorHandler.handle(response)) in 500..599 -> throw InternalServerException( @@ -105,22 +110,21 @@ internal fun Handler.withErrorHandler(errorHandler: Handler json( @@ -50,7 +50,10 @@ internal inline fun json( } @JvmSynthetic -internal fun multipartFormData(jsonMapper: JsonMapper, parts: Array?>): HttpRequestBody { +internal fun multipartFormData( + jsonMapper: JsonMapper, + parts: Array?> +): HttpRequestBody { val builder = MultipartEntityBuilder.create() parts.forEach { part -> if (part?.value != null) { @@ -62,16 +65,30 @@ internal fun multipartFormData(jsonMapper: JsonMapper, parts: Array builder.addTextBody (part.name, if (part.value) "true" else "false", part.contentType) + is Boolean -> + builder.addTextBody( + part.name, + if (part.value) "true" else "false", + part.contentType + ) is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) is Double -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - is ByteArray -> builder.addBinaryBody(part.name, part.value, part.contentType, part.filename) + is ByteArray -> + builder.addBinaryBody(part.name, part.value, part.contentType, part.filename) is String -> builder.addTextBody(part.name, part.value, part.contentType) is Enum -> builder.addTextBody(part.name, part.value.toString(), part.contentType) - else -> throw IllegalArgumentException("Unsupported content type: ${part.value::class.java.simpleName}") + else -> + throw IllegalArgumentException( + "Unsupported content type: ${part.value::class.java.simpleName}" + ) } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt index a3626b2..92fd5e9 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsync.kt @@ -4,41 +4,7 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.commits.TestResultServiceAsync -import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl interface CommitServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt index e9b4b48..ef73e6d 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/CommitServiceAsyncImpl.kt @@ -2,47 +2,23 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.commits.TestResultServiceAsync import com.openlayer.api.services.async.commits.TestResultServiceAsyncImpl +import com.openlayer.api.services.errorHandler -class CommitServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : CommitServiceAsync { +class CommitServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } + private val testResults: TestResultServiceAsync by lazy { + TestResultServiceAsyncImpl(clientOptions) + } override fun testResults(): TestResultServiceAsync = testResults } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt index 567e05e..b4419d4 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsync.kt @@ -4,45 +4,9 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync -import com.openlayer.api.services.async.inferencePipelines.DataServiceAsyncImpl import com.openlayer.api.services.async.inferencePipelines.RowServiceAsync -import com.openlayer.api.services.async.inferencePipelines.RowServiceAsyncImpl import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync -import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsyncImpl interface InferencePipelineServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt index 79cb3f9..5518aff 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/InferencePipelineServiceAsyncImpl.kt @@ -2,47 +2,21 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.inferencePipelines.DataServiceAsync import com.openlayer.api.services.async.inferencePipelines.DataServiceAsyncImpl import com.openlayer.api.services.async.inferencePipelines.RowServiceAsync import com.openlayer.api.services.async.inferencePipelines.RowServiceAsyncImpl import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsync import com.openlayer.api.services.async.inferencePipelines.TestResultServiceAsyncImpl +import com.openlayer.api.services.errorHandler -class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { +class InferencePipelineServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -50,7 +24,9 @@ class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: C private val rows: RowServiceAsync by lazy { RowServiceAsyncImpl(clientOptions) } - private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } + private val testResults: TestResultServiceAsync by lazy { + TestResultServiceAsyncImpl(clientOptions) + } override fun data(): DataServiceAsync = data diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt index 91eb662..bc149ca 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsync.kt @@ -4,47 +4,14 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse import com.openlayer.api.models.ProjectListParams import com.openlayer.api.models.ProjectListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.projects.CommitServiceAsync -import com.openlayer.api.services.async.projects.CommitServiceAsyncImpl import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync -import com.openlayer.api.services.async.projects.InferencePipelineServiceAsyncImpl +import java.util.concurrent.CompletableFuture interface ProjectServiceAsync { @@ -54,9 +21,15 @@ interface ProjectServiceAsync { /** Create a project in your workspace. */ @JvmOverloads - fun create(params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture /** List your workspace's projects. */ @JvmOverloads - fun list(params: ProjectListParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun list( + params: ProjectListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt index 0b4a884..b49f449 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/ProjectServiceAsyncImpl.kt @@ -2,112 +2,99 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateResponse -import com.openlayer.api.models.ProjectListParams -import com.openlayer.api.models.ProjectListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import com.openlayer.api.models.ProjectCreateParams +import com.openlayer.api.models.ProjectCreateResponse +import com.openlayer.api.models.ProjectListParams +import com.openlayer.api.models.ProjectListResponse import com.openlayer.api.services.async.projects.CommitServiceAsync import com.openlayer.api.services.async.projects.CommitServiceAsyncImpl import com.openlayer.api.services.async.projects.InferencePipelineServiceAsync import com.openlayer.api.services.async.projects.InferencePipelineServiceAsyncImpl +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 ProjectServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : ProjectServiceAsync { +class ProjectServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : ProjectServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } - private val inferencePipelines: InferencePipelineServiceAsync by lazy { InferencePipelineServiceAsyncImpl(clientOptions) } + private val inferencePipelines: InferencePipelineServiceAsync by lazy { + InferencePipelineServiceAsyncImpl(clientOptions) + } override fun commits(): CommitServiceAsync = commits override fun inferencePipelines(): InferencePipelineServiceAsync = inferencePipelines private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Create a project in your workspace. */ - override fun create(params: ProjectCreateParams, requestOptions: RequestOptions): CompletableFuture { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects") - .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() - } - } - } + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .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) + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** List your workspace's projects. */ - override fun list(params: ProjectListParams, requestOptions: RequestOptions): CompletableFuture { - val request = HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects") - .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() - } - } - } + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .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/StorageServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt index 831de31..6a59073 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsync.kt @@ -4,41 +4,7 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync -import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl interface StorageServiceAsync { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt index dac3cb2..2dd732c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/StorageServiceAsyncImpl.kt @@ -2,47 +2,23 @@ package com.openlayer.api.services.async -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync import com.openlayer.api.services.async.storage.PresignedUrlServiceAsyncImpl +import com.openlayer.api.services.errorHandler -class StorageServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : StorageServiceAsync { +class StorageServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : StorageServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val presignedUrl: PresignedUrlServiceAsync by lazy { PresignedUrlServiceAsyncImpl(clientOptions) } + private val presignedUrl: PresignedUrlServiceAsync by lazy { + PresignedUrlServiceAsyncImpl(clientOptions) + } override fun presignedUrl(): PresignedUrlServiceAsync = presignedUrl } 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 a466cbe..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,45 +4,17 @@ package com.openlayer.api.services.async.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +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 + 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 a200f69..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 @@ -2,70 +2,53 @@ package com.openlayer.api.services.async.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : TestResultServiceAsync { +class TestResultServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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 3fab390..4f079ec 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,45 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface DataServiceAsync { /** Publish an inference data point to an inference pipeline. */ @JvmOverloads - fun stream(params: InferencePipelineDataStreamParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 23f28ed..bbbf784 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 @@ -2,71 +2,55 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +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.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class DataServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : DataServiceAsync { +class DataServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : DataServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** Publish an inference data point 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() - } - } - } + 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/RowServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt index 40dfad8..4522c37 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsync.kt @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface RowServiceAsync { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt index 8fe8680..9304fa7 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/inferencePipelines/RowServiceAsyncImpl.kt @@ -2,71 +2,55 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class RowServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : RowServiceAsync { +class RowServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : RowServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** Update an inference data point in an inference pipeline. */ - override fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions): CompletableFuture { - val request = HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") - .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 { - updateHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .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 { updateHandler.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 7b0b75c..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,45 +4,17 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +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 + 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 3bdda30..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 @@ -2,70 +2,53 @@ package com.openlayer.api.services.async.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class TestResultServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : TestResultServiceAsync { +class TestResultServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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 1157a3e..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,45 +4,17 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +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 + 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 8f74835..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 @@ -2,70 +2,53 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class CommitServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : CommitServiceAsync { +class CommitServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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 f9abcdd..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,51 +4,26 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +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 com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface InferencePipelineServiceAsync { /** Create an inference pipeline in a project. */ @JvmOverloads - fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + 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 + 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 656838b..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 @@ -2,100 +2,87 @@ package com.openlayer.api.services.async.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -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.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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +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.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class InferencePipelineServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineServiceAsync { +class InferencePipelineServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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) + 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() - } - } - } + 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/async/storage/PresignedUrlServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt index 3037188..933abd8 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt @@ -4,45 +4,17 @@ package com.openlayer.api.services.async.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture interface PresignedUrlServiceAsync { /** Retrieve a presigned url to post storage artifacts. */ @JvmOverloads - fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none()): CompletableFuture + fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index d084d4a..65a6972 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -2,75 +2,55 @@ package com.openlayer.api.services.async.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler +import java.util.concurrent.CompletableFuture -class PresignedUrlServiceAsyncImpl constructor(private val clientOptions: ClientOptions, ) : PresignedUrlServiceAsync { +class PresignedUrlServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : PresignedUrlServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** Retrieve a presigned url to post storage artifacts. */ - override fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions): CompletableFuture { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("storage", "presigned-url") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .apply { - params.getBody().ifPresent { - body(json(clientOptions.jsonMapper, it)) - } + override fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } } - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions) - .thenApply { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt index 2399953..86553e1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitService.kt @@ -4,41 +4,7 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.commits.TestResultService -import com.openlayer.api.services.blocking.commits.TestResultServiceImpl interface CommitService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt index 4def18e..cae0abd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/CommitServiceImpl.kt @@ -2,43 +2,17 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.services.blocking.commits.TestResultServiceImpl +import com.openlayer.api.services.errorHandler -class CommitServiceImpl constructor(private val clientOptions: ClientOptions, ) : CommitService { +class CommitServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt index fc40959..157d71f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineService.kt @@ -4,45 +4,9 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.inferencePipelines.DataService -import com.openlayer.api.services.blocking.inferencePipelines.DataServiceImpl import com.openlayer.api.services.blocking.inferencePipelines.RowService -import com.openlayer.api.services.blocking.inferencePipelines.RowServiceImpl import com.openlayer.api.services.blocking.inferencePipelines.TestResultService -import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceImpl interface InferencePipelineService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt index 562c292..2267d4a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceImpl.kt @@ -2,47 +2,21 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.inferencePipelines.DataService import com.openlayer.api.services.blocking.inferencePipelines.DataServiceImpl import com.openlayer.api.services.blocking.inferencePipelines.RowService import com.openlayer.api.services.blocking.inferencePipelines.RowServiceImpl import com.openlayer.api.services.blocking.inferencePipelines.TestResultService import com.openlayer.api.services.blocking.inferencePipelines.TestResultServiceImpl +import com.openlayer.api.services.errorHandler -class InferencePipelineServiceImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineService { +class InferencePipelineServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt index 2cd51fd..a9e58d1 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectService.kt @@ -4,47 +4,13 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse import com.openlayer.api.models.ProjectListParams import com.openlayer.api.models.ProjectListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.projects.CommitService -import com.openlayer.api.services.blocking.projects.CommitServiceImpl import com.openlayer.api.services.blocking.projects.InferencePipelineService -import com.openlayer.api.services.blocking.projects.InferencePipelineServiceImpl interface ProjectService { @@ -54,9 +20,15 @@ interface ProjectService { /** Create a project in your workspace. */ @JvmOverloads - fun create(params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectCreateResponse + fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectCreateResponse /** List your workspace's projects. */ @JvmOverloads - fun list(params: ProjectListParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectListResponse + fun list( + params: ProjectListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): ProjectListResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt index d68b80d..e441602 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/ProjectServiceImpl.kt @@ -2,112 +2,96 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateResponse -import com.openlayer.api.models.ProjectListParams -import com.openlayer.api.models.ProjectListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler +import com.openlayer.api.models.ProjectCreateParams +import com.openlayer.api.models.ProjectCreateResponse +import com.openlayer.api.models.ProjectListParams +import com.openlayer.api.models.ProjectListResponse import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.services.blocking.projects.CommitServiceImpl import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.services.blocking.projects.InferencePipelineServiceImpl +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 ProjectServiceImpl constructor(private val clientOptions: ClientOptions, ) : ProjectService { +class ProjectServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : ProjectService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } - private val inferencePipelines: InferencePipelineService by lazy { InferencePipelineServiceImpl(clientOptions) } + private val inferencePipelines: InferencePipelineService by lazy { + InferencePipelineServiceImpl(clientOptions) + } override fun commits(): CommitService = commits override fun inferencePipelines(): InferencePipelineService = inferencePipelines private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Create a project in your workspace. */ - override fun create(params: ProjectCreateParams, requestOptions: RequestOptions): ProjectCreateResponse { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("projects") - .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() - } - } - } + override fun create( + params: ProjectCreateParams, + requestOptions: RequestOptions + ): ProjectCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("projects") + .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) + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** List your workspace's projects. */ - override fun list(params: ProjectListParams, requestOptions: RequestOptions): ProjectListResponse { - val request = HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("projects") - .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() - } - } - } + override fun list( + params: ProjectListParams, + requestOptions: RequestOptions + ): ProjectListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("projects") + .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/StorageService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt index 072edaa..bd8b0a0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageService.kt @@ -4,41 +4,7 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.storage.PresignedUrlService -import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl interface StorageService { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt index 152a709..25ff043 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/StorageServiceImpl.kt @@ -2,43 +2,17 @@ package com.openlayer.api.services.blocking -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.services.blocking.storage.PresignedUrlServiceImpl +import com.openlayer.api.services.errorHandler -class StorageServiceImpl constructor(private val clientOptions: ClientOptions, ) : StorageService { +class StorageServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : StorageService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 02b5449..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,45 +4,16 @@ package com.openlayer.api.services.blocking.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface TestResultService { /** List the test results for a project commit (project version). */ @JvmOverloads - fun list(params: CommitTestResultListParams, requestOptions: RequestOptions = RequestOptions.none()): CommitTestResultListResponse + 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 9b3716f..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 @@ -2,70 +2,51 @@ package com.openlayer.api.services.blocking.commits -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.CommitTestResultListParams -import com.openlayer.api.models.CommitTestResultListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.CommitTestResultListParams +import com.openlayer.api.models.CommitTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class TestResultServiceImpl constructor(private val clientOptions: ClientOptions, ) : TestResultService { +class TestResultServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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 973e01e..bbfd2cf 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,45 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface DataService { /** Publish an inference data point to an inference pipeline. */ @JvmOverloads - fun stream(params: InferencePipelineDataStreamParams, requestOptions: RequestOptions = RequestOptions.none()): InferencePipelineDataStreamResponse + 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 f4657c4..41c4268 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 @@ -2,71 +2,53 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +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.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class DataServiceImpl constructor(private val clientOptions: ClientOptions, ) : DataService { +class DataServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : DataService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val streamHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** Publish an inference data point 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() - } - } - } + 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/RowService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt index 771f4f0..3548f85 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowService.kt @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineRowUpdateParams import com.openlayer.api.models.InferencePipelineRowUpdateResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface RowService { /** Update an inference data point in an inference pipeline. */ @JvmOverloads - fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions = RequestOptions.none()): InferencePipelineRowUpdateResponse + fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): InferencePipelineRowUpdateResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt index 664a7d9..d5f73a0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceImpl.kt @@ -2,71 +2,53 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineRowUpdateParams +import com.openlayer.api.models.InferencePipelineRowUpdateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class RowServiceImpl constructor(private val clientOptions: ClientOptions, ) : RowService { +class RowServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : RowService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** Update an inference data point in an inference pipeline. */ - override fun update(params: InferencePipelineRowUpdateParams, requestOptions: RequestOptions): InferencePipelineRowUpdateResponse { - val request = HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") - .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 { - updateHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } + override fun update( + params: InferencePipelineRowUpdateParams, + requestOptions: RequestOptions + ): InferencePipelineRowUpdateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .addPathSegments("inference-pipelines", params.getPathParam(0), "rows") + .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 { updateHandler.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 7688894..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,45 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface TestResultService { /** List the latest test results for an inference pipeline. */ @JvmOverloads - fun list(params: InferencePipelineTestResultListParams, requestOptions: RequestOptions = RequestOptions.none()): InferencePipelineTestResultListResponse + 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 431decf..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 @@ -2,70 +2,51 @@ package com.openlayer.api.services.blocking.inferencePipelines -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.InferencePipelineTestResultListParams -import com.openlayer.api.models.InferencePipelineTestResultListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.InferencePipelineTestResultListParams +import com.openlayer.api.models.InferencePipelineTestResultListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class TestResultServiceImpl constructor(private val clientOptions: ClientOptions, ) : TestResultService { +class TestResultServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : TestResultService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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 6f1451a..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,45 +4,16 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface CommitService { /** List the commits (project versions) in a project. */ @JvmOverloads - fun list(params: ProjectCommitListParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectCommitListResponse + 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 298595e..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 @@ -2,70 +2,51 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.ProjectCommitListParams -import com.openlayer.api.models.ProjectCommitListResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.ProjectCommitListParams +import com.openlayer.api.models.ProjectCommitListResponse import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class CommitServiceImpl constructor(private val clientOptions: ClientOptions, ) : CommitService { +class CommitServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : CommitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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 82b7049..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,51 +4,25 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +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 com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface InferencePipelineService { /** Create an inference pipeline in a project. */ @JvmOverloads - fun create(params: ProjectInferencePipelineCreateParams, requestOptions: RequestOptions = RequestOptions.none()): ProjectInferencePipelineCreateResponse + 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 + 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 aff9b37..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 @@ -2,100 +2,84 @@ package com.openlayer.api.services.blocking.projects -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -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.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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +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.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class InferencePipelineServiceImpl constructor(private val clientOptions: ClientOptions, ) : InferencePipelineService { +class InferencePipelineServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : InferencePipelineService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + 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() - } - } - } + 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) + 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() - } - } - } + 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/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt index f1e6882..6cc179e 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt @@ -4,45 +4,16 @@ package com.openlayer.api.services.blocking.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException +import com.openlayer.api.core.RequestOptions import com.openlayer.api.models.StoragePresignedUrlCreateParams import com.openlayer.api.models.StoragePresignedUrlCreateResponse -import com.openlayer.api.core.ClientOptions -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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler -import com.openlayer.api.services.withErrorHandler interface PresignedUrlService { /** Retrieve a presigned url to post storage artifacts. */ @JvmOverloads - fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none()): StoragePresignedUrlCreateResponse + fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): StoragePresignedUrlCreateResponse } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index 428d207..dabbfe5 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -2,75 +2,53 @@ package com.openlayer.api.services.blocking.storage -import com.fasterxml.jackson.databind.json.JsonMapper -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import kotlin.LazyThreadSafetyMode.PUBLICATION -import java.time.LocalDate -import java.time.Duration -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import java.util.concurrent.CompletableFuture -import java.util.stream.Stream -import com.openlayer.api.core.Enum -import com.openlayer.api.core.NoAutoDetect -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.models.StoragePresignedUrlCreateParams -import com.openlayer.api.models.StoragePresignedUrlCreateResponse 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.core.http.BinaryResponseContent -import com.openlayer.api.core.JsonField -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.RequestOptions import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.services.emptyHandler +import com.openlayer.api.models.StoragePresignedUrlCreateParams +import com.openlayer.api.models.StoragePresignedUrlCreateResponse import com.openlayer.api.services.errorHandler import com.openlayer.api.services.json import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.multipartFormData -import com.openlayer.api.services.stringHandler -import com.openlayer.api.services.binaryHandler import com.openlayer.api.services.withErrorHandler -class PresignedUrlServiceImpl constructor(private val clientOptions: ClientOptions, ) : PresignedUrlService { +class PresignedUrlServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : PresignedUrlService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) /** Retrieve a presigned url to post storage artifacts. */ - override fun create(params: StoragePresignedUrlCreateParams, requestOptions: RequestOptions): StoragePresignedUrlCreateResponse { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("storage", "presigned-url") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) - .apply { - params.getBody().ifPresent { - body(json(clientOptions.jsonMapper, it)) - } + override fun create( + params: StoragePresignedUrlCreateParams, + requestOptions: RequestOptions + ): StoragePresignedUrlCreateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("storage", "presigned-url") + .putAllQueryParams(clientOptions.queryParams) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { createHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } } - .build() - return clientOptions.httpClient.execute(request, requestOptions) - .let { response -> - response.use { - createHandler.handle(it) - } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt index c0b74a2..0d72bda 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/TestServerExtension.kt @@ -43,9 +43,13 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { override fun evaluateExecutionCondition(context: ExtensionContext): ConditionEvaluationResult { return if (System.getenv(SKIP_TESTS_ENV).toBoolean()) { - ConditionEvaluationResult.disabled("Environment variable $SKIP_TESTS_ENV is set to true") + ConditionEvaluationResult.disabled( + "Environment variable $SKIP_TESTS_ENV is set to true" + ) } else { - ConditionEvaluationResult.enabled("Environment variable $SKIP_TESTS_ENV is not set to true") + ConditionEvaluationResult.enabled( + "Environment variable $SKIP_TESTS_ENV is not set to true" + ) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt index a96c62f..bf5ebe7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/client/OpenlayerClientTest.kt @@ -2,8 +2,4 @@ package com.openlayer.api.client -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - class OpenlayerClientTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt index cb72e6a..fe7fc1c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/HttpRequestTest.kt @@ -1,20 +1,22 @@ package com.openlayer.api.core.http -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test internal class HttpRequestTest { @Test fun caseInsensitiveHeadersAccessors() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .putHeader("something_lowercase", "lowercase") - .putHeader("Something_Capitalized", "Capitalized") - .putHeader("SOMETHING_UPPERCASE", "UPPERCASE") - .build() + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .putHeader("something_lowercase", "lowercase") + .putHeader("Something_Capitalized", "Capitalized") + .putHeader("SOMETHING_UPPERCASE", "UPPERCASE") + .build() assertThat(request.headers.get("SOMETHING_LOWERCASE").getOrNull(0)).isEqualTo("lowercase") - assertThat(request.headers.get("something_capitalized").getOrNull(0)).isEqualTo("Capitalized") + assertThat(request.headers.get("something_capitalized").getOrNull(0)) + .isEqualTo("Capitalized") assertThat(request.headers.get("Something_Uppercase").getOrNull(0)).isEqualTo("UPPERCASE") } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt index 3bd34e1..ce97799 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/RetryingHttpClientTest.kt @@ -1,14 +1,13 @@ package com.openlayer.api.core.http +import com.github.tomakehurst.wiremock.client.WireMock.* import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest +import com.github.tomakehurst.wiremock.stubbing.Scenario import com.openlayer.api.client.okhttp.OkHttpClient +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import com.github.tomakehurst.wiremock.stubbing.Scenario -import com.github.tomakehurst.wiremock.client.WireMock.* @WireMockTest internal class RetryingHttpClientTest { @@ -17,25 +16,16 @@ internal class RetryingHttpClientTest { @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - httpClient = OkHttpClient.builder() - .baseUrl(wmRuntimeInfo.httpBaseUrl) - .build() + httpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() resetAllScenarios() } @Test fun byDefaultShouldNotAddIdempotencyHeaderToRequest() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() - stubFor( - post(urlPathEqualTo("/something")) - .willReturn(ok()) - ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() + stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) + val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) @@ -43,19 +33,18 @@ internal class RetryingHttpClientTest { @Test fun whenProvidedShouldAddIdempotencyHeaderToRequest() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( post(urlPathEqualTo("/something")) .withHeader("X-Some-Header", matching("stainless-java-retry-.+")) .willReturn(ok()) ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .idempotencyHeader("X-Some-Header") - .build() + val retryingClient = + RetryingHttpClient.builder() + .httpClient(httpClient) + .idempotencyHeader("X-Some-Header") + .build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) @@ -63,15 +52,15 @@ internal class RetryingHttpClientTest { @Test fun retryAfterHeader() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") // first we fail with a retry after header given as a date .whenScenarioStateIs(Scenario.STARTED) - .willReturn(serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT")) + .willReturn( + serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT") + ) .willSetStateTo("RETRY_AFTER_DATE") ) stubFor( @@ -88,10 +77,8 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .maxRetries(2) - .build() + val retryingClient = + RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(3, postRequestedFor(urlPathEqualTo("/something"))) @@ -99,10 +86,8 @@ internal class RetryingHttpClientTest { @Test fun retryAfterMsHeader() { - val request = HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegment("something") - .build() + val request = + HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") @@ -117,10 +102,8 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = RetryingHttpClient.builder() - .httpClient(httpClient) - .maxRetries(1) - .build() + val retryingClient = + RetryingHttpClient.builder().httpClient(httpClient).maxRetries(1).build() val response = retryingClient.execute(request) assertThat(response.statusCode()).isEqualTo(200) verify(2, postRequestedFor(urlPathEqualTo("/something"))) diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt index bed3d64..a2f9465 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/http/SerializerTest.kt @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.openlayer.api.core.* +import java.util.* import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import java.util.* internal class SerializerTest { @JsonDeserialize(builder = ClassWithBooleanFieldPrefixedWithIs.Builder::class) @@ -23,9 +23,7 @@ internal class SerializerTest { fun isActive(): Boolean? = isActive.getNullable("is_active") - @JsonProperty("is_active") - @ExcludeMissing - fun _isActive() = isActive + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive @JsonAnyGetter @ExcludeMissing @@ -44,28 +42,30 @@ internal class SerializerTest { } return other is ClassWithBooleanFieldPrefixedWithIs && - isActive == other.isActive && - additionalProperties == other.additionalProperties + isActive == other.isActive && + additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash( - isActive, - additionalProperties, - ) + hashCode = + Objects.hash( + isActive, + additionalProperties, + ) } return hashCode } - override fun toString() = "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" + override fun toString() = + "MyClass{isActive=$isActive, additionalProperties=$additionalProperties}" companion object { fun builder() = Builder() } @NoAutoDetect - class Builder{ + class Builder { private var isActive: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -73,9 +73,7 @@ internal class SerializerTest { @JsonProperty("is_active") @ExcludeMissing - fun isActive(isActive: JsonField) = apply { - this.isActive = isActive - } + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -91,14 +89,14 @@ internal class SerializerTest { this.additionalProperties.putAll(additionalProperties) } - fun build(): ClassWithBooleanFieldPrefixedWithIs = ClassWithBooleanFieldPrefixedWithIs( - isActive, - additionalProperties.toUnmodifiable(), - ) + fun build(): ClassWithBooleanFieldPrefixedWithIs = + ClassWithBooleanFieldPrefixedWithIs( + isActive, + additionalProperties.toUnmodifiable(), + ) } } - @Test fun serializeBooleanPrefixedWithIs() { val value = ClassWithBooleanFieldPrefixedWithIs.builder().isActive(true).build() 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 index a609eae..a011d78 100644 --- 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 @@ -2,72 +2,64 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.CommitTestResultListParams +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() + 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) + 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) + 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("") + 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 index 8991770..05c6717 100644 --- 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 @@ -2,119 +2,160 @@ package com.openlayer.api.models -import java.time.LocalDate +import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.CommitTestResultListResponse +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()) + 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 index eb626b4..de558c5 100644 --- 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 @@ -2,124 +2,157 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.InferencePipelineDataStreamParams -import com.openlayer.api.models.InferencePipelineDataStreamParams.InferencePipelineDataStreamBody +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() + 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())) + 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())) + 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("") + 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 index 47cd2e3..5d5c07f 100644 --- 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 @@ -2,25 +2,19 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineDataStreamResponse +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) + 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/InferencePipelineRowUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt index 2d4d4e4..f4a70bf 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateParamsTest.kt @@ -2,120 +2,123 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.InferencePipelineRowUpdateParams -import com.openlayer.api.models.InferencePipelineRowUpdateParams.InferencePipelineRowUpdateBody +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class InferencePipelineRowUpdateParamsTest { @Test fun createInferencePipelineRowUpdateParams() { - InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build() + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() } @Test fun getQueryParams() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build() - val expected = mutableMapOf>() - expected.put("inferenceId", listOf("inferenceId")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .build() - val expected = mutableMapOf>() - expected.put("inferenceId", listOf("inferenceId")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val expected = mutableMapOf>() + expected.put("inferenceId", listOf("inferenceId")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getBody() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) - assertThat(body.config()).isEqualTo(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + assertThat(body.config()) + .isEqualTo( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) } @Test fun getBodyWithoutOptionalFields() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.row()).isEqualTo(JsonValue.from(mapOf())) } @Test fun getPathParam() { - val params = InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .inferenceId("inferenceId") - .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("") + val params = + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .inferenceId("inferenceId") + .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/InferencePipelineRowUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt index e6f8d09..427675b 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/InferencePipelineRowUpdateResponseTest.kt @@ -2,25 +2,19 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineRowUpdateResponse +import org.junit.jupiter.api.Test class InferencePipelineRowUpdateResponseTest { @Test fun createInferencePipelineRowUpdateResponse() { - val inferencePipelineRowUpdateResponse = InferencePipelineRowUpdateResponse.builder() - .success(InferencePipelineRowUpdateResponse.Success.TRUE) - .build() - assertThat(inferencePipelineRowUpdateResponse).isNotNull - assertThat(inferencePipelineRowUpdateResponse.success()).isEqualTo(InferencePipelineRowUpdateResponse.Success.TRUE) + val inferencePipelineRowUpdateResponse = + InferencePipelineRowUpdateResponse.builder() + .success(InferencePipelineRowUpdateResponse.Success.TRUE) + .build() + assertThat(inferencePipelineRowUpdateResponse).isNotNull + assertThat(inferencePipelineRowUpdateResponse.success()) + .isEqualTo(InferencePipelineRowUpdateResponse.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 index 06208f7..6de2ac0 100644 --- 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 @@ -2,69 +2,67 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.InferencePipelineTestResultListParams +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() + 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) + 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) + 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("") + 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 index bd2060f..d9eadbb 100644 --- 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 @@ -2,119 +2,166 @@ package com.openlayer.api.models -import java.time.LocalDate +import com.openlayer.api.core.JsonValue import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.InferencePipelineTestResultListResponse +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()) + 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 index d843e16..17d2e0a 100644 --- 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 @@ -2,63 +2,55 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectCommitListParams +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() + 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) + 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) + 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("") + 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 index 706ad5b..5793bd5 100644 --- 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 @@ -2,103 +2,123 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectCommitListResponse +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("gitCommitUrl") - .build()) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(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("gitCommitUrl") - .build()) - .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - .failingGoalCount(123L) - .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .passingGoalCount(123L) - .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .status(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()) + 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("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(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("gitCommitUrl") + .build() + ) + .dateArchived(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .failingGoalCount(123L) + .mlModelId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .passingGoalCount(123L) + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .status(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/ProjectCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt index 859a38c..0a0a757 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateParamsTest.kt @@ -2,56 +2,46 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectCreateParams -import com.openlayer.api.models.ProjectCreateParams.ProjectCreateBody +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectCreateParamsTest { @Test fun createProjectCreateParams() { - ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() } @Test fun getBody() { - val params = ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("My Project") - assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) - assertThat(body.description()).isEqualTo("My project description.") + val params = + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + assertThat(body.description()).isEqualTo("My project description.") } @Test fun getBodyWithoutOptionalFields() { - val params = ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.name()).isEqualTo("My Project") - assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) + val params = + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.name()).isEqualTo("My Project") + assertThat(body.taskType()).isEqualTo(ProjectCreateParams.TaskType.LLM_BASE) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt index cebddea..1fc43bb 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectCreateResponseTest.kt @@ -2,85 +2,98 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectCreateResponse +import org.junit.jupiter.api.Test class ProjectCreateResponseTest { @Test fun createProjectCreateResponse() { - val projectCreateResponse = 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("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) - .build() - assertThat(projectCreateResponse).isNotNull - assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") - assertThat(projectCreateResponse.creatorId()).contains("589ece63-49a2-41b4-98e1-10547761d4b0") - assertThat(projectCreateResponse.dateCreated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCreateResponse.dateUpdated()).isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) - assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) - assertThat(projectCreateResponse.links()).isEqualTo(ProjectCreateResponse.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) - assertThat(projectCreateResponse.name()).isEqualTo("My Project") - assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) - assertThat(projectCreateResponse.taskType()).isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) - assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) - assertThat(projectCreateResponse.workspaceId()).contains("055fddb1-261f-4654-8598-f6347ee46a09") - assertThat(projectCreateResponse.description()).contains("My project description.") - assertThat(projectCreateResponse.gitRepo()).contains(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("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) + val projectCreateResponse = + 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("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + assertThat(projectCreateResponse).isNotNull + assertThat(projectCreateResponse.id()).isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(projectCreateResponse.creatorId()) + .contains("589ece63-49a2-41b4-98e1-10547761d4b0") + assertThat(projectCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + assertThat(projectCreateResponse.developmentGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.goalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.inferencePipelineCount()).isEqualTo(123L) + assertThat(projectCreateResponse.links()) + .isEqualTo( + ProjectCreateResponse.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + assertThat(projectCreateResponse.monitoringGoalCount()).isEqualTo(123L) + assertThat(projectCreateResponse.name()).isEqualTo("My Project") + assertThat(projectCreateResponse.source()).contains(ProjectCreateResponse.Source.WEB) + assertThat(projectCreateResponse.taskType()) + .isEqualTo(ProjectCreateResponse.TaskType.LLM_BASE) + assertThat(projectCreateResponse.versionCount()).isEqualTo(123L) + assertThat(projectCreateResponse.workspaceId()) + .contains("055fddb1-261f-4654-8598-f6347ee46a09") + assertThat(projectCreateResponse.description()).contains("My project description.") + assertThat(projectCreateResponse.gitRepo()) + .contains( + 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("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .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 index f64c627..0e96084 100644 --- 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 @@ -2,67 +2,58 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectInferencePipelineCreateParams -import com.openlayer.api.models.ProjectInferencePipelineCreateParams.ProjectInferencePipelineCreateBody +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() + 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") + 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") + 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("") + 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 index 064535b..2398c71 100644 --- 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 @@ -2,57 +2,70 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectInferencePipelineCreateResponse +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) + 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 index 99c2565..671b802 100644 --- 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 @@ -2,66 +2,58 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectInferencePipelineListParams +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("name") - .page(123L) - .perPage(100L) - .build() + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() } @Test fun getQueryParams() { - val params = ProjectInferencePipelineListParams.builder() - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .page(123L) - .perPage(100L) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("name")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectInferencePipelineListParams.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .page(123L) + .perPage(100L) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("name")) + 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) + 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("") + 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 index f27c2c3..37bb0ca 100644 --- 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 @@ -2,73 +2,91 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectInferencePipelineListResponse +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()) + 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/models/ProjectListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt index 7b8d3a1..daf73e7 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListParamsTest.kt @@ -2,53 +2,43 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.ProjectListParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class ProjectListParamsTest { @Test fun createProjectListParams() { - ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() } @Test fun getQueryParams() { - val params = ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build() - val expected = mutableMapOf>() - expected.put("name", listOf("name")) - expected.put("page", listOf("123")) - expected.put("perPage", listOf("100")) - expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + val expected = mutableMapOf>() + expected.put("name", listOf("name")) + expected.put("page", listOf("123")) + expected.put("perPage", listOf("100")) + expected.put("taskType", listOf(ProjectListParams.TaskType.LLM_BASE.toString())) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = ProjectListParams.builder().build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = ProjectListParams.builder().build() + val expected = mutableMapOf>() + assertThat(params.getQueryParams()).isEqualTo(expected) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt index 7e0cf3d..c30dee9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/ProjectListResponseTest.kt @@ -2,101 +2,121 @@ package com.openlayer.api.models -import java.time.LocalDate import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.ProjectListResponse +import org.junit.jupiter.api.Test class ProjectListResponseTest { @Test fun createProjectListResponse() { - val projectListResponse = ProjectListResponse.builder() - ._meta(ProjectListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - .items(listOf(ProjectListResponse.Item.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(ProjectListResponse.Item.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(123L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .description("My project description.") - .gitRepo(ProjectListResponse.Item.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("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) - .build())) - .build() - assertThat(projectListResponse).isNotNull - assertThat(projectListResponse._meta()).isEqualTo(ProjectListResponse._Meta.builder() - .page(123L) - .perPage(100L) - .totalItems(123L) - .totalPages(123L) - .build()) - assertThat(projectListResponse.items()).containsExactly(ProjectListResponse.Item.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(ProjectListResponse.Item.Links.builder() - .app("https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6") - .build()) - .monitoringGoalCount(123L) - .name("My Project") - .source(ProjectListResponse.Item.Source.WEB) - .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) - .versionCount(123L) - .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") - .description("My project description.") - .gitRepo(ProjectListResponse.Item.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("name") - .private_(true) - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .slug("slug") - .url("url") - .branch("branch") - .rootDir("rootDir") - .build()) - .build()) + val projectListResponse = + ProjectListResponse.builder() + ._meta( + ProjectListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + .items( + listOf( + ProjectListResponse.Item.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( + ProjectListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(123L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectListResponse.Item.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("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) + ) + .build() + assertThat(projectListResponse).isNotNull + assertThat(projectListResponse._meta()) + .isEqualTo( + ProjectListResponse._Meta + .builder() + .page(123L) + .perPage(100L) + .totalItems(123L) + .totalPages(123L) + .build() + ) + assertThat(projectListResponse.items()) + .containsExactly( + ProjectListResponse.Item.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( + ProjectListResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(123L) + .name("My Project") + .source(ProjectListResponse.Item.Source.WEB) + .taskType(ProjectListResponse.Item.TaskType.LLM_BASE) + .versionCount(123L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .description("My project description.") + .gitRepo( + ProjectListResponse.Item.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("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .build() + ) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt index ff29905..6ae03e8 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateParamsTest.kt @@ -2,47 +2,30 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import org.apache.hc.core5.http.ContentType -import com.openlayer.api.core.ContentTypes -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.MultipartFormValue import com.openlayer.api.models.* -import com.openlayer.api.models.StoragePresignedUrlCreateParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class StoragePresignedUrlCreateParamsTest { @Test fun createStoragePresignedUrlCreateParams() { - StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build() + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() } @Test fun getQueryParams() { - val params = StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build() - val expected = mutableMapOf>() - expected.put("objectName", listOf("objectName")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) } @Test fun getQueryParamsWithoutOptionalFields() { - val params = StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build() - val expected = mutableMapOf>() - expected.put("objectName", listOf("objectName")) - assertThat(params.getQueryParams()).isEqualTo(expected) + val params = StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + val expected = mutableMapOf>() + expected.put("objectName", listOf("objectName")) + assertThat(params.getQueryParams()).isEqualTo(expected) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt index 9e63230..c6dd2f5 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/StoragePresignedUrlCreateResponseTest.kt @@ -2,29 +2,24 @@ package com.openlayer.api.models -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.UUID -import org.junit.jupiter.api.Test -import org.assertj.core.api.Assertions.assertThat -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.models.StoragePresignedUrlCreateResponse +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test class StoragePresignedUrlCreateResponseTest { @Test fun createStoragePresignedUrlCreateResponse() { - val storagePresignedUrlCreateResponse = StoragePresignedUrlCreateResponse.builder() - .storageUri("storageUri") - .url("url") - .fields(JsonValue.from(mapOf())) - .build() - assertThat(storagePresignedUrlCreateResponse).isNotNull - assertThat(storagePresignedUrlCreateResponse.storageUri()).isEqualTo("storageUri") - assertThat(storagePresignedUrlCreateResponse.url()).isEqualTo("url") - assertThat(storagePresignedUrlCreateResponse._fields()).isEqualTo(JsonValue.from(mapOf())) + val storagePresignedUrlCreateResponse = + StoragePresignedUrlCreateResponse.builder() + .storageUri("storageUri") + .url("url") + .fields(JsonValue.from(mapOf())) + .build() + assertThat(storagePresignedUrlCreateResponse).isNotNull + assertThat(storagePresignedUrlCreateResponse.storageUri()).isEqualTo("storageUri") + assertThat(storagePresignedUrlCreateResponse.url()).isEqualTo("url") + assertThat(storagePresignedUrlCreateResponse._fields()) + .isEqualTo(JsonValue.from(mapOf())) } } 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 c5b8310..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 @@ -2,37 +2,19 @@ package com.openlayer.api.services -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest -import com.github.tomakehurst.wiremock.client.WireMock.binaryEqualTo -import com.github.tomakehurst.wiremock.client.WireMock.equalTo +import com.fasterxml.jackson.databind.json.JsonMapper +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.get import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.post -import com.github.tomakehurst.wiremock.client.WireMock.put -import com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor -import com.github.tomakehurst.wiremock.client.WireMock.delete import com.github.tomakehurst.wiremock.client.WireMock.status import com.github.tomakehurst.wiremock.client.WireMock.stubFor -import com.github.tomakehurst.wiremock.client.WireMock.anyUrl -import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy -import org.assertj.guava.api.Assertions.assertThat -import com.google.common.collect.ListMultimap +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.google.common.collect.ImmutableListMultimap -import com.fasterxml.jackson.databind.json.JsonMapper -import java.io.IOException -import java.time.LocalDate -import java.time.OffsetDateTime -import java.util.UUID -import org.assertj.core.api.InstanceOfAssertFactories -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import java.io.InputStream -import java.io.ByteArrayOutputStream +import com.google.common.collect.ListMultimap import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue import com.openlayer.api.core.jsonMapper @@ -41,439 +23,657 @@ import com.openlayer.api.errors.InternalServerException import com.openlayer.api.errors.NotFoundException import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.errors.OpenlayerException -import com.openlayer.api.errors.OpenlayerServiceException import com.openlayer.api.errors.PermissionDeniedException import com.openlayer.api.errors.RateLimitException import com.openlayer.api.errors.UnauthorizedException import com.openlayer.api.errors.UnexpectedStatusCodeException import com.openlayer.api.errors.UnprocessableEntityException import com.openlayer.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.assertThatThrownBy +import org.assertj.core.api.InstanceOfAssertFactories +import org.assertj.guava.api.Assertions.assertThat +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test @WireMockTest class ErrorHandlingTest { private val JSON_MAPPER: JsonMapper = jsonMapper() - private val OPENLAYER_ERROR: OpenlayerError = OpenlayerError.builder().putAdditionalProperty("key", JsonString.of("value")).build() + private val OPENLAYER_ERROR: OpenlayerError = + OpenlayerError.builder().putAdditionalProperty("key", JsonString.of("value")).build() private lateinit var client: OpenlayerClient @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = OpenlayerOkHttpClient.builder() - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) - .apiKey("My API Key") - .build() + client = + OpenlayerOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) + .apiKey("My API Key") + .build() } @Test fun dataStream200() { - 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 expected = InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) - .build() - - stubFor(post(anyUrl()) - .willReturn(ok().withBody(toJson(expected)))) - - assertThat(client.inferencePipelines().data().stream(params)).isEqualTo(expected) + 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 expected = + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) + .build() + + stubFor(post(anyUrl()).willReturn(ok().withBody(toJson(expected)))) + + assertThat(client.inferencePipelines().data().stream(params)).isEqualTo(expected) } @Test fun dataStream400() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(400).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertBadRequest(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream401() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertUnauthorized(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(401).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertUnauthorized(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream403() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(403).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertPermissionDenied(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream404() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(404).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertNotFound(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream422() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertUnprocessableEntity(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(422).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertUnprocessableEntity( + e, + ImmutableListMultimap.of("Foo", "Bar"), + OPENLAYER_ERROR + ) + }) } @Test fun dataStream429() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(429).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertRateLimit(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun dataStream500() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) - .satisfies({ e -> assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(500).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertInternalServer(e, ImmutableListMultimap.of("Foo", "Bar"), OPENLAYER_ERROR) + }) } @Test fun unexpectedStatusCode() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR)))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertUnexpectedStatusCodeException(e, 999, ImmutableListMultimap.of("Foo", "Bar"), toJson(OPENLAYER_ERROR)) }) + 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() + + stubFor( + post(anyUrl()) + .willReturn(status(999).withHeader("Foo", "Bar").withBody(toJson(OPENLAYER_ERROR))) + ) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertUnexpectedStatusCodeException( + e, + 999, + ImmutableListMultimap.of("Foo", "Bar"), + toJson(OPENLAYER_ERROR) + ) + }) } @Test fun invalidBody() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(200).withBody("Not JSON"))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertThat(e) - .isInstanceOf(OpenlayerException::class.java) - .hasMessage("Error reading response") }) + 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() + + stubFor(post(anyUrl()).willReturn(status(200).withBody("Not JSON"))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertThat(e) + .isInstanceOf(OpenlayerException::class.java) + .hasMessage("Error reading response") + }) } @Test fun invalidErrorBody() { - 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() - - stubFor(post(anyUrl()) - .willReturn(status(400).withBody("Not JSON"))) - - assertThatThrownBy({ client.inferencePipelines().data().stream(params) }).satisfies({ e -> assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) }) + 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() + + stubFor(post(anyUrl()).willReturn(status(400).withBody("Not JSON"))) + + assertThatThrownBy({ client.inferencePipelines().data().stream(params) }) + .satisfies({ e -> + assertBadRequest(e, ImmutableListMultimap.of(), OpenlayerError.builder().build()) + }) } private fun toJson(body: T): ByteArray { - return JSON_MAPPER.writeValueAsBytes(body) + return JSON_MAPPER.writeValueAsBytes(body) } - private fun assertUnexpectedStatusCodeException(throwable: Throwable, statusCode: Int, headers: ListMultimap, responseBody: ByteArray) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(UnexpectedStatusCodeException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(statusCode) - assertThat(e.body()).isEqualTo(String(responseBody)) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertUnexpectedStatusCodeException( + throwable: Throwable, + statusCode: Int, + headers: ListMultimap, + responseBody: ByteArray + ) { + assertThat(throwable) + .asInstanceOf( + InstanceOfAssertFactories.throwable(UnexpectedStatusCodeException::class.java) + ) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(statusCode) + assertThat(e.body()).isEqualTo(String(responseBody)) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertBadRequest(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(BadRequestException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(400) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertBadRequest( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf(InstanceOfAssertFactories.throwable(BadRequestException::class.java)) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(400) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertUnauthorized(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(UnauthorizedException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(401) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertUnauthorized( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf(InstanceOfAssertFactories.throwable(UnauthorizedException::class.java)) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(401) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertPermissionDenied(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(PermissionDeniedException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(403) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertPermissionDenied( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf( + InstanceOfAssertFactories.throwable(PermissionDeniedException::class.java) + ) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(403) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertNotFound(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(NotFoundException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(404) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertNotFound( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf(InstanceOfAssertFactories.throwable(NotFoundException::class.java)) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(404) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertUnprocessableEntity(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(UnprocessableEntityException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(422) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertUnprocessableEntity( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf( + InstanceOfAssertFactories.throwable(UnprocessableEntityException::class.java) + ) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(422) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertRateLimit(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(RateLimitException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(429) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertRateLimit( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf(InstanceOfAssertFactories.throwable(RateLimitException::class.java)) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(429) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } - private fun assertInternalServer(throwable: Throwable, headers: ListMultimap, error: OpenlayerError) { - assertThat(throwable) - .asInstanceOf(InstanceOfAssertFactories.throwable(InternalServerException::class.java)) - .satisfies({ e -> assertThat(e.statusCode()).isEqualTo(500) - assertThat(e.error()).isEqualTo(error) - assertThat(e.headers()).containsAllEntriesOf(headers) }) + private fun assertInternalServer( + throwable: Throwable, + headers: ListMultimap, + error: OpenlayerError + ) { + assertThat(throwable) + .asInstanceOf(InstanceOfAssertFactories.throwable(InternalServerException::class.java)) + .satisfies({ e -> + assertThat(e.statusCode()).isEqualTo(500) + assertThat(e.error()).isEqualTo(error) + assertThat(e.headers()).containsAllEntriesOf(headers) + }) } } 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 9bf6fd7..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 @@ -3,41 +3,26 @@ package com.openlayer.api.services import com.fasterxml.jackson.databind.json.JsonMapper -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.equalTo -import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.get +import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath +import com.github.tomakehurst.wiremock.client.WireMock.ok import com.github.tomakehurst.wiremock.client.WireMock.post +import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor import com.github.tomakehurst.wiremock.client.WireMock.put -import com.github.tomakehurst.wiremock.client.WireMock.delete -import com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor import com.github.tomakehurst.wiremock.client.WireMock.stubFor -import com.github.tomakehurst.wiremock.client.WireMock.anyUrl -import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath import com.github.tomakehurst.wiremock.client.WireMock.verify -import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor -import com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor -import java.io.IOException -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.jsonMapper -import com.openlayer.api.core.JsonNull import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.errors.OpenlayerError -import com.openlayer.api.errors.OpenlayerInvalidDataException -import com.openlayer.api.errors.OpenlayerServiceException -import com.openlayer.api.errors.UnexpectedStatusCodeException +import com.openlayer.api.core.jsonMapper import com.openlayer.api.models.* +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test @WireMockTest class ServiceParamsTest { @@ -48,63 +33,77 @@ class ServiceParamsTest { @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = OpenlayerOkHttpClient.builder() - .apiKey("My API Key") - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) - .build() + client = + OpenlayerOkHttpClient.builder() + .apiKey("My API Key") + .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) + .build() } @Test fun dataStreamWithAdditionalParams() { - val additionalHeaders = mutableMapOf>() - - additionalHeaders.put("x-test-header", listOf("abc1234")) - - val additionalQueryParams = mutableMapOf>() - - additionalQueryParams.put("test_query_param", listOf("def567")) - - val additionalBodyProperties = mutableMapOf() - - additionalBodyProperties.put("testBodyProperty", JsonString.of("ghi890")) - - 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())) - .additionalHeaders(additionalHeaders) - .additionalBodyProperties(additionalBodyProperties) - .additionalQueryParams(additionalQueryParams) - .build() - - val apiResponse = InferencePipelineDataStreamResponse.builder() - .success(InferencePipelineDataStreamResponse.Success.TRUE) - .build() - - stubFor(post(anyUrl()) - .withHeader("x-test-header", equalTo("abc1234")) - .withQueryParam("test_query_param", equalTo("def567")) - .withRequestBody(matchingJsonPath("$.testBodyProperty", equalTo("ghi890"))) - .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse)))) - - client.inferencePipelines().data().stream(params) - - verify(postRequestedFor(anyUrl())) + val additionalHeaders = mutableMapOf>() + + additionalHeaders.put("x-test-header", listOf("abc1234")) + + val additionalQueryParams = mutableMapOf>() + + additionalQueryParams.put("test_query_param", listOf("def567")) + + val additionalBodyProperties = mutableMapOf() + + additionalBodyProperties.put("testBodyProperty", JsonString.of("ghi890")) + + 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())) + .additionalHeaders(additionalHeaders) + .additionalBodyProperties(additionalBodyProperties) + .additionalQueryParams(additionalQueryParams) + .build() + + val apiResponse = + InferencePipelineDataStreamResponse.builder() + .success(InferencePipelineDataStreamResponse.Success.TRUE) + .build() + + stubFor( + post(anyUrl()) + .withHeader("x-test-header", equalTo("abc1234")) + .withQueryParam("test_query_param", equalTo("def567")) + .withRequestBody(matchingJsonPath("$.testBodyProperty", equalTo("ghi890"))) + .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) + ) + + client.inferencePipelines().data().stream(params) + + verify(postRequestedFor(anyUrl())) } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt index 123ebae..4a62862 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/CommitServiceTest.kt @@ -2,26 +2,8 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.CommitService import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class CommitServiceTest +@ExtendWith(TestServerExtension::class) class CommitServiceTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt index 74b59ea..af33b2f 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/InferencePipelineServiceTest.kt @@ -2,26 +2,8 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.InferencePipelineService import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class InferencePipelineServiceTest +@ExtendWith(TestServerExtension::class) class InferencePipelineServiceTest diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt index d00b28d..a87bdef 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/ProjectServiceTest.kt @@ -2,60 +2,53 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.ProjectService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class ProjectServiceTest { @Test fun callCreate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectCreateResponse = projectService.create(ProjectCreateParams.builder() - .name("My Project") - .taskType(ProjectCreateParams.TaskType.LLM_BASE) - .description("My project description.") - .build()) - println(projectCreateResponse) - projectCreateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectCreateResponse = + projectService.create( + ProjectCreateParams.builder() + .name("My Project") + .taskType(ProjectCreateParams.TaskType.LLM_BASE) + .description("My project description.") + .build() + ) + println(projectCreateResponse) + projectCreateResponse.validate() } @Test fun callList() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val projectService = client.projects() - val projectListResponse = projectService.list(ProjectListParams.builder() - .name("name") - .page(123L) - .perPage(100L) - .taskType(ProjectListParams.TaskType.LLM_BASE) - .build()) - println(projectListResponse) - projectListResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val projectService = client.projects() + val projectListResponse = + projectService.list( + ProjectListParams.builder() + .name("name") + .page(123L) + .perPage(100L) + .taskType(ProjectListParams.TaskType.LLM_BASE) + .build() + ) + println(projectListResponse) + projectListResponse.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt index 354c84e..5c66b4e 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/StorageServiceTest.kt @@ -2,26 +2,8 @@ package com.openlayer.api.services.blocking -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient -import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.StorageService import com.openlayer.api.models.* +import org.junit.jupiter.api.extension.ExtendWith -@ExtendWith(TestServerExtension::class) -class StorageServiceTest +@ExtendWith(TestServerExtension::class) class StorageServiceTest 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 1810f70..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 @@ -2,46 +2,35 @@ package com.openlayer.api.services.blocking.commits -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.commits.TestResultService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @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() + 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 6505192..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 @@ -2,59 +2,58 @@ package com.openlayer.api.services.blocking.inferencePipelines -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.inferencePipelines.DataService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @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() + 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/RowServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt index 1e1a086..8347fd9 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt @@ -2,50 +2,42 @@ package com.openlayer.api.services.blocking.inferencePipelines -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.inferencePipelines.RowService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class RowServiceTest { @Test fun callUpdate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val rowService = client.inferencePipelines().rows() - val inferencePipelineRowUpdateResponse = rowService.update(InferencePipelineRowUpdateParams.builder() - .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .row(JsonValue.from(mapOf())) - .config(InferencePipelineRowUpdateParams.Config.builder() - .groundTruthColumnName("ground_truth") - .humanFeedbackColumnName("human_feedback") - .inferenceIdColumnName("id") - .latencyColumnName("latency") - .timestampColumnName("timestamp") - .build()) - .inferenceId("inferenceId") - .build()) - println(inferencePipelineRowUpdateResponse) - inferencePipelineRowUpdateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val rowService = client.inferencePipelines().rows() + val inferencePipelineRowUpdateResponse = + rowService.update( + InferencePipelineRowUpdateParams.builder() + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .row(JsonValue.from(mapOf())) + .config( + InferencePipelineRowUpdateParams.Config.builder() + .groundTruthColumnName("ground_truth") + .humanFeedbackColumnName("human_feedback") + .inferenceIdColumnName("id") + .latencyColumnName("latency") + .timestampColumnName("timestamp") + .build() + ) + .inferenceId("inferenceId") + .build() + ) + println(inferencePipelineRowUpdateResponse) + inferencePipelineRowUpdateResponse.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 046ecaa..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 @@ -2,45 +2,34 @@ package com.openlayer.api.services.blocking.inferencePipelines -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.inferencePipelines.TestResultService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @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() + 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 60412bc..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 @@ -2,43 +2,32 @@ package com.openlayer.api.services.blocking.projects -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.projects.CommitService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @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() + 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 d4c9e89..ed1ee7c 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 @@ -2,60 +2,53 @@ package com.openlayer.api.services.blocking.projects -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.projects.InferencePipelineService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @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() + 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("name") - .page(123L) - .perPage(100L) - .build()) - println(projectInferencePipelineListResponse) - projectInferencePipelineListResponse.validate() + 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("name") + .page(123L) + .perPage(100L) + .build() + ) + println(projectInferencePipelineListResponse) + projectInferencePipelineListResponse.validate() } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt index db0e2e3..558cb7c 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt @@ -2,41 +2,28 @@ package com.openlayer.api.services.blocking.storage -import java.time.LocalDate -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Base64 -import java.util.Optional -import java.util.UUID -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.extension.ExtendWith -import org.junit.jupiter.api.BeforeEach import com.openlayer.api.TestServerExtension -import com.openlayer.api.client.OpenlayerClient import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient -import com.openlayer.api.core.JsonNull -import com.openlayer.api.core.JsonString -import com.openlayer.api.core.JsonValue -import com.openlayer.api.core.http.BinaryResponseContent -import com.openlayer.api.services.blocking.storage.PresignedUrlService import com.openlayer.api.models.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) class PresignedUrlServiceTest { @Test fun callCreate() { - val client = OpenlayerOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val presignedUrlService = client.storage().presignedUrl() - val storagePresignedUrlCreateResponse = presignedUrlService.create(StoragePresignedUrlCreateParams.builder() - .objectName("objectName") - .build()) - println(storagePresignedUrlCreateResponse) - storagePresignedUrlCreateResponse.validate() + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlService = client.storage().presignedUrl() + val storagePresignedUrlCreateResponse = + presignedUrlService.create( + StoragePresignedUrlCreateParams.builder().objectName("objectName").build() + ) + println(storagePresignedUrlCreateResponse) + storagePresignedUrlCreateResponse.validate() } }