Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOTICE: Stainless generated code has conflicted with your custom code #33

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ internal fun <T> List<T>.toImmutable(): List<T> =

@JvmSynthetic
internal fun <K, V> Map<K, V>.toImmutable(): Map<K, V> =
if (isEmpty()) Collections.emptyMap() else Collections.unmodifiableMap(toMap())
if (isEmpty()) immutableEmptyMap() else Collections.unmodifiableMap(toMap())

@JvmSynthetic internal fun <K, V> immutableEmptyMap(): Map<K, V> = Collections.emptyMap()

@JvmSynthetic
internal fun <K : Comparable<K>, V> SortedMap<K, V>.toImmutable(): SortedMap<K, V> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ package com.anthropic.errors
import com.anthropic.core.ExcludeMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.annotation.JsonCreator
import java.util.Objects

@JsonDeserialize(builder = AnthropicError.Builder::class)
@NoAutoDetect
class AnthropicError
@JsonCreator
private constructor(
@JsonAnyGetter
@ExcludeMissing
@JsonAnySetter
@get:JvmName("additionalProperties")
val additionalProperties: Map<String, JsonValue>,
val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun toBuilder() = Builder().from(this)
Expand All @@ -42,7 +44,6 @@ private constructor(
putAllAdditionalProperties(additionalProperties)
}

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ import com.anthropic.core.JsonField
import com.anthropic.core.JsonMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.anthropic.errors.AnthropicInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.Objects

@JsonDeserialize(builder = ApiErrorObject.Builder::class)
@NoAutoDetect
class ApiErrorObject
@JsonCreator
private constructor(
private val type: JsonField<Type>,
private val message: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("message")
@ExcludeMissing
private val message: JsonField<String> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun type(): Type = type.getRequired("type")
Expand Down Expand Up @@ -70,22 +72,17 @@ private constructor(

fun type(type: Type) = type(JsonField.of(type))

@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }

fun message(message: String) = message(JsonField.of(message))

@JsonProperty("message")
@ExcludeMissing
fun message(message: JsonField<String>) = apply { this.message = message }

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

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ import com.anthropic.core.JsonField
import com.anthropic.core.JsonMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.anthropic.errors.AnthropicInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.Objects

@JsonDeserialize(builder = AuthenticationError.Builder::class)
@NoAutoDetect
class AuthenticationError
@JsonCreator
private constructor(
private val type: JsonField<Type>,
private val message: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("message")
@ExcludeMissing
private val message: JsonField<String> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun type(): Type = type.getRequired("type")
Expand Down Expand Up @@ -70,22 +72,17 @@ private constructor(

fun type(type: Type) = type(JsonField.of(type))

@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }

fun message(message: String) = message(JsonField.of(message))

@JsonProperty("message")
@ExcludeMissing
fun message(message: JsonField<String>) = apply { this.message = message }

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

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@ import com.anthropic.core.JsonField
import com.anthropic.core.JsonMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.anthropic.errors.AnthropicInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.Objects

@JsonDeserialize(builder = Base64PdfSource.Builder::class)
@NoAutoDetect
class Base64PdfSource
@JsonCreator
private constructor(
private val type: JsonField<Type>,
private val mediaType: JsonField<MediaType>,
private val data: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("media_type")
@ExcludeMissing
private val mediaType: JsonField<MediaType> = JsonMissing.of(),
@JsonProperty("data") @ExcludeMissing private val data: JsonField<String> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun type(): Type = type.getRequired("type")
Expand Down Expand Up @@ -78,28 +80,21 @@ private constructor(

fun type(type: Type) = type(JsonField.of(type))

@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }

fun mediaType(mediaType: MediaType) = mediaType(JsonField.of(mediaType))

@JsonProperty("media_type")
@ExcludeMissing
fun mediaType(mediaType: JsonField<MediaType>) = apply { this.mediaType = mediaType }

fun data(data: String) = data(JsonField.of(data))

@JsonProperty("data")
@ExcludeMissing
fun data(data: JsonField<String>) = apply { this.data = data }

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

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ import com.anthropic.core.JsonField
import com.anthropic.core.JsonMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.anthropic.errors.AnthropicInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.Objects

@JsonDeserialize(builder = BetaApiError.Builder::class)
@NoAutoDetect
class BetaApiError
@JsonCreator
private constructor(
private val type: JsonField<Type>,
private val message: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("message")
@ExcludeMissing
private val message: JsonField<String> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun type(): Type = type.getRequired("type")
Expand Down Expand Up @@ -70,22 +72,17 @@ private constructor(

fun type(type: Type) = type(JsonField.of(type))

@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }

fun message(message: String) = message(JsonField.of(message))

@JsonProperty("message")
@ExcludeMissing
fun message(message: JsonField<String>) = apply { this.message = message }

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

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ import com.anthropic.core.JsonField
import com.anthropic.core.JsonMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.anthropic.errors.AnthropicInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.Objects

@JsonDeserialize(builder = BetaAuthenticationError.Builder::class)
@NoAutoDetect
class BetaAuthenticationError
@JsonCreator
private constructor(
private val type: JsonField<Type>,
private val message: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("message")
@ExcludeMissing
private val message: JsonField<String> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun type(): Type = type.getRequired("type")
Expand Down Expand Up @@ -70,22 +72,17 @@ private constructor(

fun type(type: Type) = type(JsonField.of(type))

@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }

fun message(message: String) = message(JsonField.of(message))

@JsonProperty("message")
@ExcludeMissing
fun message(message: JsonField<String>) = apply { this.message = message }

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

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ import com.anthropic.core.JsonField
import com.anthropic.core.JsonMissing
import com.anthropic.core.JsonValue
import com.anthropic.core.NoAutoDetect
import com.anthropic.core.immutableEmptyMap
import com.anthropic.core.toImmutable
import com.anthropic.errors.AnthropicInvalidDataException
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.Objects
import java.util.Optional

@JsonDeserialize(builder = BetaBase64PdfBlock.Builder::class)
@NoAutoDetect
class BetaBase64PdfBlock
@JsonCreator
private constructor(
private val cacheControl: JsonField<BetaCacheControlEphemeral>,
private val type: JsonField<Type>,
private val source: JsonField<BetaBase64PdfSource>,
private val additionalProperties: Map<String, JsonValue>,
@JsonProperty("cache_control")
@ExcludeMissing
private val cacheControl: JsonField<BetaCacheControlEphemeral> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("source")
@ExcludeMissing
private val source: JsonField<BetaBase64PdfSource> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun cacheControl(): Optional<BetaCacheControlEphemeral> =
Expand Down Expand Up @@ -81,30 +85,23 @@ private constructor(
fun cacheControl(cacheControl: BetaCacheControlEphemeral) =
cacheControl(JsonField.of(cacheControl))

@JsonProperty("cache_control")
@ExcludeMissing
fun cacheControl(cacheControl: JsonField<BetaCacheControlEphemeral>) = apply {
this.cacheControl = cacheControl
}

fun type(type: Type) = type(JsonField.of(type))

@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }

fun source(source: BetaBase64PdfSource) = source(JsonField.of(source))

@JsonProperty("source")
@ExcludeMissing
fun source(source: JsonField<BetaBase64PdfSource>) = apply { this.source = source }

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

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Loading