|
| 1 | +// File generated from our OpenAPI spec by Stainless. |
| 2 | + |
| 3 | +package com.openlayer.api.models |
| 4 | + |
| 5 | +import com.fasterxml.jackson.annotation.JsonAnyGetter |
| 6 | +import com.fasterxml.jackson.annotation.JsonAnySetter |
| 7 | +import com.fasterxml.jackson.annotation.JsonProperty |
| 8 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize |
| 9 | +import com.openlayer.api.core.ExcludeMissing |
| 10 | +import com.openlayer.api.core.JsonValue |
| 11 | +import com.openlayer.api.core.NoAutoDetect |
| 12 | +import com.openlayer.api.core.toUnmodifiable |
| 13 | +import com.openlayer.api.models.* |
| 14 | +import java.util.Objects |
| 15 | +import java.util.Optional |
| 16 | + |
| 17 | +class InferencePipelineUpdateParams |
| 18 | +constructor( |
| 19 | + private val inferencePipelineId: String, |
| 20 | + private val description: String?, |
| 21 | + private val name: String?, |
| 22 | + private val referenceDatasetUri: String?, |
| 23 | + private val additionalQueryParams: Map<String, List<String>>, |
| 24 | + private val additionalHeaders: Map<String, List<String>>, |
| 25 | + private val additionalBodyProperties: Map<String, JsonValue>, |
| 26 | +) { |
| 27 | + |
| 28 | + fun inferencePipelineId(): String = inferencePipelineId |
| 29 | + |
| 30 | + fun description(): Optional<String> = Optional.ofNullable(description) |
| 31 | + |
| 32 | + fun name(): Optional<String> = Optional.ofNullable(name) |
| 33 | + |
| 34 | + fun referenceDatasetUri(): Optional<String> = Optional.ofNullable(referenceDatasetUri) |
| 35 | + |
| 36 | + @JvmSynthetic |
| 37 | + internal fun getBody(): InferencePipelineUpdateBody { |
| 38 | + return InferencePipelineUpdateBody( |
| 39 | + description, |
| 40 | + name, |
| 41 | + referenceDatasetUri, |
| 42 | + additionalBodyProperties, |
| 43 | + ) |
| 44 | + } |
| 45 | + |
| 46 | + @JvmSynthetic internal fun getQueryParams(): Map<String, List<String>> = additionalQueryParams |
| 47 | + |
| 48 | + @JvmSynthetic internal fun getHeaders(): Map<String, List<String>> = additionalHeaders |
| 49 | + |
| 50 | + fun getPathParam(index: Int): String { |
| 51 | + return when (index) { |
| 52 | + 0 -> inferencePipelineId |
| 53 | + else -> "" |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + @JsonDeserialize(builder = InferencePipelineUpdateBody.Builder::class) |
| 58 | + @NoAutoDetect |
| 59 | + class InferencePipelineUpdateBody |
| 60 | + internal constructor( |
| 61 | + private val description: String?, |
| 62 | + private val name: String?, |
| 63 | + private val referenceDatasetUri: String?, |
| 64 | + private val additionalProperties: Map<String, JsonValue>, |
| 65 | + ) { |
| 66 | + |
| 67 | + private var hashCode: Int = 0 |
| 68 | + |
| 69 | + /** The inference pipeline description. */ |
| 70 | + @JsonProperty("description") fun description(): String? = description |
| 71 | + |
| 72 | + /** The inference pipeline name. */ |
| 73 | + @JsonProperty("name") fun name(): String? = name |
| 74 | + |
| 75 | + /** |
| 76 | + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to |
| 77 | + * handle your reference dataset updates. |
| 78 | + */ |
| 79 | + @JsonProperty("referenceDatasetUri") |
| 80 | + fun referenceDatasetUri(): String? = referenceDatasetUri |
| 81 | + |
| 82 | + @JsonAnyGetter |
| 83 | + @ExcludeMissing |
| 84 | + fun _additionalProperties(): Map<String, JsonValue> = additionalProperties |
| 85 | + |
| 86 | + fun toBuilder() = Builder().from(this) |
| 87 | + |
| 88 | + override fun equals(other: Any?): Boolean { |
| 89 | + if (this === other) { |
| 90 | + return true |
| 91 | + } |
| 92 | + |
| 93 | + return other is InferencePipelineUpdateBody && |
| 94 | + this.description == other.description && |
| 95 | + this.name == other.name && |
| 96 | + this.referenceDatasetUri == other.referenceDatasetUri && |
| 97 | + this.additionalProperties == other.additionalProperties |
| 98 | + } |
| 99 | + |
| 100 | + override fun hashCode(): Int { |
| 101 | + if (hashCode == 0) { |
| 102 | + hashCode = |
| 103 | + Objects.hash( |
| 104 | + description, |
| 105 | + name, |
| 106 | + referenceDatasetUri, |
| 107 | + additionalProperties, |
| 108 | + ) |
| 109 | + } |
| 110 | + return hashCode |
| 111 | + } |
| 112 | + |
| 113 | + override fun toString() = |
| 114 | + "InferencePipelineUpdateBody{description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalProperties=$additionalProperties}" |
| 115 | + |
| 116 | + companion object { |
| 117 | + |
| 118 | + @JvmStatic fun builder() = Builder() |
| 119 | + } |
| 120 | + |
| 121 | + class Builder { |
| 122 | + |
| 123 | + private var description: String? = null |
| 124 | + private var name: String? = null |
| 125 | + private var referenceDatasetUri: String? = null |
| 126 | + private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf() |
| 127 | + |
| 128 | + @JvmSynthetic |
| 129 | + internal fun from(inferencePipelineUpdateBody: InferencePipelineUpdateBody) = apply { |
| 130 | + this.description = inferencePipelineUpdateBody.description |
| 131 | + this.name = inferencePipelineUpdateBody.name |
| 132 | + this.referenceDatasetUri = inferencePipelineUpdateBody.referenceDatasetUri |
| 133 | + additionalProperties(inferencePipelineUpdateBody.additionalProperties) |
| 134 | + } |
| 135 | + |
| 136 | + /** The inference pipeline description. */ |
| 137 | + @JsonProperty("description") |
| 138 | + fun description(description: String) = apply { this.description = description } |
| 139 | + |
| 140 | + /** The inference pipeline name. */ |
| 141 | + @JsonProperty("name") fun name(name: String) = apply { this.name = name } |
| 142 | + |
| 143 | + /** |
| 144 | + * The storage uri of your reference dataset. We recommend using the Python SDK or the |
| 145 | + * UI to handle your reference dataset updates. |
| 146 | + */ |
| 147 | + @JsonProperty("referenceDatasetUri") |
| 148 | + fun referenceDatasetUri(referenceDatasetUri: String) = apply { |
| 149 | + this.referenceDatasetUri = referenceDatasetUri |
| 150 | + } |
| 151 | + |
| 152 | + fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply { |
| 153 | + this.additionalProperties.clear() |
| 154 | + this.additionalProperties.putAll(additionalProperties) |
| 155 | + } |
| 156 | + |
| 157 | + @JsonAnySetter |
| 158 | + fun putAdditionalProperty(key: String, value: JsonValue) = apply { |
| 159 | + this.additionalProperties.put(key, value) |
| 160 | + } |
| 161 | + |
| 162 | + fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply { |
| 163 | + this.additionalProperties.putAll(additionalProperties) |
| 164 | + } |
| 165 | + |
| 166 | + fun build(): InferencePipelineUpdateBody = |
| 167 | + InferencePipelineUpdateBody( |
| 168 | + description, |
| 169 | + name, |
| 170 | + referenceDatasetUri, |
| 171 | + additionalProperties.toUnmodifiable(), |
| 172 | + ) |
| 173 | + } |
| 174 | + } |
| 175 | + |
| 176 | + fun _additionalQueryParams(): Map<String, List<String>> = additionalQueryParams |
| 177 | + |
| 178 | + fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders |
| 179 | + |
| 180 | + fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties |
| 181 | + |
| 182 | + override fun equals(other: Any?): Boolean { |
| 183 | + if (this === other) { |
| 184 | + return true |
| 185 | + } |
| 186 | + |
| 187 | + return other is InferencePipelineUpdateParams && |
| 188 | + this.inferencePipelineId == other.inferencePipelineId && |
| 189 | + this.description == other.description && |
| 190 | + this.name == other.name && |
| 191 | + this.referenceDatasetUri == other.referenceDatasetUri && |
| 192 | + this.additionalQueryParams == other.additionalQueryParams && |
| 193 | + this.additionalHeaders == other.additionalHeaders && |
| 194 | + this.additionalBodyProperties == other.additionalBodyProperties |
| 195 | + } |
| 196 | + |
| 197 | + override fun hashCode(): Int { |
| 198 | + return Objects.hash( |
| 199 | + inferencePipelineId, |
| 200 | + description, |
| 201 | + name, |
| 202 | + referenceDatasetUri, |
| 203 | + additionalQueryParams, |
| 204 | + additionalHeaders, |
| 205 | + additionalBodyProperties, |
| 206 | + ) |
| 207 | + } |
| 208 | + |
| 209 | + override fun toString() = |
| 210 | + "InferencePipelineUpdateParams{inferencePipelineId=$inferencePipelineId, description=$description, name=$name, referenceDatasetUri=$referenceDatasetUri, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" |
| 211 | + |
| 212 | + fun toBuilder() = Builder().from(this) |
| 213 | + |
| 214 | + companion object { |
| 215 | + |
| 216 | + @JvmStatic fun builder() = Builder() |
| 217 | + } |
| 218 | + |
| 219 | + @NoAutoDetect |
| 220 | + class Builder { |
| 221 | + |
| 222 | + private var inferencePipelineId: String? = null |
| 223 | + private var description: String? = null |
| 224 | + private var name: String? = null |
| 225 | + private var referenceDatasetUri: String? = null |
| 226 | + private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf() |
| 227 | + private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf() |
| 228 | + private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf() |
| 229 | + |
| 230 | + @JvmSynthetic |
| 231 | + internal fun from(inferencePipelineUpdateParams: InferencePipelineUpdateParams) = apply { |
| 232 | + this.inferencePipelineId = inferencePipelineUpdateParams.inferencePipelineId |
| 233 | + this.description = inferencePipelineUpdateParams.description |
| 234 | + this.name = inferencePipelineUpdateParams.name |
| 235 | + this.referenceDatasetUri = inferencePipelineUpdateParams.referenceDatasetUri |
| 236 | + additionalQueryParams(inferencePipelineUpdateParams.additionalQueryParams) |
| 237 | + additionalHeaders(inferencePipelineUpdateParams.additionalHeaders) |
| 238 | + additionalBodyProperties(inferencePipelineUpdateParams.additionalBodyProperties) |
| 239 | + } |
| 240 | + |
| 241 | + fun inferencePipelineId(inferencePipelineId: String) = apply { |
| 242 | + this.inferencePipelineId = inferencePipelineId |
| 243 | + } |
| 244 | + |
| 245 | + /** The inference pipeline description. */ |
| 246 | + fun description(description: String) = apply { this.description = description } |
| 247 | + |
| 248 | + /** The inference pipeline name. */ |
| 249 | + fun name(name: String) = apply { this.name = name } |
| 250 | + |
| 251 | + /** |
| 252 | + * The storage uri of your reference dataset. We recommend using the Python SDK or the UI to |
| 253 | + * handle your reference dataset updates. |
| 254 | + */ |
| 255 | + fun referenceDatasetUri(referenceDatasetUri: String) = apply { |
| 256 | + this.referenceDatasetUri = referenceDatasetUri |
| 257 | + } |
| 258 | + |
| 259 | + fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply { |
| 260 | + this.additionalQueryParams.clear() |
| 261 | + putAllQueryParams(additionalQueryParams) |
| 262 | + } |
| 263 | + |
| 264 | + fun putQueryParam(name: String, value: String) = apply { |
| 265 | + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) |
| 266 | + } |
| 267 | + |
| 268 | + fun putQueryParams(name: String, values: Iterable<String>) = apply { |
| 269 | + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) |
| 270 | + } |
| 271 | + |
| 272 | + fun putAllQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply { |
| 273 | + additionalQueryParams.forEach(this::putQueryParams) |
| 274 | + } |
| 275 | + |
| 276 | + fun removeQueryParam(name: String) = apply { |
| 277 | + this.additionalQueryParams.put(name, mutableListOf()) |
| 278 | + } |
| 279 | + |
| 280 | + fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply { |
| 281 | + this.additionalHeaders.clear() |
| 282 | + putAllHeaders(additionalHeaders) |
| 283 | + } |
| 284 | + |
| 285 | + fun putHeader(name: String, value: String) = apply { |
| 286 | + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) |
| 287 | + } |
| 288 | + |
| 289 | + fun putHeaders(name: String, values: Iterable<String>) = apply { |
| 290 | + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) |
| 291 | + } |
| 292 | + |
| 293 | + fun putAllHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply { |
| 294 | + additionalHeaders.forEach(this::putHeaders) |
| 295 | + } |
| 296 | + |
| 297 | + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } |
| 298 | + |
| 299 | + fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply { |
| 300 | + this.additionalBodyProperties.clear() |
| 301 | + this.additionalBodyProperties.putAll(additionalBodyProperties) |
| 302 | + } |
| 303 | + |
| 304 | + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { |
| 305 | + this.additionalBodyProperties.put(key, value) |
| 306 | + } |
| 307 | + |
| 308 | + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = |
| 309 | + apply { |
| 310 | + this.additionalBodyProperties.putAll(additionalBodyProperties) |
| 311 | + } |
| 312 | + |
| 313 | + fun build(): InferencePipelineUpdateParams = |
| 314 | + InferencePipelineUpdateParams( |
| 315 | + checkNotNull(inferencePipelineId) { |
| 316 | + "`inferencePipelineId` is required but was not set" |
| 317 | + }, |
| 318 | + description, |
| 319 | + name, |
| 320 | + referenceDatasetUri, |
| 321 | + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), |
| 322 | + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), |
| 323 | + additionalBodyProperties.toUnmodifiable(), |
| 324 | + ) |
| 325 | + } |
| 326 | +} |
0 commit comments