diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6c9d27e0..bd8e2619 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,14 +1,14 @@ # syntax=docker/dockerfile:1 FROM debian:bookworm-slim -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ libxkbcommon0 \ ca-certificates \ ca-certificates-java \ make \ curl \ git \ - openjdk-17-jdk \ + openjdk-17-jdk-headless \ unzip \ libc++1 \ vim \ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aaf968a1..b56c3d0b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.3" + ".": "0.1.0-alpha.4" } \ No newline at end of file diff --git a/README.md b/README.md index e321768e..8fb8555b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.1.0-alpha.3) +[![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.1.0-alpha.4) @@ -27,7 +27,7 @@ The REST API documentation can be foundĀ on [openlayer.com](https://openlayer.co ```kotlin -implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.3") +implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.4") ``` #### Maven @@ -36,7 +36,7 @@ implementation("com.openlayer.api:openlayer-java:0.1.0-alpha.3") com.openlayer.api openlayer-java - 0.1.0-alpha.3 + 0.1.0-alpha.4 ``` @@ -77,7 +77,7 @@ import com.openlayer.api.models.InferencePipelineDataStreamResponse; import java.util.List; InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.builder() - .rows(List.of(InferencePipelineDataStreamParams.Row.builder().build())) + .inferencePipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .config(InferencePipelineDataStreamParams.Config.ofLlmData(InferencePipelineDataStreamParams.Config.LlmData.builder() .outputColumnName("output") .costColumnName("cost") @@ -85,8 +85,9 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui .numOfTokenColumnName("tokens") .timestampColumnName("timestamp") .build())) + .row(List.of(InferencePipelineDataStreamParams.Row.builder().build())) .build(); -InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream(params); +InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream(params); ``` --- @@ -118,7 +119,7 @@ InferencePipelineDataStreamParams params = InferencePipelineDataStreamParams.bui When receiving a response, the Openlayer Java SDK will deserialize it into instances of the typed model classes. In rare cases, the API may return a response property that doesn't match the expected Java type. If you directly access the mistaken property, the SDK will throw an unchecked `OpenlayerInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model. ```java -InferencePipelineDataStreamResponse inferencePipelineDataStreamResponse = client.inferencePipelines().data().stream().validate(); +InferencePipelineDataStreamResponse response = client.inferencePipelines().data().stream().validate(); ``` ### Response properties as JSON @@ -148,7 +149,7 @@ if (field.isMissing()) { Sometimes, the server response may include additional properties that are not yet available in this library's types. You can access them using the model's `_additionalProperties` method: ```java -JsonValue secret = inferencePipelineDataStreamResponse._additionalProperties().get("secret_field"); +JsonValue secret = projectCreateResponse._additionalProperties().get("secret_field"); ``` --- diff --git a/build.gradle.kts b/build.gradle.kts index ba79b9b1..7683e5f7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.openlayer.api" - version = "0.1.0-alpha.3" // x-release-please-version + version = "0.1.0-alpha.4" // x-release-please-version } diff --git a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts index 53e63304..32a150ed 100644 --- a/buildSrc/src/main/kotlin/openlayer.java.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.java.gradle.kts @@ -19,6 +19,7 @@ configure { importOrder() removeUnusedImports() palantirJavaFormat() + toggleOffOn() } } diff --git a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts index 5c12826c..b0bd08ab 100644 --- a/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/openlayer.kotlin.gradle.kts @@ -16,6 +16,7 @@ kotlin { configure { kotlin { ktfmt().kotlinlangStyle() + toggleOffOn() } } 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 13779b00..4922400f 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 @@ -66,7 +66,6 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val request.body?.run { future.whenComplete { _, _ -> close() } } val call = getClient(requestOptions).newCall(request.toRequest()) - call.enqueue( object : Callback { override fun onResponse(call: Call, response: Response) { @@ -90,7 +89,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val private fun HttpRequest.toRequest(): Request { var body: RequestBody? = body?.toRequestBody() - // OkHttpClient always requires a request body for PUT and POST methods + // OkHttpClient always requires a request body for PUT and POST methods. if (body == null && (method == HttpMethod.PUT || method == HttpMethod.POST)) { body = "".toRequestBody() } @@ -118,21 +117,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val val length = contentLength() return object : RequestBody() { - override fun contentType(): MediaType? { - return mediaType - } + override fun contentType(): MediaType? = mediaType - override fun contentLength(): Long { - return length - } + override fun contentLength(): Long = length - override fun isOneShot(): Boolean { - return !repeatable() - } + override fun isOneShot(): Boolean = !repeatable() - override fun writeTo(sink: BufferedSink) { - writeTo(sink.outputStream()) - } + override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream()) } } @@ -140,21 +131,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val val headers = headers.toHeaders() return object : HttpResponse { - override fun statusCode(): Int { - return code - } + override fun statusCode(): Int = code - override fun headers(): ListMultimap { - return headers - } + override fun headers(): ListMultimap = headers - override fun body(): InputStream { - return body!!.byteStream() - } + override fun body(): InputStream = body!!.byteStream() - override fun close() { - body!!.close() - } + override fun close() = body!!.close() } } @@ -163,9 +146,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER) .arrayListValues() .build() - forEach { pair -> headers.put(pair.first, pair.second) } - return headers } @@ -176,7 +157,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val class Builder { private var baseUrl: HttpUrl? = null - // default timeout is 1 minute + // The default timeout is 1 minute. private var timeout: Duration = Duration.ofSeconds(60) private var proxy: Proxy? = null @@ -186,8 +167,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } - fun build(): OkHttpClient { - return OkHttpClient( + fun build(): OkHttpClient = + OkHttpClient( okhttp3.OkHttpClient.Builder() .connectTimeout(timeout) .readTimeout(timeout) @@ -197,6 +178,5 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val .build(), checkNotNull(baseUrl) { "`baseUrl` is required but was not set" }, ) - } } } 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 1dff8030..ca008cf8 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 @@ -23,7 +23,7 @@ class OpenlayerOkHttpClient private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL - // default timeout for client is 1 minute + // The default timeout for the client is 1 minute. private var timeout: Duration = Duration.ofSeconds(60) private var proxy: Proxy? = null @@ -66,8 +66,8 @@ class OpenlayerOkHttpClient private constructor() { fun fromEnv() = apply { clientOptions.fromEnv() } - fun build(): OpenlayerClient { - return OpenlayerClientImpl( + fun build(): OpenlayerClient = + OpenlayerClientImpl( clientOptions .httpClient( OkHttpClient.builder() @@ -78,6 +78,5 @@ class OpenlayerOkHttpClient private constructor() { ) .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 0866f953..7cce64fc 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 @@ -23,7 +23,7 @@ class OpenlayerOkHttpClientAsync private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var baseUrl: String = ClientOptions.PRODUCTION_URL - // default timeout for client is 1 minute + // The default timeout for the client is 1 minute. private var timeout: Duration = Duration.ofSeconds(60) private var proxy: Proxy? = null @@ -66,8 +66,8 @@ class OpenlayerOkHttpClientAsync private constructor() { fun fromEnv() = apply { clientOptions.fromEnv() } - fun build(): OpenlayerClientAsync { - return OpenlayerClientAsyncImpl( + fun build(): OpenlayerClientAsync = + OpenlayerClientAsyncImpl( clientOptions .httpClient( OkHttpClient.builder() @@ -78,6 +78,5 @@ class OpenlayerOkHttpClientAsync private constructor() { ) .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 3a24286f..f9c3b57a 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 @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.client import com.openlayer.api.models.* 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 7d8847ce..620db2df 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 @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.client import com.openlayer.api.models.* 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 d3c13ec6..5a08ebf3 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 @@ -3,30 +3,41 @@ package com.openlayer.api.client import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.core.getPackageVersion import com.openlayer.api.models.* import com.openlayer.api.services.async.* -import com.openlayer.api.services.errorHandler class OpenlayerClientAsyncImpl constructor( private val clientOptions: ClientOptions, ) : OpenlayerClientAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val clientOptionsWithUserAgent = + if (clientOptions.headers.containsKey("User-Agent")) clientOptions + else + clientOptions + .toBuilder() + .putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}") + .build() + // Pass the original clientOptions so that this client sets its own User-Agent. private val sync: OpenlayerClient by lazy { OpenlayerClientImpl(clientOptions) } - private val projects: ProjectServiceAsync by lazy { ProjectServiceAsyncImpl(clientOptions) } + private val projects: ProjectServiceAsync by lazy { + ProjectServiceAsyncImpl(clientOptionsWithUserAgent) + } - private val commits: CommitServiceAsync by lazy { CommitServiceAsyncImpl(clientOptions) } + private val commits: CommitServiceAsync by lazy { + CommitServiceAsyncImpl(clientOptionsWithUserAgent) + } private val inferencePipelines: InferencePipelineServiceAsync by lazy { - InferencePipelineServiceAsyncImpl(clientOptions) + InferencePipelineServiceAsyncImpl(clientOptionsWithUserAgent) } - private val storage: StorageServiceAsync by lazy { StorageServiceAsyncImpl(clientOptions) } + private val storage: StorageServiceAsync by lazy { + StorageServiceAsyncImpl(clientOptionsWithUserAgent) + } override fun sync(): OpenlayerClient = sync 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 29a6187c..b805ba69 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 @@ -3,30 +3,35 @@ package com.openlayer.api.client import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.core.getPackageVersion import com.openlayer.api.models.* import com.openlayer.api.services.blocking.* -import com.openlayer.api.services.errorHandler class OpenlayerClientImpl constructor( private val clientOptions: ClientOptions, ) : OpenlayerClient { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + private val clientOptionsWithUserAgent = + if (clientOptions.headers.containsKey("User-Agent")) clientOptions + else + clientOptions + .toBuilder() + .putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}") + .build() + // Pass the original clientOptions so that this client sets its own User-Agent. private val async: OpenlayerClientAsync by lazy { OpenlayerClientAsyncImpl(clientOptions) } - private val projects: ProjectService by lazy { ProjectServiceImpl(clientOptions) } + private val projects: ProjectService by lazy { ProjectServiceImpl(clientOptionsWithUserAgent) } - private val commits: CommitService by lazy { CommitServiceImpl(clientOptions) } + private val commits: CommitService by lazy { CommitServiceImpl(clientOptionsWithUserAgent) } private val inferencePipelines: InferencePipelineService by lazy { - InferencePipelineServiceImpl(clientOptions) + InferencePipelineServiceImpl(clientOptionsWithUserAgent) } - private val storage: StorageService by lazy { StorageServiceImpl(clientOptions) } + private val storage: StorageService by lazy { StorageServiceImpl(clientOptionsWithUserAgent) } override fun async(): OpenlayerClientAsync = async 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 ed353b4b..367f9d85 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 @@ -6,11 +6,13 @@ import com.fasterxml.jackson.databind.json.JsonMapper import com.google.common.collect.ArrayListMultimap import com.google.common.collect.ListMultimap import com.openlayer.api.core.http.HttpClient +import com.openlayer.api.core.http.PhantomReachableClosingHttpClient import com.openlayer.api.core.http.RetryingHttpClient import java.time.Clock class ClientOptions private constructor( + private val originalHttpClient: HttpClient, @get:JvmName("httpClient") val httpClient: HttpClient, @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, @get:JvmName("clock") val clock: Clock, @@ -19,8 +21,11 @@ private constructor( @get:JvmName("headers") val headers: ListMultimap, @get:JvmName("queryParams") val queryParams: ListMultimap, @get:JvmName("responseValidation") val responseValidation: Boolean, + @get:JvmName("maxRetries") val maxRetries: Int, ) { + fun toBuilder() = Builder().from(this) + companion object { const val PRODUCTION_URL = "https://api.openlayer.com/v1" @@ -42,6 +47,25 @@ private constructor( private var maxRetries: Int = 2 private var apiKey: String? = null + @JvmSynthetic + internal fun from(clientOptions: ClientOptions) = apply { + httpClient = clientOptions.originalHttpClient + jsonMapper = clientOptions.jsonMapper + clock = clientOptions.clock + baseUrl = clientOptions.baseUrl + headers = + clientOptions.headers.asMap().mapValuesTo(mutableMapOf()) { (_, value) -> + value.toMutableList() + } + queryParams = + clientOptions.queryParams.asMap().mapValuesTo(mutableMapOf()) { (_, value) -> + value.toMutableList() + } + responseValidation = clientOptions.responseValidation + maxRetries = clientOptions.maxRetries + apiKey = clientOptions.apiKey + } + fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } @@ -108,6 +132,7 @@ private constructor( 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", "JRE") headers.put("X-Stainless-Runtime-Version", getJavaVersion()) if (!apiKey.isNullOrEmpty()) { headers.put("Authorization", "Bearer ${apiKey}") @@ -116,11 +141,14 @@ private constructor( this.queryParams.forEach(queryParams::replaceValues) return ClientOptions( - RetryingHttpClient.builder() - .httpClient(httpClient!!) - .clock(clock) - .maxRetries(maxRetries) - .build(), + httpClient!!, + PhantomReachableClosingHttpClient( + RetryingHttpClient.builder() + .httpClient(httpClient!!) + .clock(clock) + .maxRetries(maxRetries) + .build() + ), jsonMapper ?: jsonMapper(), clock, baseUrl, @@ -128,6 +156,7 @@ private constructor( headers.toUnmodifiable(), queryParams.toUnmodifiable(), responseValidation, + maxRetries, ) } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt new file mode 100644 index 00000000..8838f20c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/HttpRequestBodies.kt @@ -0,0 +1,111 @@ +@file:JvmName("HttpRequestBodies") + +package com.openlayer.api.core + +import com.fasterxml.jackson.databind.json.JsonMapper +import com.openlayer.api.core.http.HttpRequestBody +import com.openlayer.api.errors.OpenlayerException +import java.io.ByteArrayOutputStream +import java.io.OutputStream +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder + +@JvmSynthetic +internal inline fun json( + jsonMapper: JsonMapper, + value: T, +): HttpRequestBody { + return object : HttpRequestBody { + private var cachedBytes: ByteArray? = null + + private fun serialize(): ByteArray { + if (cachedBytes != null) return cachedBytes!! + + val buffer = ByteArrayOutputStream() + try { + jsonMapper.writeValue(buffer, value) + cachedBytes = buffer.toByteArray() + return cachedBytes!! + } catch (e: Exception) { + throw OpenlayerException("Error writing request", e) + } + } + + override fun writeTo(outputStream: OutputStream) { + outputStream.write(serialize()) + } + + override fun contentType(): String = "application/json" + + override fun contentLength(): Long { + return serialize().size.toLong() + } + + override fun repeatable(): Boolean = true + + override fun close() {} + } +} + +@JvmSynthetic +internal fun multipartFormData( + jsonMapper: JsonMapper, + parts: Array?> +): HttpRequestBody { + val builder = MultipartEntityBuilder.create() + parts.forEach { part -> + if (part?.value != null) { + when (part.value) { + is JsonValue -> { + val buffer = ByteArrayOutputStream() + try { + jsonMapper.writeValue(buffer, part.value) + } catch (e: Exception) { + throw OpenlayerException("Error serializing value to json", e) + } + builder.addBinaryBody( + part.name, + buffer.toByteArray(), + part.contentType, + part.filename + ) + } + is Boolean -> + builder.addTextBody( + part.name, + if (part.value) "true" else "false", + part.contentType + ) + is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) + is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) + is Double -> builder.addTextBody(part.name, part.value.toString(), part.contentType) + is ByteArray -> + builder.addBinaryBody(part.name, part.value, part.contentType, part.filename) + is String -> builder.addTextBody(part.name, part.value, part.contentType) + is Enum -> builder.addTextBody(part.name, part.value.toString(), part.contentType) + else -> + throw IllegalArgumentException( + "Unsupported content type: ${part.value::class.java.simpleName}" + ) + } + } + } + val entity = builder.build() + + return object : HttpRequestBody { + override fun writeTo(outputStream: OutputStream) { + try { + return entity.writeTo(outputStream) + } catch (e: Exception) { + throw OpenlayerException("Error writing request", e) + } + } + + override fun contentType(): String = entity.contentType + + override fun contentLength(): Long = -1 + + override fun repeatable(): Boolean = entity.isRepeatable + + override fun close() = entity.close() + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PhantomReachable.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PhantomReachable.kt new file mode 100644 index 00000000..ad26316d --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/PhantomReachable.kt @@ -0,0 +1,46 @@ +@file:JvmName("PhantomReachable") + +package com.openlayer.api.core + +import com.openlayer.api.errors.OpenlayerException +import java.lang.reflect.InvocationTargetException + +/** + * Closes [closeable] when [observed] becomes only phantom reachable. + * + * This is a wrapper around a Java 9+ [java.lang.ref.Cleaner], or a no-op in older Java versions. + */ +@JvmSynthetic +internal fun closeWhenPhantomReachable(observed: Any, closeable: AutoCloseable) { + check(observed !== closeable) { + "`observed` cannot be the same object as `closeable` because it would never become phantom reachable" + } + closeWhenPhantomReachable?.let { it(observed, closeable::close) } +} + +private val closeWhenPhantomReachable: ((Any, AutoCloseable) -> Unit)? by lazy { + try { + val cleanerClass = Class.forName("java.lang.ref.Cleaner") + val cleanerCreate = cleanerClass.getMethod("create") + val cleanerRegister = + cleanerClass.getMethod("register", Any::class.java, Runnable::class.java) + val cleanerObject = cleanerCreate.invoke(null); + + { observed, closeable -> + try { + cleanerRegister.invoke(cleanerObject, observed, Runnable { closeable.close() }) + } catch (e: ReflectiveOperationException) { + if (e is InvocationTargetException) { + when (val cause = e.cause) { + is RuntimeException, + is Error -> throw cause + } + } + throw OpenlayerException("Unexpected reflective invocation failure", e) + } + } + } catch (e: ReflectiveOperationException) { + // We're running Java 8, which has no Cleaner. + null + } +} 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 bc0d02aa..552568d3 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 @@ -34,14 +34,9 @@ fun getOsName(): String { } } -fun getOsVersion(): String { - return System.getProperty("os.version", "unknown") -} +fun getOsVersion(): String = System.getProperty("os.version", "unknown") -fun getPackageVersion(): String { - return Properties::class.java.`package`.implementationVersion ?: "unknown" -} +fun getPackageVersion(): String = + Properties::class.java.`package`.implementationVersion ?: "unknown" -fun getJavaVersion(): String { - return System.getProperty("java.version", "unknown") -} +fun getJavaVersion(): String = System.getProperty("java.version", "unknown") 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 12b454f8..b0e10599 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 @@ -142,6 +142,8 @@ sealed class JsonField { // This filter should not be used directly and should instead use the @ExcludeMissing annotation class IsMissing { override fun equals(other: Any?): Boolean = other is JsonMissing + + override fun hashCode(): Int = Objects.hash() } class Deserializer(private val type: JavaType? = null) : @@ -479,9 +481,8 @@ internal constructor( } } - override fun toString(): String { - return "MultipartFormValue(name='$name', contentType=$contentType, filename=$filename, value=${valueToString()})" - } + override fun toString(): String = + "MultipartFormValue{name=$name, contentType=$contentType, filename=$filename, value=${valueToString()}}" private fun valueToString(): String = when (value) { diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/EmptyHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/EmptyHandler.kt new file mode 100644 index 00000000..f59baa60 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/EmptyHandler.kt @@ -0,0 +1,12 @@ +@file:JvmName("EmptyHandler") + +package com.openlayer.api.core.handlers + +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler + +@JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandlerInternal + +private object EmptyHandlerInternal : Handler { + override fun handle(response: HttpResponse): Void? = null +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt new file mode 100644 index 00000000..69326c1b --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/ErrorHandler.kt @@ -0,0 +1,125 @@ +@file:JvmName("ErrorHandler") + +package com.openlayer.api.core.handlers + +import com.fasterxml.jackson.databind.json.JsonMapper +import com.google.common.collect.ListMultimap +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.BadRequestException +import com.openlayer.api.errors.InternalServerException +import com.openlayer.api.errors.NotFoundException +import com.openlayer.api.errors.OpenlayerError +import com.openlayer.api.errors.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.ByteArrayInputStream +import java.io.InputStream + +@JvmSynthetic +internal fun errorHandler(jsonMapper: JsonMapper): Handler { + val handler = jsonHandler(jsonMapper) + + return object : Handler { + override fun handle(response: HttpResponse): OpenlayerError = + try { + handler.handle(response) + } catch (e: Exception) { + OpenlayerError.builder().build() + } + } +} + +@JvmSynthetic +internal fun Handler.withErrorHandler(errorHandler: Handler): Handler = + object : Handler { + override fun handle(response: HttpResponse): T { + when (val statusCode = response.statusCode()) { + in 200..299 -> { + return this@withErrorHandler.handle(response) + } + 400 -> { + val buffered = response.buffered() + throw BadRequestException( + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + 401 -> { + val buffered = response.buffered() + throw UnauthorizedException( + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + 403 -> { + val buffered = response.buffered() + throw PermissionDeniedException( + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + 404 -> { + val buffered = response.buffered() + throw NotFoundException( + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + 422 -> { + val buffered = response.buffered() + throw UnprocessableEntityException( + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + 429 -> { + val buffered = response.buffered() + throw RateLimitException( + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + in 500..599 -> { + val buffered = response.buffered() + throw InternalServerException( + statusCode, + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + else -> { + val buffered = response.buffered() + throw UnexpectedStatusCodeException( + statusCode, + buffered.headers(), + stringHandler().handle(buffered), + errorHandler.handle(buffered), + ) + } + } + } + } + +private fun HttpResponse.buffered(): HttpResponse { + val body = body().readBytes() + + return object : HttpResponse { + override fun statusCode(): Int = this@buffered.statusCode() + + override fun headers(): ListMultimap = this@buffered.headers() + + override fun body(): InputStream = ByteArrayInputStream(body) + + override fun close() = this@buffered.close() + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt new file mode 100644 index 00000000..6babe3b3 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/JsonHandler.kt @@ -0,0 +1,21 @@ +@file:JvmName("JsonHandler") + +package com.openlayer.api.core.handlers + +import com.fasterxml.jackson.databind.json.JsonMapper +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.errors.OpenlayerException + +@JvmSynthetic +internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = + object : Handler { + override fun handle(response: HttpResponse): T { + try { + return jsonMapper.readValue(response.body(), jacksonTypeRef()) + } catch (e: Exception) { + throw OpenlayerException("Error reading response", e) + } + } + } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/StringHandler.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/StringHandler.kt new file mode 100644 index 00000000..d0f697dc --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/handlers/StringHandler.kt @@ -0,0 +1,13 @@ +@file:JvmName("StringHandler") + +package com.openlayer.api.core.handlers + +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler + +@JvmSynthetic internal fun stringHandler(): Handler = StringHandlerInternal + +private object StringHandlerInternal : Handler { + override fun handle(response: HttpResponse): String = + response.body().readBytes().toString(Charsets.UTF_8) +} 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 e6fb4bc4..bed23ad7 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,3 +1,5 @@ +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + package com.openlayer.api.core.http import com.openlayer.api.core.RequestOptions @@ -6,11 +8,13 @@ import java.util.concurrent.CompletableFuture interface HttpClient : AutoCloseable { + @JvmOverloads fun execute( request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponse + @JvmOverloads fun executeAsync( request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), 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 243c19af..f7c3a909 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 @@ -17,7 +17,7 @@ private constructor( ) { override fun toString(): String = - "HttpRequest {method=$method, pathSegments=$pathSegments, queryParams=$queryParams, headers=$headers, body=$body}" + "HttpRequest{method=$method, pathSegments=$pathSegments, queryParams=$queryParams, headers=$headers, body=$body}" companion object { @JvmStatic fun builder() = Builder() diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt new file mode 100644 index 00000000..ab4266ee --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/core/http/PhantomReachableClosingHttpClient.kt @@ -0,0 +1,21 @@ +package com.openlayer.api.core.http + +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.closeWhenPhantomReachable +import java.util.concurrent.CompletableFuture + +internal class PhantomReachableClosingHttpClient(private val httpClient: HttpClient) : HttpClient { + init { + closeWhenPhantomReachable(this, httpClient) + } + + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse = + httpClient.execute(request, requestOptions) + + override fun executeAsync( + request: HttpRequest, + requestOptions: RequestOptions + ): CompletableFuture = httpClient.executeAsync(request, requestOptions) + + override fun close() = httpClient.close() +} 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 a90d6f46..037f8438 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 @@ -1,5 +1,3 @@ -@file:JvmSynthetic - package com.openlayer.api.core.http import com.google.common.util.concurrent.MoreExecutors @@ -40,9 +38,16 @@ private constructor( maybeAddIdempotencyHeader(request) + // Don't send the current retry count in the headers if the caller set their own value. + val shouldSendRetryCount = !request.headers.containsKey("x-stainless-retry-count") + var retries = 0 while (true) { + if (shouldSendRetryCount) { + setRetryCountHeader(request, retries) + } + val response = try { val response = httpClient.execute(request, requestOptions) @@ -74,10 +79,21 @@ private constructor( maybeAddIdempotencyHeader(request) + // Don't send the current retry count in the headers if the caller set their own value. + val shouldSendRetryCount = !request.headers.containsKey("x-stainless-retry-count") + var retries = 0 - fun wrap(future: CompletableFuture): CompletableFuture { - return future + fun executeWithRetries( + request: HttpRequest, + requestOptions: RequestOptions, + ): CompletableFuture { + if (shouldSendRetryCount) { + setRetryCountHeader(request, retries) + } + + return httpClient + .executeAsync(request, requestOptions) .handleAsync( fun( response: HttpResponse?, @@ -97,7 +113,7 @@ private constructor( val backoffMillis = getRetryBackoffMillis(retries, response) return sleepAsync(backoffMillis.toMillis()).thenCompose { - wrap(httpClient.executeAsync(request, requestOptions)) + executeWithRetries(request, requestOptions) } }, MoreExecutors.directExecutor() @@ -105,17 +121,19 @@ private constructor( .thenCompose(Function.identity()) } - return wrap(httpClient.executeAsync(request, requestOptions)) + return executeWithRetries(request, requestOptions) } - override fun close() { - httpClient.close() - } + override fun close() = httpClient.close() - private fun isRetryable(request: HttpRequest): Boolean { + private fun isRetryable(request: HttpRequest): Boolean = // Some requests, such as when a request body is being streamed, cannot be retried because // the body data aren't available on subsequent attempts. - return request.body?.repeatable() ?: true + request.body?.repeatable() ?: true + + private fun setRetryCountHeader(request: HttpRequest, retries: Int) { + request.headers.removeAll("x-stainless-retry-count") + request.headers.put("x-stainless-retry-count", retries.toString()) } private fun idempotencyKey(): String = "stainless-java-retry-${UUID.randomUUID()}" @@ -149,11 +167,10 @@ private constructor( } } - private fun shouldRetry(throwable: Throwable): Boolean { + private fun shouldRetry(throwable: Throwable): Boolean = // Only retry IOException and OpenlayerIoException, other exceptions are not intended to be // retried. - return throwable is IOException || throwable is OpenlayerIoException - } + throwable is IOException || throwable is OpenlayerIoException private fun getRetryBackoffMillis(retries: Int, response: HttpResponse?): Duration { // About the Retry-After header: 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 f51b5d21..6c25d62d 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 @@ -2,12 +2,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class BadRequestException -constructor( +class BadRequestException( headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = 400 - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(400, headers, body, 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 b0c6a67a..f22438bd 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 @@ -2,13 +2,9 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class InternalServerException -constructor( - private val statusCode: Int, +class InternalServerException( + statusCode: Int, headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = statusCode - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(statusCode, headers, body, 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 9efe856c..aa9f8c8d 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 @@ -2,12 +2,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class NotFoundException -constructor( +class NotFoundException( headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = 404 - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(404, headers, body, 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 59250fe4..d22ee415 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 @@ -26,11 +26,11 @@ constructor( return true } - return other is OpenlayerError && this.additionalProperties == other.additionalProperties + return /* spotless:off */ other is OpenlayerError && this.additionalProperties == other.additionalProperties /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash(additionalProperties) + return /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ } override fun toString() = "OpenlayerError{additionalProperties=$additionalProperties}" 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 916e4ed1..6e962cb1 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,11 +5,19 @@ import com.google.common.collect.ListMultimap abstract class OpenlayerServiceException @JvmOverloads constructor( + private val statusCode: Int, private val headers: ListMultimap, - message: String? = null, + private val body: String, + private val error: OpenlayerError, + message: String = "$statusCode: $error", cause: Throwable? = null ) : OpenlayerException(message, cause) { - abstract fun statusCode(): Int + + fun statusCode(): Int = statusCode fun headers(): ListMultimap = headers + + fun body(): String = body + + fun error(): OpenlayerError = error } 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 cc7f0d65..0e146954 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 @@ -2,12 +2,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class PermissionDeniedException -constructor( +class PermissionDeniedException( headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = 403 - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(403, headers, body, 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 5b83fd04..16c010ef 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 @@ -2,12 +2,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class RateLimitException -constructor( +class RateLimitException( headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = 429 - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(429, headers, body, 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 f0e8f0f7..6a09f5e1 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 @@ -2,12 +2,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class UnauthorizedException -constructor( +class UnauthorizedException( headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = 401 - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(401, headers, body, 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 30e8d3ae..26697c32 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 @@ -2,13 +2,9 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class UnexpectedStatusCodeException -constructor( - private val statusCode: Int, +class UnexpectedStatusCodeException( + statusCode: Int, headers: ListMultimap, - private val body: String -) : OpenlayerServiceException(headers, "Unexpected status code: ${statusCode}") { - override fun statusCode(): Int = statusCode - - fun body() = body -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(statusCode, headers, body, error) 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 87dba98c..19ffac52 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 @@ -2,12 +2,8 @@ package com.openlayer.api.errors import com.google.common.collect.ListMultimap -class UnprocessableEntityException -constructor( +class UnprocessableEntityException( headers: ListMultimap, - private val error: OpenlayerError, -) : OpenlayerServiceException(headers, "${error}") { - override fun statusCode(): Int = 422 - - fun error(): OpenlayerError = error -} + body: String, + error: OpenlayerError, +) : OpenlayerServiceException(422, headers, body, 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 67f54ef3..5793eed8 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 @@ -67,28 +67,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - projectVersionId, - includeArchived, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - ) + return /* spotless:off */ Objects.hash(projectVersionId, includeArchived, page, perPage, status, type, additionalQueryParams, additionalHeaders) /* spotless:on */ } override fun toString() = @@ -218,7 +201,7 @@ constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -293,7 +276,7 @@ constructor( return true } - return other is Type && this.value == other.value + return /* spotless:off */ other is Type && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() 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 9c6554a7..7e29a80e 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 @@ -38,8 +38,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun items(): List = items.getRequired("items") @JsonProperty("items") @ExcludeMissing fun _items() = items @@ -57,26 +55,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CommitTestResultListResponse && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(items, additionalProperties) - } - return hashCode - } - - override fun toString() = - "CommitTestResultListResponse{items=$items, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -140,8 +118,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** Project version (commit) id. */ fun id(): String = id.getRequired("id") @@ -236,50 +212,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Item{id=$id, goal=$goal, goalId=$goalId, projectVersionId=$projectVersionId, inferencePipelineId=$inferencePipelineId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateDataStarts=$dateDataStarts, dateDataEnds=$dateDataEnds, status=$status, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -464,7 +396,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -557,8 +489,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The test id. */ fun id(): String = id.getRequired("id") @@ -742,72 +672,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Goal{id=$id, number=$number, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, evaluationWindow=$evaluationWindow, delayWindow=$delayWindow, type=$type, subtype=$subtype, creatorId=$creatorId, originProjectVersionId=$originProjectVersionId, thresholds=$thresholds, archived=$archived, dateArchived=$dateArchived, suggested=$suggested, commentCount=$commentCount, usesMlModel=$usesMlModel, usesValidationDataset=$usesValidationDataset, usesTrainingDataset=$usesTrainingDataset, usesReferenceDataset=$usesReferenceDataset, usesProductionData=$usesProductionData, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1133,8 +997,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The measurement to be evaluated. */ fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) @@ -1186,38 +1048,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1317,8 +1147,8 @@ private constructor( @JsonSerialize(using = Value.Serializer::class) class Value private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, + private val number: Double? = null, + private val bool: Boolean? = null, private val string: String? = null, private val strings: List? = null, private val _json: JsonValue? = null, @@ -1326,25 +1156,25 @@ private constructor( private var validated: Boolean = false - fun double(): Optional = Optional.ofNullable(double) + fun number(): Optional = Optional.ofNullable(number) - fun boolean(): Optional = Optional.ofNullable(boolean) + fun bool(): Optional = Optional.ofNullable(bool) fun string(): Optional = Optional.ofNullable(string) fun strings(): Optional> = Optional.ofNullable(strings) - fun isDouble(): Boolean = double != null + fun isNumber(): Boolean = number != null - fun isBoolean(): Boolean = boolean != null + fun isBool(): Boolean = bool != null fun isString(): Boolean = string != null fun isStrings(): Boolean = strings != null - fun asDouble(): Double = double.getOrThrow("double") + fun asNumber(): Double = number.getOrThrow("number") - fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + fun asBool(): Boolean = bool.getOrThrow("bool") fun asString(): String = string.getOrThrow("string") @@ -1354,8 +1184,8 @@ private constructor( fun accept(visitor: Visitor): T { return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) + number != null -> visitor.visitNumber(number) + bool != null -> visitor.visitBool(bool) string != null -> visitor.visitString(string) strings != null -> visitor.visitStrings(strings) else -> visitor.unknown(_json) @@ -1365,10 +1195,7 @@ private constructor( fun validate(): Value = apply { if (!validated) { if ( - double == null && - boolean == null && - string == null && - strings == null + number == null && bool == null && string == null && strings == null ) { throw OpenlayerInvalidDataException("Unknown Value: $_json") } @@ -1381,26 +1208,17 @@ private constructor( return true } - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings + return /* spotless:off */ other is Value && this.number == other.number && this.bool == other.bool && this.string == other.string && this.strings == other.strings /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) + return /* spotless:off */ Objects.hash(number, bool, string, strings) /* spotless:on */ } override fun toString(): String { return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" + number != null -> "Value{number=$number}" + bool != null -> "Value{bool=$bool}" string != null -> "Value{string=$string}" strings != null -> "Value{strings=$strings}" _json != null -> "Value{_unknown=$_json}" @@ -1410,9 +1228,9 @@ private constructor( companion object { - @JvmStatic fun ofDouble(double: Double) = Value(double = double) + @JvmStatic fun ofNumber(number: Double) = Value(number = number) - @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic fun ofBool(bool: Boolean) = Value(bool = bool) @JvmStatic fun ofString(string: String) = Value(string = string) @@ -1421,9 +1239,9 @@ private constructor( interface Visitor { - fun visitDouble(double: Double): T + fun visitNumber(number: Double): T - fun visitBoolean(boolean: Boolean): T + fun visitBool(bool: Boolean): T fun visitString(string: String): T @@ -1438,11 +1256,12 @@ private constructor( override fun ObjectCodec.deserialize(node: JsonNode): Value { val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) + return Value(number = it, _json = json) } tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) + return Value(bool = it, _json = json) } tryDeserialize(node, jacksonTypeRef())?.let { return Value(string = it, _json = json) @@ -1463,8 +1282,8 @@ private constructor( provider: SerializerProvider ) { when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) + value.number != null -> generator.writeObject(value.number) + value.bool != null -> generator.writeObject(value.bool) value.string != null -> generator.writeObject(value.string) value.strings != null -> generator.writeObject(value.strings) value._json != null -> generator.writeObject(value._json) @@ -1473,7 +1292,87 @@ private constructor( } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(measurement, insightName, insightParameters, operator, value, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ 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) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, goal, goalId, projectVersionId, inferencePipelineId, dateCreated, dateUpdated, dateDataStarts, dateDataEnds, status, statusMessage, additionalProperties) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CommitTestResultListResponse && this.items == other.items && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "CommitTestResultListResponse{items=$items, additionalProperties=$additionalProperties}" } 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 62d6be9d..3952fdba 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 @@ -71,8 +71,6 @@ constructor( 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 @@ -85,32 +83,6 @@ 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 - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - config, - rows, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -159,6 +131,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineDataStreamBody && this.config == other.config && this.rows == other.rows && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(config, rows, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineDataStreamBody{config=$config, rows=$rows, additionalProperties=$additionalProperties}" } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -172,24 +164,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - config, - rows, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(inferencePipelineId, config, rows, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = @@ -405,20 +384,11 @@ constructor( return true } - return other is Config && - this.llmData == other.llmData && - this.tabularClassificationData == other.tabularClassificationData && - this.tabularRegressionData == other.tabularRegressionData && - this.textClassificationData == other.textClassificationData + return /* spotless:off */ other is Config && this.llmData == other.llmData && this.tabularClassificationData == other.tabularClassificationData && this.tabularRegressionData == other.tabularRegressionData && this.textClassificationData == other.textClassificationData /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - llmData, - tabularClassificationData, - tabularRegressionData, - textClassificationData, - ) + return /* spotless:off */ Objects.hash(llmData, tabularClassificationData, tabularRegressionData, textClassificationData) /* spotless:on */ } override fun toString(): String { @@ -473,6 +443,7 @@ constructor( override fun ObjectCodec.deserialize(node: JsonNode): Config { val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef()) { it.validate() } ?.let { return Config(llmData = it, _json = json) @@ -536,8 +507,6 @@ constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** Name of the column with the total number of tokens. */ fun numOfTokenColumnName(): Optional = Optional.ofNullable(numOfTokenColumnName.getNullable("numOfTokenColumnName")) @@ -681,52 +650,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LlmData && - this.numOfTokenColumnName == other.numOfTokenColumnName && - this.contextColumnName == other.contextColumnName && - this.costColumnName == other.costColumnName && - this.groundTruthColumnName == other.groundTruthColumnName && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.inputVariableNames == other.inputVariableNames && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.outputColumnName == other.outputColumnName && - this.prompt == other.prompt && - this.questionColumnName == other.questionColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - numOfTokenColumnName, - contextColumnName, - costColumnName, - groundTruthColumnName, - inferenceIdColumnName, - inputVariableNames, - latencyColumnName, - metadata, - outputColumnName, - prompt, - questionColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "LlmData{numOfTokenColumnName=$numOfTokenColumnName, contextColumnName=$contextColumnName, costColumnName=$costColumnName, groundTruthColumnName=$groundTruthColumnName, inferenceIdColumnName=$inferenceIdColumnName, inputVariableNames=$inputVariableNames, latencyColumnName=$latencyColumnName, metadata=$metadata, outputColumnName=$outputColumnName, prompt=$prompt, questionColumnName=$questionColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -962,8 +885,6 @@ constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** Role of the prompt. */ fun role(): Optional = Optional.ofNullable(role.getNullable("role")) @@ -991,32 +912,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Prompt && - this.role == other.role && - this.content == other.content && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - role, - content, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1073,7 +968,47 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Prompt && this.role == other.role && this.content == other.content && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(role, content, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Prompt{role=$role, content=$content, additionalProperties=$additionalProperties}" } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(numOfTokenColumnName, contextColumnName, costColumnName, groundTruthColumnName, inferenceIdColumnName, inputVariableNames, latencyColumnName, metadata, outputColumnName, prompt, questionColumnName, timestampColumnName, additionalProperties) /* spotless:on */ + } + 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}" } @JsonDeserialize(builder = TabularClassificationData.Builder::class) @@ -1095,8 +1030,6 @@ constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** * Array with the names of all categorical features in the dataset. E.g. * ["Age", "Geography"]. @@ -1233,48 +1166,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularClassificationData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.classNames == other.classNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - categoricalFeatureNames, - classNames, - featureNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "TabularClassificationData{categoricalFeatureNames=$categoricalFeatureNames, classNames=$classNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1483,6 +1374,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(categoricalFeatureNames, classNames, featureNames, inferenceIdColumnName, labelColumnName, latencyColumnName, metadata, predictionsColumnName, predictionScoresColumnName, timestampColumnName, additionalProperties) /* spotless:on */ + } + 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}" } @JsonDeserialize(builder = TabularRegressionData.Builder::class) @@ -1502,8 +1413,6 @@ constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** * Array with the names of all categorical features in the dataset. E.g. * ["Gender", "Geography"]. @@ -1605,44 +1514,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TabularRegressionData && - this.categoricalFeatureNames == other.categoricalFeatureNames && - this.featureNames == other.featureNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.targetColumnName == other.targetColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - categoricalFeatureNames, - featureNames, - inferenceIdColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - targetColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1804,6 +1675,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(categoricalFeatureNames, featureNames, inferenceIdColumnName, latencyColumnName, metadata, predictionsColumnName, targetColumnName, timestampColumnName, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "TabularRegressionData{categoricalFeatureNames=$categoricalFeatureNames, featureNames=$featureNames, inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, targetColumnName=$targetColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" } @JsonDeserialize(builder = TextClassificationData.Builder::class) @@ -1824,8 +1715,6 @@ constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** * List of class names indexed by label integer in the dataset. E.g. * ["Retained", "Exited"] when 0, 1 are in your label column. @@ -1946,46 +1835,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TextClassificationData && - this.classNames == other.classNames && - this.inferenceIdColumnName == other.inferenceIdColumnName && - this.labelColumnName == other.labelColumnName && - this.latencyColumnName == other.latencyColumnName && - this.metadata == other.metadata && - this.predictionsColumnName == other.predictionsColumnName && - this.predictionScoresColumnName == other.predictionScoresColumnName && - this.textColumnName == other.textColumnName && - this.timestampColumnName == other.timestampColumnName && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - classNames, - inferenceIdColumnName, - labelColumnName, - latencyColumnName, - metadata, - predictionsColumnName, - predictionScoresColumnName, - textColumnName, - timestampColumnName, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "TextClassificationData{classNames=$classNames, inferenceIdColumnName=$inferenceIdColumnName, labelColumnName=$labelColumnName, latencyColumnName=$latencyColumnName, metadata=$metadata, predictionsColumnName=$predictionsColumnName, predictionScoresColumnName=$predictionScoresColumnName, textColumnName=$textColumnName, timestampColumnName=$timestampColumnName, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -2173,6 +2022,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(classNames, inferenceIdColumnName, labelColumnName, latencyColumnName, metadata, predictionsColumnName, predictionScoresColumnName, textColumnName, timestampColumnName, additionalProperties) /* spotless:on */ + } + 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}" } } @@ -2183,31 +2052,12 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Row && this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(additionalProperties) - } - return hashCode - } - - override fun toString() = "Row{additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -2236,5 +2086,24 @@ constructor( fun build(): Row = Row(additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Row && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Row{additionalProperties=$additionalProperties}" } } 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 087cedac..b4f29a7f 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 @@ -27,8 +27,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun success(): Success = success.getRequired("success") @JsonProperty("success") @ExcludeMissing fun _success() = success @@ -46,26 +44,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineDataStreamResponse && - this.success == other.success && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(success, additionalProperties) - } - return hashCode - } - - override fun toString() = - "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -121,7 +99,7 @@ private constructor( return true } - return other is Success && this.value == other.value + return /* spotless:off */ other is Success && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -158,4 +136,24 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineDataStreamResponse && this.success == other.success && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(success, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineDataStreamResponse{success=$success, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt index 623bef1e..2e356e4c 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineDeleteParams.kt @@ -46,20 +46,11 @@ constructor( return true } - return other is InferencePipelineDeleteParams && - this.inferencePipelineId == other.inferencePipelineId && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + return /* spotless:off */ other is InferencePipelineDeleteParams && this.inferencePipelineId == other.inferencePipelineId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(inferencePipelineId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt index 41a7dd7d..95a52670 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveParams.kt @@ -36,18 +36,11 @@ constructor( return true } - return other is InferencePipelineRetrieveParams && - this.inferencePipelineId == other.inferencePipelineId && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders + return /* spotless:off */ other is InferencePipelineRetrieveParams && this.inferencePipelineId == other.inferencePipelineId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - additionalQueryParams, - additionalHeaders, - ) + return /* spotless:off */ Objects.hash(inferencePipelineId, additionalQueryParams, additionalHeaders) /* spotless:on */ } override fun toString() = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt index 95ec229d..0677e272 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineRetrieveResponse.kt @@ -43,8 +43,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") @@ -169,58 +167,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineRetrieveResponse && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineRetrieveResponse{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() @@ -451,8 +397,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -470,25 +414,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -527,6 +452,25 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Status @@ -542,7 +486,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -609,4 +553,24 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineRetrieveResponse && 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, projectId, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineRetrieveResponse{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}" } 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 a8072f90..e4d034de 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 @@ -68,8 +68,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - @JsonProperty("row") fun row(): JsonValue? = row @JsonProperty("config") fun config(): Config? = config @@ -80,32 +78,6 @@ 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 - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - row, - config, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -150,6 +122,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineRowUpdateBody && this.row == other.row && this.config == other.config && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(row, config, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineRowUpdateBody{row=$row, config=$config, additionalProperties=$additionalProperties}" } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -163,26 +155,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - row, - config, - inferenceId, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(inferencePipelineId, row, config, inferenceId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = @@ -309,8 +286,6 @@ constructor( 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. @@ -342,38 +317,6 @@ 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 - } - - override fun hashCode(): Int { - 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}" - companion object { @JvmStatic fun builder() = Builder() @@ -458,5 +401,25 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(inferenceIdColumnName, latencyColumnName, timestampColumnName, groundTruthColumnName, humanFeedbackColumnName, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Config{inferenceIdColumnName=$inferenceIdColumnName, latencyColumnName=$latencyColumnName, timestampColumnName=$timestampColumnName, groundTruthColumnName=$groundTruthColumnName, humanFeedbackColumnName=$humanFeedbackColumnName, additionalProperties=$additionalProperties}" } } 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 35e877eb..eda7f6f9 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 @@ -27,8 +27,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun success(): Success = success.getRequired("success") @JsonProperty("success") @ExcludeMissing fun _success() = success @@ -46,26 +44,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - 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 - } - - override fun toString() = - "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -120,7 +98,7 @@ private constructor( return true } - return other is Success && this.value == other.value + return /* spotless:off */ other is Success && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -157,4 +135,24 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineRowUpdateResponse && this.success == other.success && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(success, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineRowUpdateResponse{success=$success, additionalProperties=$additionalProperties}" } 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 f7ca9062..38374512 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 @@ -63,26 +63,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - page, - perPage, - status, - type, - additionalQueryParams, - additionalHeaders, - ) + return /* spotless:off */ Objects.hash(inferencePipelineId, page, perPage, status, type, additionalQueryParams, additionalHeaders) /* spotless:on */ } override fun toString() = @@ -208,7 +193,7 @@ constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -283,7 +268,7 @@ constructor( return true } - return other is Type && this.value == other.value + return /* spotless:off */ other is Type && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() 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 06f8ed65..265bb2ae 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 @@ -38,8 +38,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun items(): List = items.getRequired("items") @JsonProperty("items") @ExcludeMissing fun _items() = items @@ -57,26 +55,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineTestResultListResponse && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(items, additionalProperties) - } - return hashCode - } - - override fun toString() = - "InferencePipelineTestResultListResponse{items=$items, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -142,8 +120,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** Project version (commit) id. */ fun id(): String = id.getRequired("id") @@ -238,50 +214,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.goal == other.goal && - this.goalId == other.goalId && - this.projectVersionId == other.projectVersionId && - this.inferencePipelineId == other.inferencePipelineId && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateDataStarts == other.dateDataStarts && - this.dateDataEnds == other.dateDataEnds && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - goal, - goalId, - projectVersionId, - inferencePipelineId, - dateCreated, - dateUpdated, - dateDataStarts, - dateDataEnds, - status, - statusMessage, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Item{id=$id, goal=$goal, goalId=$goalId, projectVersionId=$projectVersionId, inferencePipelineId=$inferencePipelineId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateDataStarts=$dateDataStarts, dateDataEnds=$dateDataEnds, status=$status, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -466,7 +398,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -559,8 +491,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The test id. */ fun id(): String = id.getRequired("id") @@ -744,72 +674,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Goal && - this.id == other.id && - this.number == other.number && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.description == other.description && - this.evaluationWindow == other.evaluationWindow && - this.delayWindow == other.delayWindow && - this.type == other.type && - this.subtype == other.subtype && - this.creatorId == other.creatorId && - this.originProjectVersionId == other.originProjectVersionId && - this.thresholds == other.thresholds && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.suggested == other.suggested && - this.commentCount == other.commentCount && - this.usesMlModel == other.usesMlModel && - this.usesValidationDataset == other.usesValidationDataset && - this.usesTrainingDataset == other.usesTrainingDataset && - this.usesReferenceDataset == other.usesReferenceDataset && - this.usesProductionData == other.usesProductionData && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - number, - name, - dateCreated, - dateUpdated, - description, - evaluationWindow, - delayWindow, - type, - subtype, - creatorId, - originProjectVersionId, - thresholds, - archived, - dateArchived, - suggested, - commentCount, - usesMlModel, - usesValidationDataset, - usesTrainingDataset, - usesReferenceDataset, - usesProductionData, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Goal{id=$id, number=$number, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, evaluationWindow=$evaluationWindow, delayWindow=$delayWindow, type=$type, subtype=$subtype, creatorId=$creatorId, originProjectVersionId=$originProjectVersionId, thresholds=$thresholds, archived=$archived, dateArchived=$dateArchived, suggested=$suggested, commentCount=$commentCount, usesMlModel=$usesMlModel, usesValidationDataset=$usesValidationDataset, usesTrainingDataset=$usesTrainingDataset, usesReferenceDataset=$usesReferenceDataset, usesProductionData=$usesProductionData, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1135,8 +999,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The measurement to be evaluated. */ fun measurement(): Optional = Optional.ofNullable(measurement.getNullable("measurement")) @@ -1188,38 +1050,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Threshold && - this.measurement == other.measurement && - this.insightName == other.insightName && - this.insightParameters == other.insightParameters && - this.operator == other.operator && - this.value == other.value && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - measurement, - insightName, - insightParameters, - operator, - value, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1319,8 +1149,8 @@ private constructor( @JsonSerialize(using = Value.Serializer::class) class Value private constructor( - private val double: Double? = null, - private val boolean: Boolean? = null, + private val number: Double? = null, + private val bool: Boolean? = null, private val string: String? = null, private val strings: List? = null, private val _json: JsonValue? = null, @@ -1328,25 +1158,25 @@ private constructor( private var validated: Boolean = false - fun double(): Optional = Optional.ofNullable(double) + fun number(): Optional = Optional.ofNullable(number) - fun boolean(): Optional = Optional.ofNullable(boolean) + fun bool(): Optional = Optional.ofNullable(bool) fun string(): Optional = Optional.ofNullable(string) fun strings(): Optional> = Optional.ofNullable(strings) - fun isDouble(): Boolean = double != null + fun isNumber(): Boolean = number != null - fun isBoolean(): Boolean = boolean != null + fun isBool(): Boolean = bool != null fun isString(): Boolean = string != null fun isStrings(): Boolean = strings != null - fun asDouble(): Double = double.getOrThrow("double") + fun asNumber(): Double = number.getOrThrow("number") - fun asBoolean(): Boolean = boolean.getOrThrow("boolean") + fun asBool(): Boolean = bool.getOrThrow("bool") fun asString(): String = string.getOrThrow("string") @@ -1356,8 +1186,8 @@ private constructor( fun accept(visitor: Visitor): T { return when { - double != null -> visitor.visitDouble(double) - boolean != null -> visitor.visitBoolean(boolean) + number != null -> visitor.visitNumber(number) + bool != null -> visitor.visitBool(bool) string != null -> visitor.visitString(string) strings != null -> visitor.visitStrings(strings) else -> visitor.unknown(_json) @@ -1367,10 +1197,7 @@ private constructor( fun validate(): Value = apply { if (!validated) { if ( - double == null && - boolean == null && - string == null && - strings == null + number == null && bool == null && string == null && strings == null ) { throw OpenlayerInvalidDataException("Unknown Value: $_json") } @@ -1383,26 +1210,17 @@ private constructor( return true } - return other is Value && - this.double == other.double && - this.boolean == other.boolean && - this.string == other.string && - this.strings == other.strings + return /* spotless:off */ other is Value && this.number == other.number && this.bool == other.bool && this.string == other.string && this.strings == other.strings /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - double, - boolean, - string, - strings, - ) + return /* spotless:off */ Objects.hash(number, bool, string, strings) /* spotless:on */ } override fun toString(): String { return when { - double != null -> "Value{double=$double}" - boolean != null -> "Value{boolean=$boolean}" + number != null -> "Value{number=$number}" + bool != null -> "Value{bool=$bool}" string != null -> "Value{string=$string}" strings != null -> "Value{strings=$strings}" _json != null -> "Value{_unknown=$_json}" @@ -1412,9 +1230,9 @@ private constructor( companion object { - @JvmStatic fun ofDouble(double: Double) = Value(double = double) + @JvmStatic fun ofNumber(number: Double) = Value(number = number) - @JvmStatic fun ofBoolean(boolean: Boolean) = Value(boolean = boolean) + @JvmStatic fun ofBool(bool: Boolean) = Value(bool = bool) @JvmStatic fun ofString(string: String) = Value(string = string) @@ -1423,9 +1241,9 @@ private constructor( interface Visitor { - fun visitDouble(double: Double): T + fun visitNumber(number: Double): T - fun visitBoolean(boolean: Boolean): T + fun visitBool(bool: Boolean): T fun visitString(string: String): T @@ -1440,11 +1258,12 @@ private constructor( override fun ObjectCodec.deserialize(node: JsonNode): Value { val json = JsonValue.fromJsonNode(node) + tryDeserialize(node, jacksonTypeRef())?.let { - return Value(double = it, _json = json) + return Value(number = it, _json = json) } tryDeserialize(node, jacksonTypeRef())?.let { - return Value(boolean = it, _json = json) + return Value(bool = it, _json = json) } tryDeserialize(node, jacksonTypeRef())?.let { return Value(string = it, _json = json) @@ -1465,8 +1284,8 @@ private constructor( provider: SerializerProvider ) { when { - value.double != null -> generator.writeObject(value.double) - value.boolean != null -> generator.writeObject(value.boolean) + value.number != null -> generator.writeObject(value.number) + value.bool != null -> generator.writeObject(value.bool) value.string != null -> generator.writeObject(value.string) value.strings != null -> generator.writeObject(value.strings) value._json != null -> generator.writeObject(value._json) @@ -1475,7 +1294,87 @@ private constructor( } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(measurement, insightName, insightParameters, operator, value, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Threshold{measurement=$measurement, insightName=$insightName, insightParameters=$insightParameters, operator=$operator, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ 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) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, goal, goalId, projectVersionId, inferencePipelineId, dateCreated, dateUpdated, dateDataStarts, dateDataEnds, status, statusMessage, additionalProperties) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineTestResultListResponse && this.items == other.items && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineTestResultListResponse{items=$items, additionalProperties=$additionalProperties}" } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt index 66bece64..057aecca 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateParams.kt @@ -64,8 +64,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - /** The inference pipeline description. */ @JsonProperty("description") fun description(): String? = description @@ -85,34 +83,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineUpdateBody && - this.description == other.description && - this.name == other.name && - this.referenceDatasetUri == other.referenceDatasetUri && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - description, - name, - referenceDatasetUri, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineUpdateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -171,6 +141,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineUpdateBody && this.description == other.description && this.name == other.name && this.referenceDatasetUri == other.referenceDatasetUri && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(description, name, referenceDatasetUri, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineUpdateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -184,26 +174,11 @@ constructor( return true } - return other is InferencePipelineUpdateParams && - this.inferencePipelineId == other.inferencePipelineId && - this.description == other.description && - this.name == other.name && - this.referenceDatasetUri == other.referenceDatasetUri && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + return /* spotless:off */ other is InferencePipelineUpdateParams && this.inferencePipelineId == other.inferencePipelineId && this.description == other.description && this.name == other.name && this.referenceDatasetUri == other.referenceDatasetUri && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - inferencePipelineId, - description, - name, - referenceDatasetUri, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(inferencePipelineId, description, name, referenceDatasetUri, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt index 3e7d7419..6466e7a0 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/InferencePipelineUpdateResponse.kt @@ -43,8 +43,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") @@ -169,58 +167,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is InferencePipelineUpdateResponse && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "InferencePipelineUpdateResponse{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() @@ -450,8 +396,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -469,25 +413,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -526,6 +451,25 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Status @@ -541,7 +485,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -608,4 +552,24 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InferencePipelineUpdateResponse && 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, projectId, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InferencePipelineUpdateResponse{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}" } 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 70182dea..dc36aea9 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 @@ -50,22 +50,11 @@ constructor( 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 + return /* spotless:off */ other is ProjectCommitListParams && this.projectId == other.projectId && this.page == other.page && this.perPage == other.perPage && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - projectId, - page, - perPage, - additionalQueryParams, - additionalHeaders, - ) + return /* spotless:off */ Objects.hash(projectId, page, perPage, additionalQueryParams, additionalHeaders) /* spotless:on */ } override fun toString() = 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 ee04f83d..5e392c97 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 @@ -29,8 +29,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun items(): List = items.getRequired("items") @JsonProperty("items") @ExcludeMissing fun _items() = items @@ -48,26 +46,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectCommitListResponse && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(items, additionalProperties) - } - return hashCode - } - - override fun toString() = - "ProjectCommitListResponse{items=$items, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -137,8 +115,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The project version (commit) id. */ fun id(): String = id.getRequired("id") @@ -283,62 +259,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.dateCreated == other.dateCreated && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.projectId == other.projectId && - this.storageUri == other.storageUri && - this.commit == other.commit && - this.deploymentStatus == other.deploymentStatus && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.archived == other.archived && - this.dateArchived == other.dateArchived && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - dateCreated, - status, - statusMessage, - projectId, - storageUri, - commit, - deploymentStatus, - mlModelId, - validationDatasetId, - trainingDatasetId, - archived, - dateArchived, - passingGoalCount, - failingGoalCount, - totalGoalCount, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Item{id=$id, dateCreated=$dateCreated, status=$status, statusMessage=$statusMessage, projectId=$projectId, storageUri=$storageUri, commit=$commit, deploymentStatus=$deploymentStatus, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, archived=$archived, dateArchived=$dateArchived, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, links=$links, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -610,8 +530,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The commit id. */ fun id(): String = id.getRequired("id") @@ -719,52 +637,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Commit && - this.id == other.id && - this.authorId == other.authorId && - this.dateCreated == other.dateCreated && - this.fileSize == other.fileSize && - this.message == other.message && - this.mlModelId == other.mlModelId && - this.validationDatasetId == other.validationDatasetId && - this.trainingDatasetId == other.trainingDatasetId && - this.storageUri == other.storageUri && - this.gitCommitSha == other.gitCommitSha && - this.gitCommitRef == other.gitCommitRef && - this.gitCommitUrl == other.gitCommitUrl && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - authorId, - dateCreated, - fileSize, - message, - mlModelId, - validationDatasetId, - trainingDatasetId, - storageUri, - gitCommitSha, - gitCommitRef, - gitCommitUrl, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -948,6 +820,26 @@ private constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Commit && this.id == other.id && this.authorId == other.authorId && this.dateCreated == other.dateCreated && this.fileSize == other.fileSize && this.message == other.message && this.mlModelId == other.mlModelId && this.validationDatasetId == other.validationDatasetId && this.trainingDatasetId == other.trainingDatasetId && this.storageUri == other.storageUri && this.gitCommitSha == other.gitCommitSha && this.gitCommitRef == other.gitCommitRef && this.gitCommitUrl == other.gitCommitUrl && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, authorId, dateCreated, fileSize, message, mlModelId, validationDatasetId, trainingDatasetId, storageUri, gitCommitSha, gitCommitRef, gitCommitUrl, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Commit{id=$id, authorId=$authorId, dateCreated=$dateCreated, fileSize=$fileSize, message=$message, mlModelId=$mlModelId, validationDatasetId=$validationDatasetId, trainingDatasetId=$trainingDatasetId, storageUri=$storageUri, gitCommitSha=$gitCommitSha, gitCommitRef=$gitCommitRef, gitCommitUrl=$gitCommitUrl, additionalProperties=$additionalProperties}" } class Status @@ -963,7 +855,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -1041,8 +933,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -1060,25 +950,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -1118,6 +989,65 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is 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 /* spotless:on */ } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, dateCreated, status, statusMessage, projectId, storageUri, commit, deploymentStatus, mlModelId, validationDatasetId, trainingDatasetId, archived, dateArchived, passingGoalCount, failingGoalCount, totalGoalCount, links, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProjectCommitListResponse && this.items == other.items && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "ProjectCommitListResponse{items=$items, additionalProperties=$additionalProperties}" } 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 559574fc..6a2ba282 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 @@ -59,8 +59,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - /** The project name. */ @JsonProperty("name") fun name(): String? = name @@ -76,34 +74,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - 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 - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - name, - taskType, - description, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -157,6 +127,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProjectCreateBody && this.name == other.name && this.taskType == other.taskType && this.description == other.description && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(name, taskType, description, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "ProjectCreateBody{name=$name, taskType=$taskType, description=$description, additionalProperties=$additionalProperties}" } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -170,24 +160,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - name, - taskType, - description, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(name, taskType, description, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = @@ -303,8 +280,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - @JsonProperty("app") fun app(): String? = app @JsonAnyGetter @@ -313,25 +288,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -370,6 +326,25 @@ constructor( additionalProperties.toUnmodifiable() ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Source @@ -385,7 +360,7 @@ constructor( return true } - return other is Source && this.value == other.value + return /* spotless:off */ other is Source && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -448,7 +423,7 @@ constructor( return true } - return other is TaskType && this.value == other.value + return /* spotless:off */ other is TaskType && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -523,8 +498,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - @JsonProperty("id") fun id(): String? = id @JsonProperty("gitId") fun gitId(): Long? = gitId @@ -555,52 +528,6 @@ 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 - } - - 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 - } - - 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() @@ -701,5 +628,25 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) /* spotless:on */ + } + 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}" } } 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 eb6afeed..eeb5d25b 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 @@ -44,8 +44,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The project id. */ fun id(): String = id.getRequired("id") @@ -177,60 +175,6 @@ private constructor( 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 - } - - 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 - } - - 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() @@ -461,8 +405,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -480,25 +422,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -537,6 +460,25 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Source @@ -552,7 +494,7 @@ private constructor( return true } - return other is Source && this.value == other.value + return /* spotless:off */ other is Source && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -615,7 +557,7 @@ private constructor( return true } - return other is TaskType && this.value == other.value + return /* spotless:off */ other is TaskType && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -692,8 +634,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun id(): String = id.getRequired("id") fun gitId(): Long = gitId.getRequired("gitId") @@ -766,52 +706,6 @@ private 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 - } - - 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 - } - - 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() @@ -960,5 +854,45 @@ private constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) /* spotless:on */ + } + 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}" } 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 cab7c085..7d962c46 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 @@ -63,8 +63,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - /** The inference pipeline description. */ @JsonProperty("description") fun description(): String? = description @@ -77,32 +75,6 @@ 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 - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - description, - name, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -151,6 +123,26 @@ constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProjectInferencePipelineCreateBody && this.description == other.description && this.name == other.name && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(description, name, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineCreateBody{description=$description, name=$name, additionalProperties=$additionalProperties}" } fun _additionalQueryParams(): Map> = additionalQueryParams @@ -164,24 +156,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - projectId, - description, - name, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(projectId, description, name, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = @@ -297,8 +276,6 @@ constructor( private val additionalProperties: Map, ) { - private var hashCode: Int = 0 - @JsonProperty("app") fun app(): String? = app @JsonAnyGetter @@ -307,25 +284,6 @@ constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -364,6 +322,25 @@ constructor( additionalProperties.toUnmodifiable() ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Status @@ -379,7 +356,7 @@ constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() 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 acd34bb1..e403e3cd 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 @@ -43,8 +43,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") @@ -169,58 +167,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineCreateResponse && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "ProjectInferencePipelineCreateResponse{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -452,8 +398,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -471,25 +415,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -528,6 +453,25 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Status @@ -543,7 +487,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -610,4 +554,24 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, projectId, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) /* spotless:on */ + } + 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}" } 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 44e3b6a3..1065d807 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 @@ -54,24 +54,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - projectId, - name, - page, - perPage, - additionalQueryParams, - additionalHeaders, - ) + return /* spotless:off */ Objects.hash(projectId, name, page, perPage, additionalQueryParams, additionalHeaders) /* spotless:on */ } override fun toString() = 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 7e9850fa..5f8335c7 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 @@ -29,8 +29,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun items(): List = items.getRequired("items") @JsonProperty("items") @ExcludeMissing fun _items() = items @@ -48,26 +46,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectInferencePipelineListResponse && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(items, additionalProperties) - } - return hashCode - } - - override fun toString() = - "ProjectInferencePipelineListResponse{items=$items, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -137,8 +115,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The inference pipeline id. */ fun id(): String = id.getRequired("id") @@ -265,58 +241,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Item && - this.id == other.id && - this.projectId == other.projectId && - this.name == other.name && - this.dateCreated == other.dateCreated && - this.dateUpdated == other.dateUpdated && - this.dateLastSampleReceived == other.dateLastSampleReceived && - this.description == other.description && - this.dateLastEvaluated == other.dateLastEvaluated && - this.dateOfNextEvaluation == other.dateOfNextEvaluation && - this.passingGoalCount == other.passingGoalCount && - this.failingGoalCount == other.failingGoalCount && - this.totalGoalCount == other.totalGoalCount && - this.status == other.status && - this.statusMessage == other.statusMessage && - this.links == other.links && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - id, - projectId, - name, - dateCreated, - dateUpdated, - dateLastSampleReceived, - description, - dateLastEvaluated, - dateOfNextEvaluation, - passingGoalCount, - failingGoalCount, - totalGoalCount, - status, - statusMessage, - links, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "Item{id=$id, projectId=$projectId, name=$name, dateCreated=$dateCreated, dateUpdated=$dateUpdated, dateLastSampleReceived=$dateLastSampleReceived, description=$description, dateLastEvaluated=$dateLastEvaluated, dateOfNextEvaluation=$dateOfNextEvaluation, passingGoalCount=$passingGoalCount, failingGoalCount=$failingGoalCount, totalGoalCount=$totalGoalCount, status=$status, statusMessage=$statusMessage, links=$links, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -549,8 +473,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -568,25 +490,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -626,6 +529,25 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Status @@ -641,7 +563,7 @@ private constructor( return true } - return other is Status && this.value == other.value + return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -708,5 +630,45 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, projectId, name, dateCreated, dateUpdated, dateLastSampleReceived, description, dateLastEvaluated, dateOfNextEvaluation, passingGoalCount, failingGoalCount, totalGoalCount, status, statusMessage, links, additionalProperties) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProjectInferencePipelineListResponse && this.items == other.items && this.additionalProperties == other.additionalProperties /* spotless:on */ } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "ProjectInferencePipelineListResponse{items=$items, additionalProperties=$additionalProperties}" } 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 ba784ac0..157c7ec6 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 @@ -53,24 +53,11 @@ constructor( 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 + return /* spotless:off */ 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 /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - name, - page, - perPage, - taskType, - additionalQueryParams, - additionalHeaders, - ) + return /* spotless:off */ Objects.hash(name, page, perPage, taskType, additionalQueryParams, additionalHeaders) /* spotless:on */ } override fun toString() = @@ -179,7 +166,7 @@ constructor( return true } - return other is TaskType && this.value == other.value + return /* spotless:off */ other is TaskType && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() 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 9c9d885d..11876d4f 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 @@ -29,8 +29,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun items(): List = items.getRequired("items") @JsonProperty("items") @ExcludeMissing fun _items() = items @@ -48,26 +46,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ProjectListResponse && - this.items == other.items && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(items, additionalProperties) - } - return hashCode - } - - override fun toString() = - "ProjectListResponse{items=$items, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -136,8 +114,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The project id. */ fun id(): String = id.getRequired("id") @@ -269,60 +245,6 @@ private constructor( 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 - } - - 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 - } - - 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() @@ -561,8 +483,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun app(): String = app.getRequired("app") @JsonProperty("app") @ExcludeMissing fun _app() = app @@ -580,25 +500,6 @@ private constructor( fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Links && - this.app == other.app && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(app, additionalProperties) - } - return hashCode - } - - override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -638,6 +539,25 @@ private constructor( fun build(): Links = Links(app, additionalProperties.toUnmodifiable()) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Links && this.app == other.app && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(app, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" } class Source @@ -653,7 +573,7 @@ private constructor( return true } - return other is Source && this.value == other.value + return /* spotless:off */ other is Source && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -716,7 +636,7 @@ private constructor( return true } - return other is TaskType && this.value == other.value + return /* spotless:off */ other is TaskType && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -794,8 +714,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - fun id(): String = id.getRequired("id") fun gitId(): Long = gitId.getRequired("gitId") @@ -868,52 +786,6 @@ private 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 - } - - 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 - } - - 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() @@ -1064,6 +936,66 @@ private constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, gitId, dateConnected, dateUpdated, branch, name, private_, slug, url, rootDir, projectId, gitAccountId, additionalProperties) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, workspaceId, creatorId, name, dateCreated, dateUpdated, description, source, taskType, versionCount, inferencePipelineCount, goalCount, developmentGoalCount, monitoringGoalCount, links, gitRepo, additionalProperties) /* spotless:on */ + } + 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProjectListResponse && this.items == other.items && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(items, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "ProjectListResponse{items=$items, additionalProperties=$additionalProperties}" } 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 e5085a53..4f61d0d7 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 @@ -45,20 +45,11 @@ constructor( return true } - return other is StoragePresignedUrlCreateParams && - this.objectName == other.objectName && - this.additionalQueryParams == other.additionalQueryParams && - this.additionalHeaders == other.additionalHeaders && - this.additionalBodyProperties == other.additionalBodyProperties + return /* spotless:off */ other is StoragePresignedUrlCreateParams && this.objectName == other.objectName && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return Objects.hash( - objectName, - additionalQueryParams, - additionalHeaders, - additionalBodyProperties, - ) + return /* spotless:off */ Objects.hash(objectName, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ } override fun toString() = 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 57c2fcab..41a88e77 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 @@ -26,8 +26,6 @@ private constructor( private var validated: Boolean = false - private var hashCode: Int = 0 - /** The presigned url. */ fun url(): String = url.getRequired("url") @@ -37,7 +35,7 @@ private constructor( /** The presigned url. */ @JsonProperty("url") @ExcludeMissing fun _url() = url - /** Fields to include in the body of the upload. Only needed by s3. */ + /** Fields to include in the body of the upload. Only needed by s3 */ @JsonProperty("fields") @ExcludeMissing fun _fields() = fields /** The storage URI to send back to the backend after the upload was completed. */ @@ -57,34 +55,6 @@ private constructor( 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 - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = - Objects.hash( - url, - fields, - storageUri, - additionalProperties, - ) - } - return hashCode - } - - override fun toString() = - "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" - companion object { @JvmStatic fun builder() = Builder() @@ -114,7 +84,7 @@ private constructor( @ExcludeMissing fun url(url: JsonField) = apply { this.url = url } - /** Fields to include in the body of the upload. Only needed by s3. */ + /** Fields to include in the body of the upload. Only needed by s3 */ @JsonProperty("fields") @ExcludeMissing fun fields(fields: JsonValue) = apply { this.fields = fields } @@ -149,4 +119,24 @@ private constructor( additionalProperties.toUnmodifiable(), ) } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is StoragePresignedUrlCreateResponse && this.url == other.url && this.fields == other.fields && this.storageUri == other.storageUri && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(url, fields, storageUri, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "StoragePresignedUrlCreateResponse{url=$url, fields=$fields, storageUri=$storageUri, additionalProperties=$additionalProperties}" } 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 92fd5e92..2fbb5b68 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 @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async import com.openlayer.api.services.async.commits.TestResultServiceAsync 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 ef73e6d6..9fcf0d46 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 @@ -3,19 +3,14 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerError 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 { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val testResults: TestResultServiceAsync by lazy { TestResultServiceAsyncImpl(clientOptions) } 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 c5fd0917..e4629910 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 @@ -4,9 +4,14 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.emptyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDeleteParams import com.openlayer.api.models.InferencePipelineRetrieveParams @@ -19,11 +24,6 @@ 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.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl 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 b49f4497..373608cd 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 @@ -4,9 +4,13 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse @@ -16,10 +20,6 @@ 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 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 6a59073c..2030c4a0 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 @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.async import com.openlayer.api.services.async.storage.PresignedUrlServiceAsync 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 2dd732c8..088fa251 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 @@ -3,19 +3,14 @@ package com.openlayer.api.services.async import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerError 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 { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val presignedUrl: PresignedUrlServiceAsync by lazy { PresignedUrlServiceAsyncImpl(clientOptions) } 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 ac4c25f0..5751b5b9 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 @@ -4,15 +4,15 @@ package com.openlayer.api.services.async.commits import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl 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 bbbf7845..8603c032 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 @@ -4,16 +4,16 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture class DataServiceAsyncImpl 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 9304fa72..9e59f90b 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 @@ -4,16 +4,16 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError 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.withErrorHandler import java.util.concurrent.CompletableFuture class RowServiceAsyncImpl 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 0b4305b8..86768cd0 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 @@ -4,15 +4,15 @@ package com.openlayer.api.services.async.inferencePipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture class TestResultServiceAsyncImpl 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 9fb60aa9..969be985 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 @@ -4,15 +4,15 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture class CommitServiceAsyncImpl 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 262589d6..684645ca 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 @@ -4,18 +4,18 @@ package com.openlayer.api.services.async.projects import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineCreateResponse import com.openlayer.api.models.ProjectInferencePipelineListParams import com.openlayer.api.models.ProjectInferencePipelineListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler import java.util.concurrent.CompletableFuture class InferencePipelineServiceAsyncImpl 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 65a69721..8eba2cec 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 @@ -4,16 +4,16 @@ package com.openlayer.api.services.async.storage import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError 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.withErrorHandler import java.util.concurrent.CompletableFuture class PresignedUrlServiceAsyncImpl 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 86553e1a..6c803869 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 @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking import com.openlayer.api.services.blocking.commits.TestResultService 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 cae0abd5..50222a85 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 @@ -3,19 +3,14 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerError 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 { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val testResults: TestResultService by lazy { TestResultServiceImpl(clientOptions) } override fun testResults(): TestResultService = testResults 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 efc4fb65..1a94ff39 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 @@ -4,9 +4,14 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.emptyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDeleteParams import com.openlayer.api.models.InferencePipelineRetrieveParams @@ -19,11 +24,6 @@ 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.emptyHandler -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class InferencePipelineServiceImpl constructor( 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 e4416024..52fe8255 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 @@ -4,9 +4,13 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCreateParams import com.openlayer.api.models.ProjectCreateResponse @@ -16,10 +20,6 @@ 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( 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 bd8b0a07..20ae29ab 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 @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. -@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 - package com.openlayer.api.services.blocking import com.openlayer.api.services.blocking.storage.PresignedUrlService 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 25ff0433..f33a55fc 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 @@ -3,19 +3,14 @@ package com.openlayer.api.services.blocking import com.openlayer.api.core.ClientOptions -import com.openlayer.api.core.http.HttpResponse.Handler -import com.openlayer.api.errors.OpenlayerError 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 { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val presignedUrl: PresignedUrlService by lazy { PresignedUrlServiceImpl(clientOptions) } override fun presignedUrl(): PresignedUrlService = presignedUrl 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 01739b4e..6adb5c27 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 @@ -4,15 +4,15 @@ package com.openlayer.api.services.blocking.commits import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.CommitTestResultListParams import com.openlayer.api.models.CommitTestResultListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( 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 41c4268b..e403f4e2 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 @@ -4,16 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineDataStreamParams import com.openlayer.api.models.InferencePipelineDataStreamResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class DataServiceImpl constructor( 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 d5f73a01..4ea01200 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 @@ -4,16 +4,16 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError 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.withErrorHandler class RowServiceImpl constructor( 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 675b14fa..1fdc8081 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 @@ -4,15 +4,15 @@ package com.openlayer.api.services.blocking.inferencePipelines import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.InferencePipelineTestResultListParams import com.openlayer.api.models.InferencePipelineTestResultListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class TestResultServiceImpl constructor( 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 6cb03429..34e62066 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 @@ -4,15 +4,15 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler import com.openlayer.api.core.http.HttpMethod import com.openlayer.api.core.http.HttpRequest import com.openlayer.api.core.http.HttpResponse.Handler import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectCommitListParams import com.openlayer.api.models.ProjectCommitListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class CommitServiceImpl constructor( 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 cb8655e8..c0bd16fe 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 @@ -4,18 +4,18 @@ package com.openlayer.api.services.blocking.projects import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError import com.openlayer.api.models.ProjectInferencePipelineCreateParams import com.openlayer.api.models.ProjectInferencePipelineCreateResponse import com.openlayer.api.models.ProjectInferencePipelineListParams import com.openlayer.api.models.ProjectInferencePipelineListResponse -import com.openlayer.api.services.errorHandler -import com.openlayer.api.services.json -import com.openlayer.api.services.jsonHandler -import com.openlayer.api.services.withErrorHandler class InferencePipelineServiceImpl constructor( 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 dabbfe51..ff12abd9 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 @@ -4,16 +4,16 @@ package com.openlayer.api.services.blocking.storage import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.handlers.withErrorHandler 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.json import com.openlayer.api.errors.OpenlayerError 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.withErrorHandler class PresignedUrlServiceImpl constructor( diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt new file mode 100644 index 00000000..b991a43c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/core/PhantomReachableTest.kt @@ -0,0 +1,27 @@ +package com.openlayer.api.core + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PhantomReachableTest { + + @Test + fun closeWhenPhantomReachable_whenObservedIsGarbageCollected_closesCloseable() { + var closed = false + val closeable = AutoCloseable { closed = true } + + closeWhenPhantomReachable( + // Pass an inline object for the object to observe so that it becomes immediately + // unreachable. + Any(), + closeable + ) + + assertThat(closed).isFalse() + + System.gc() + Thread.sleep(3000) + + assertThat(closed).isTrue() + } +} 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 ce977993..c6ccd9b7 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 @@ -8,6 +8,8 @@ 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.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ValueSource @WireMockTest internal class RetryingHttpClientTest { @@ -50,8 +52,9 @@ internal class RetryingHttpClientTest { verify(1, postRequestedFor(urlPathEqualTo("/something"))) } - @Test - fun retryAfterHeader() { + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun retryAfterHeader(async: Boolean) { val request = HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build() stubFor( @@ -79,9 +82,67 @@ internal class RetryingHttpClientTest { ) val retryingClient = RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() - val response = retryingClient.execute(request) + + val response = + if (async) retryingClient.executeAsync(request).get() + else retryingClient.execute(request) + assertThat(response.statusCode()).isEqualTo(200) - verify(3, postRequestedFor(urlPathEqualTo("/something"))) + verify( + 1, + postRequestedFor(urlPathEqualTo("/something")) + .withHeader("x-stainless-retry-count", equalTo("0")) + ) + verify( + 1, + postRequestedFor(urlPathEqualTo("/something")) + .withHeader("x-stainless-retry-count", equalTo("1")) + ) + verify( + 1, + postRequestedFor(urlPathEqualTo("/something")) + .withHeader("x-stainless-retry-count", equalTo("2")) + ) + } + + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun overwriteRetryCountHeader(async: Boolean) { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegment("something") + .putHeader("x-stainless-retry-count", "42") + .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") + ) + .willSetStateTo("RETRY_AFTER_DATE") + ) + stubFor( + post(urlPathEqualTo("/something")) + .inScenario("foo") // then we return a success + .whenScenarioStateIs("RETRY_AFTER_DATE") + .willReturn(ok()) + .willSetStateTo("COMPLETED") + ) + val retryingClient = + RetryingHttpClient.builder().httpClient(httpClient).maxRetries(2).build() + + val response = + if (async) retryingClient.executeAsync(request).get() + else retryingClient.execute(request) + + assertThat(response.statusCode()).isEqualTo(200) + verify( + 2, + postRequestedFor(urlPathEqualTo("/something")) + .withHeader("x-stainless-retry-count", equalTo("42")) + ) } @Test 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 73bb4f1f..13d97362 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 @@ -56,7 +56,7 @@ class CommitTestResultListResponseTest { .value( CommitTestResultListResponse.Item.Goal.Threshold .Value - .ofDouble(42.23) + .ofNumber(42.23) ) .build() ) @@ -119,7 +119,7 @@ class CommitTestResultListResponseTest { .operator("<=") .value( CommitTestResultListResponse.Item.Goal.Threshold.Value - .ofDouble(42.23) + .ofNumber(42.23) ) .build() ) 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 9395377f..96afb478 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 @@ -59,7 +59,7 @@ class InferencePipelineTestResultListResponseTest { .Goal .Threshold .Value - .ofDouble(42.23) + .ofNumber(42.23) ) .build() ) @@ -125,7 +125,7 @@ class InferencePipelineTestResultListResponseTest { InferencePipelineTestResultListResponse.Item.Goal .Threshold .Value - .ofDouble(42.23) + .ofNumber(42.23) ) .build() )