22
33package com.openai.models.audio.translations
44
5+ import com.fasterxml.jackson.annotation.JsonAnyGetter
6+ import com.fasterxml.jackson.annotation.JsonAnySetter
57import com.fasterxml.jackson.annotation.JsonCreator
68import com.fasterxml.jackson.annotation.JsonProperty
79import com.openai.core.Enum
810import com.openai.core.ExcludeMissing
911import com.openai.core.JsonField
12+ import com.openai.core.JsonValue
1013import com.openai.core.MultipartField
1114import com.openai.core.Params
1215import com.openai.core.checkRequired
@@ -17,6 +20,7 @@ import com.openai.errors.OpenAIInvalidDataException
1720import com.openai.models.audio.AudioModel
1821import java.io.InputStream
1922import java.nio.file.Path
23+ import java.util.Collections
2024import java.util.Objects
2125import java.util.Optional
2226import kotlin.io.path.inputStream
@@ -115,6 +119,8 @@ private constructor(
115119 */
116120 fun _temperature (): MultipartField <Double > = body._temperature ()
117121
122+ fun _additionalBodyProperties (): Map <String , JsonValue > = body._additionalProperties ()
123+
118124 fun _additionalHeaders (): Headers = additionalHeaders
119125
120126 fun _additionalQueryParams (): QueryParams = additionalQueryParams
@@ -267,6 +273,25 @@ private constructor(
267273 body.temperature(temperature)
268274 }
269275
276+ fun additionalBodyProperties (additionalBodyProperties : Map <String , JsonValue >) = apply {
277+ body.additionalProperties(additionalBodyProperties)
278+ }
279+
280+ fun putAdditionalBodyProperty (key : String , value : JsonValue ) = apply {
281+ body.putAdditionalProperty(key, value)
282+ }
283+
284+ fun putAllAdditionalBodyProperties (additionalBodyProperties : Map <String , JsonValue >) =
285+ apply {
286+ body.putAllAdditionalProperties(additionalBodyProperties)
287+ }
288+
289+ fun removeAdditionalBodyProperty (key : String ) = apply { body.removeAdditionalProperty(key) }
290+
291+ fun removeAllAdditionalBodyProperties (keys : Set <String >) = apply {
292+ body.removeAllAdditionalProperties(keys)
293+ }
294+
270295 fun additionalHeaders (additionalHeaders : Headers ) = apply {
271296 this .additionalHeaders.clear()
272297 putAllAdditionalHeaders(additionalHeaders)
@@ -387,13 +412,13 @@ private constructor(
387412 }
388413
389414 fun _body (): Map <String , MultipartField <* >> =
390- mapOf (
415+ ( mapOf (
391416 " file" to _file (),
392417 " model" to _model (),
393418 " prompt" to _prompt (),
394419 " response_format" to _responseFormat (),
395420 " temperature" to _temperature (),
396- )
421+ ) + _additionalBodyProperties ().mapValues { MultipartField .of(it) })
397422 .toImmutable()
398423
399424 override fun _headers (): Headers = additionalHeaders
@@ -407,6 +432,7 @@ private constructor(
407432 private val prompt: MultipartField <String >,
408433 private val responseFormat: MultipartField <ResponseFormat >,
409434 private val temperature: MultipartField <Double >,
435+ private val additionalProperties: MutableMap <String , JsonValue >,
410436 ) {
411437
412438 /* *
@@ -500,6 +526,16 @@ private constructor(
500526 @ExcludeMissing
501527 fun _temperature (): MultipartField <Double > = temperature
502528
529+ @JsonAnySetter
530+ private fun putAdditionalProperty (key : String , value : JsonValue ) {
531+ additionalProperties.put(key, value)
532+ }
533+
534+ @JsonAnyGetter
535+ @ExcludeMissing
536+ fun _additionalProperties (): Map <String , JsonValue > =
537+ Collections .unmodifiableMap(additionalProperties)
538+
503539 fun toBuilder () = Builder ().from(this )
504540
505541 companion object {
@@ -524,6 +560,7 @@ private constructor(
524560 private var prompt: MultipartField <String > = MultipartField .of(null )
525561 private var responseFormat: MultipartField <ResponseFormat > = MultipartField .of(null )
526562 private var temperature: MultipartField <Double > = MultipartField .of(null )
563+ private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
527564
528565 @JvmSynthetic
529566 internal fun from (body : Body ) = apply {
@@ -532,6 +569,7 @@ private constructor(
532569 prompt = body.prompt
533570 responseFormat = body.responseFormat
534571 temperature = body.temperature
572+ additionalProperties = body.additionalProperties.toMutableMap()
535573 }
536574
537575 /* *
@@ -645,6 +683,25 @@ private constructor(
645683 this .temperature = temperature
646684 }
647685
686+ fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
687+ this .additionalProperties.clear()
688+ putAllAdditionalProperties(additionalProperties)
689+ }
690+
691+ fun putAdditionalProperty (key : String , value : JsonValue ) = apply {
692+ additionalProperties.put(key, value)
693+ }
694+
695+ fun putAllAdditionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
696+ this .additionalProperties.putAll(additionalProperties)
697+ }
698+
699+ fun removeAdditionalProperty (key : String ) = apply { additionalProperties.remove(key) }
700+
701+ fun removeAllAdditionalProperties (keys : Set <String >) = apply {
702+ keys.forEach(::removeAdditionalProperty)
703+ }
704+
648705 /* *
649706 * Returns an immutable instance of [Body].
650707 *
@@ -665,6 +722,7 @@ private constructor(
665722 prompt,
666723 responseFormat,
667724 temperature,
725+ additionalProperties.toMutableMap(),
668726 )
669727 }
670728
@@ -696,17 +754,17 @@ private constructor(
696754 return true
697755 }
698756
699- return /* spotless:off */ other is Body && file == other.file && model == other.model && prompt == other.prompt && responseFormat == other.responseFormat && temperature == other.temperature /* spotless:on */
757+ return /* spotless:off */ other is Body && file == other.file && model == other.model && prompt == other.prompt && responseFormat == other.responseFormat && temperature == other.temperature && additionalProperties == other.additionalProperties /* spotless:on */
700758 }
701759
702760 /* spotless:off */
703- private val hashCode: Int by lazy { Objects .hash(file, model, prompt, responseFormat, temperature) }
761+ private val hashCode: Int by lazy { Objects .hash(file, model, prompt, responseFormat, temperature, additionalProperties ) }
704762 /* spotless:on */
705763
706764 override fun hashCode (): Int = hashCode
707765
708766 override fun toString () =
709- " Body{file=$file , model=$model , prompt=$prompt , responseFormat=$responseFormat , temperature=$temperature }"
767+ " Body{file=$file , model=$model , prompt=$prompt , responseFormat=$responseFormat , temperature=$temperature , additionalProperties= $additionalProperties }"
710768 }
711769
712770 /* *
0 commit comments