Skip to content

Commit

Permalink
fix: remove additionalBodyProperties from methods that don't support …
Browse files Browse the repository at this point in the history
…request bodies

chore: unknown commit message
  • Loading branch information
stainless-bot authored and Stainless Bot committed Aug 22, 2024
1 parent babeb82 commit df81636
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package com.openai.models

import com.openai.core.JsonValue
import com.openai.core.NoAutoDetect
import com.openai.core.toUnmodifiable
import com.openai.models.*
Expand All @@ -15,7 +14,6 @@ constructor(
private val limit: Long?,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
private val additionalBodyProperties: Map<String, JsonValue>,
) {

fun after(): Optional<String> = Optional.ofNullable(after)
Expand All @@ -37,8 +35,6 @@ constructor(

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
Expand All @@ -48,8 +44,7 @@ constructor(
this.after == other.after &&
this.limit == other.limit &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders &&
this.additionalBodyProperties == other.additionalBodyProperties
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
Expand All @@ -58,12 +53,11 @@ constructor(
limit,
additionalQueryParams,
additionalHeaders,
additionalBodyProperties,
)
}

override fun toString() =
"BatchListParams{after=$after, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
"BatchListParams{after=$after, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

Expand All @@ -79,15 +73,13 @@ constructor(
private var limit: Long? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(batchListParams: BatchListParams) = apply {
this.after = batchListParams.after
this.limit = batchListParams.limit
additionalQueryParams(batchListParams.additionalQueryParams)
additionalHeaders(batchListParams.additionalHeaders)
additionalBodyProperties(batchListParams.additionalBodyProperties)
}

/**
Expand Down Expand Up @@ -144,27 +136,12 @@ constructor(

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
this.additionalBodyProperties.put(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun build(): BatchListParams =
BatchListParams(
after,
limit,
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package com.openai.models

import com.openai.core.JsonValue
import com.openai.core.NoAutoDetect
import com.openai.core.toUnmodifiable
import com.openai.models.*
Expand All @@ -13,7 +12,6 @@ constructor(
private val batchId: String,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
private val additionalBodyProperties: Map<String, JsonValue>,
) {

fun batchId(): String = batchId
Expand All @@ -33,8 +31,6 @@ constructor(

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
Expand All @@ -43,21 +39,19 @@ constructor(
return other is BatchRetrieveParams &&
this.batchId == other.batchId &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders &&
this.additionalBodyProperties == other.additionalBodyProperties
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
return Objects.hash(
batchId,
additionalQueryParams,
additionalHeaders,
additionalBodyProperties,
)
}

override fun toString() =
"BatchRetrieveParams{batchId=$batchId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
"BatchRetrieveParams{batchId=$batchId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

Expand All @@ -72,14 +66,12 @@ constructor(
private var batchId: String? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(batchRetrieveParams: BatchRetrieveParams) = apply {
this.batchId = batchRetrieveParams.batchId
additionalQueryParams(batchRetrieveParams.additionalQueryParams)
additionalHeaders(batchRetrieveParams.additionalHeaders)
additionalBodyProperties(batchRetrieveParams.additionalBodyProperties)
}

fun batchId(batchId: String) = apply { this.batchId = batchId }
Expand Down Expand Up @@ -124,26 +116,11 @@ constructor(

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
this.additionalBodyProperties.put(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun build(): BatchRetrieveParams =
BatchRetrieveParams(
checkNotNull(batchId) { "`batchId` is required but was not set" },
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package com.openai.models

import com.openai.core.JsonValue
import com.openai.core.NoAutoDetect
import com.openai.core.toUnmodifiable
import com.openai.models.*
Expand All @@ -13,7 +12,6 @@ constructor(
private val fileId: String,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
private val additionalBodyProperties: Map<String, JsonValue>,
) {

fun fileId(): String = fileId
Expand All @@ -33,8 +31,6 @@ constructor(

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
Expand All @@ -43,21 +39,19 @@ constructor(
return other is FileContentParams &&
this.fileId == other.fileId &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders &&
this.additionalBodyProperties == other.additionalBodyProperties
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
return Objects.hash(
fileId,
additionalQueryParams,
additionalHeaders,
additionalBodyProperties,
)
}

override fun toString() =
"FileContentParams{fileId=$fileId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
"FileContentParams{fileId=$fileId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

Expand All @@ -72,14 +66,12 @@ constructor(
private var fileId: String? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(fileContentParams: FileContentParams) = apply {
this.fileId = fileContentParams.fileId
additionalQueryParams(fileContentParams.additionalQueryParams)
additionalHeaders(fileContentParams.additionalHeaders)
additionalBodyProperties(fileContentParams.additionalBodyProperties)
}

fun fileId(fileId: String) = apply { this.fileId = fileId }
Expand Down Expand Up @@ -124,26 +116,11 @@ constructor(

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
this.additionalBodyProperties.put(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun build(): FileContentParams =
FileContentParams(
checkNotNull(fileId) { "`fileId` is required but was not set" },
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package com.openai.models

import com.openai.core.JsonValue
import com.openai.core.NoAutoDetect
import com.openai.core.toUnmodifiable
import com.openai.models.*
Expand All @@ -14,7 +13,6 @@ constructor(
private val purpose: String?,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
private val additionalBodyProperties: Map<String, JsonValue>,
) {

fun purpose(): Optional<String> = Optional.ofNullable(purpose)
Expand All @@ -33,8 +31,6 @@ constructor(

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
Expand All @@ -43,21 +39,19 @@ constructor(
return other is FileListParams &&
this.purpose == other.purpose &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders &&
this.additionalBodyProperties == other.additionalBodyProperties
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
return Objects.hash(
purpose,
additionalQueryParams,
additionalHeaders,
additionalBodyProperties,
)
}

override fun toString() =
"FileListParams{purpose=$purpose, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
"FileListParams{purpose=$purpose, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

Expand All @@ -72,14 +66,12 @@ constructor(
private var purpose: String? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(fileListParams: FileListParams) = apply {
this.purpose = fileListParams.purpose
additionalQueryParams(fileListParams.additionalQueryParams)
additionalHeaders(fileListParams.additionalHeaders)
additionalBodyProperties(fileListParams.additionalBodyProperties)
}

/** Only return files with the given purpose. */
Expand Down Expand Up @@ -125,26 +117,11 @@ constructor(

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
this.additionalBodyProperties.put(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
}

fun build(): FileListParams =
FileListParams(
purpose,
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
)
}
}
Loading

0 comments on commit df81636

Please sign in to comment.