Skip to content

Commit

Permalink
style(internal): move enum identity methods to bottom of class (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Dec 11, 2024
1 parent 1effd49 commit 7a9d27a
Show file tree
Hide file tree
Showing 52 changed files with 1,018 additions and 1,018 deletions.
44 changes: 22 additions & 22 deletions openai-java-core/src/main/kotlin/com/openai/models/Batch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -466,18 +466,6 @@ private constructor(

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Object && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val BATCH = of("batch")
Expand Down Expand Up @@ -507,27 +495,27 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()
}

class Status
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Status && value == other.value /* spotless:on */
return /* spotless:off */ other is Object && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

class Status
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

companion object {

Expand Down Expand Up @@ -600,6 +588,18 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Status && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

@JsonDeserialize(builder = Errors.Builder::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,18 +411,6 @@ constructor(

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is CompletionWindow && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val _24H = of("24h")
Expand Down Expand Up @@ -452,27 +440,27 @@ constructor(
}

fun asString(): String = _value().asStringOrThrow()
}

class Endpoint
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Endpoint && value == other.value /* spotless:on */
return /* spotless:off */ other is CompletionWindow && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

class Endpoint
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

companion object {

Expand Down Expand Up @@ -515,6 +503,18 @@ constructor(
}

fun asString(): String = _value().asStringOrThrow()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Endpoint && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

/** Optional custom metadata for the batch. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,6 @@ private constructor(

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val STOP = of("stop")
Expand Down Expand Up @@ -495,6 +483,18 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is FinishReason && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

/** Log probability information for the choice. */
Expand Down Expand Up @@ -644,18 +644,6 @@ private constructor(

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Object && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val CHAT_COMPLETION = of("chat.completion")
Expand Down Expand Up @@ -685,27 +673,27 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()
}

class ServiceTier
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */
return /* spotless:off */ other is Object && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

class ServiceTier
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

companion object {

Expand Down Expand Up @@ -742,6 +730,18 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ServiceTier && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

override fun equals(other: Any?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,6 @@ private constructor(

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Role && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val ASSISTANT = of("assistant")
Expand Down Expand Up @@ -322,6 +310,18 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Role && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,6 @@ private constructor(

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Format && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val WAV = of("wav")
Expand Down Expand Up @@ -213,27 +201,27 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()
}

class Voice
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Voice && value == other.value /* spotless:on */
return /* spotless:off */ other is Format && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

class Voice
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

companion object {

Expand Down Expand Up @@ -306,6 +294,18 @@ private constructor(
}

fun asString(): String = _value().asStringOrThrow()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is Voice && value == other.value /* spotless:on */
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()
}

override fun equals(other: Any?): Boolean {
Expand Down
Loading

0 comments on commit 7a9d27a

Please sign in to comment.