Skip to content

style(internal): reduce verbosity of identity methods #10

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

Merged
merged 1 commit into from
Nov 20, 2024
Merged
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 @@ -24,12 +24,10 @@ private constructor(
return true
}

return /* spotless:off */ other is OpenAIError && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is OpenAIError && additionalProperties == other.additionalProperties /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */

override fun toString() = "OpenAIError{additionalProperties=$additionalProperties}"

Expand Down
30 changes: 12 additions & 18 deletions openai-java-core/src/main/kotlin/com/openai/models/Batch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private constructor(
return true
}

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

override fun hashCode() = value.hashCode()
Expand Down Expand Up @@ -522,7 +522,7 @@ private constructor(
return true
}

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

override fun hashCode() = value.hashCode()
Expand Down Expand Up @@ -696,17 +696,14 @@ private constructor(
return true
}

return /* spotless:off */ other is Errors && this.object_ == other.object_ && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Errors && object_ == other.object_ && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(object_, data, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(object_, data, additionalProperties) /* spotless:on */
}
return hashCode
}
override fun hashCode(): Int = hashCode

override fun toString() =
"Errors{object_=$object_, data=$data, additionalProperties=$additionalProperties}"
Expand All @@ -717,17 +714,14 @@ private constructor(
return true
}

return /* spotless:off */ other is Batch && this.id == other.id && this.object_ == other.object_ && this.endpoint == other.endpoint && this.errors == other.errors && this.inputFileId == other.inputFileId && this.completionWindow == other.completionWindow && this.status == other.status && this.outputFileId == other.outputFileId && this.errorFileId == other.errorFileId && this.createdAt == other.createdAt && this.inProgressAt == other.inProgressAt && this.expiresAt == other.expiresAt && this.finalizingAt == other.finalizingAt && this.completedAt == other.completedAt && this.failedAt == other.failedAt && this.expiredAt == other.expiredAt && this.cancellingAt == other.cancellingAt && this.cancelledAt == other.cancelledAt && this.requestCounts == other.requestCounts && this.metadata == other.metadata && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Batch && id == other.id && object_ == other.object_ && endpoint == other.endpoint && errors == other.errors && inputFileId == other.inputFileId && completionWindow == other.completionWindow && status == other.status && outputFileId == other.outputFileId && errorFileId == other.errorFileId && createdAt == other.createdAt && inProgressAt == other.inProgressAt && expiresAt == other.expiresAt && finalizingAt == other.finalizingAt && completedAt == other.completedAt && failedAt == other.failedAt && expiredAt == other.expiredAt && cancellingAt == other.cancellingAt && cancelledAt == other.cancelledAt && requestCounts == other.requestCounts && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(id, object_, endpoint, errors, inputFileId, completionWindow, status, outputFileId, errorFileId, createdAt, inProgressAt, expiresAt, finalizingAt, completedAt, failedAt, expiredAt, cancellingAt, cancelledAt, requestCounts, metadata, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(id, object_, endpoint, errors, inputFileId, completionWindow, status, outputFileId, errorFileId, createdAt, inProgressAt, expiresAt, finalizingAt, completedAt, failedAt, expiredAt, cancellingAt, cancelledAt, requestCounts, metadata, additionalProperties) /* spotless:on */
}
return hashCode
}
override fun hashCode(): Int = hashCode

override fun toString() =
"Batch{id=$id, object_=$object_, endpoint=$endpoint, errors=$errors, inputFileId=$inputFileId, completionWindow=$completionWindow, status=$status, outputFileId=$outputFileId, errorFileId=$errorFileId, createdAt=$createdAt, inProgressAt=$inProgressAt, expiresAt=$expiresAt, finalizingAt=$finalizingAt, completedAt=$completedAt, failedAt=$failedAt, expiredAt=$expiredAt, cancellingAt=$cancellingAt, cancelledAt=$cancelledAt, requestCounts=$requestCounts, metadata=$metadata, additionalProperties=$additionalProperties}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ constructor(
return true
}

return /* spotless:off */ other is BatchCancelParams && this.batchId == other.batchId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
return /* spotless:off */ other is BatchCancelParams && batchId == other.batchId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */

override fun toString() =
"BatchCancelParams{batchId=$batchId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,14 @@ constructor(
return true
}

return /* spotless:off */ other is BatchCreateBody && this.completionWindow == other.completionWindow && this.endpoint == other.endpoint && this.inputFileId == other.inputFileId && this.metadata == other.metadata && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is BatchCreateBody && completionWindow == other.completionWindow && endpoint == other.endpoint && inputFileId == other.inputFileId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalProperties) /* spotless:on */
}
return hashCode
}
override fun hashCode(): Int = hashCode

override fun toString() =
"BatchCreateBody{completionWindow=$completionWindow, endpoint=$endpoint, inputFileId=$inputFileId, metadata=$metadata, additionalProperties=$additionalProperties}"
Expand All @@ -218,12 +215,10 @@ constructor(
return true
}

return /* spotless:off */ other is BatchCreateParams && this.completionWindow == other.completionWindow && this.endpoint == other.endpoint && this.inputFileId == other.inputFileId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
return /* spotless:off */ other is BatchCreateParams && completionWindow == other.completionWindow && endpoint == other.endpoint && inputFileId == other.inputFileId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */

override fun toString() =
"BatchCreateParams{completionWindow=$completionWindow, endpoint=$endpoint, inputFileId=$inputFileId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
Expand Down Expand Up @@ -434,7 +429,7 @@ constructor(
return true
}

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

override fun hashCode() = value.hashCode()
Expand Down Expand Up @@ -485,7 +480,7 @@ constructor(
return true
}

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

override fun hashCode() = value.hashCode()
Expand Down Expand Up @@ -585,17 +580,14 @@ constructor(
return true
}

return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
/* spotless:on */

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */
}
return hashCode
}
override fun hashCode(): Int = hashCode

override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,14 @@ private constructor(
return true
}

return /* spotless:off */ other is BatchError && this.code == other.code && this.message == other.message && this.param == other.param && this.line == other.line && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is BatchError && code == other.code && message == other.message && param == other.param && line == other.line && additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(code, message, param, line, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(code, message, param, line, additionalProperties) /* spotless:on */
}
return hashCode
}
override fun hashCode(): Int = hashCode

override fun toString() =
"BatchError{code=$code, message=$message, param=$param, line=$line, additionalProperties=$additionalProperties}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ private constructor(
return true
}

return /* spotless:off */ other is BatchListPage && this.batchesService == other.batchesService && this.params == other.params && this.response == other.response /* spotless:on */
return /* spotless:off */ other is BatchListPage && batchesService == other.batchesService && params == other.params && response == other.response /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */

override fun toString() =
"BatchListPage{batchesService=$batchesService, params=$params, response=$response}"
Expand Down Expand Up @@ -106,15 +104,12 @@ private constructor(
return true
}

return /* spotless:off */ other is Response && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Response && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */

override fun toString() =
"BatchListPage.Response{data=$data, additionalProperties=$additionalProperties}"
override fun toString() = "Response{data=$data, additionalProperties=$additionalProperties}"

companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ private constructor(
return true
}

return /* spotless:off */ other is BatchListPageAsync && this.batchesService == other.batchesService && this.params == other.params && this.response == other.response /* spotless:on */
return /* spotless:off */ other is BatchListPageAsync && batchesService == other.batchesService && params == other.params && response == other.response /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */

override fun toString() =
"BatchListPageAsync{batchesService=$batchesService, params=$params, response=$response}"
Expand Down Expand Up @@ -109,15 +107,12 @@ private constructor(
return true
}

return /* spotless:off */ other is Response && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is Response && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */

override fun toString() =
"BatchListPageAsync.Response{data=$data, additionalProperties=$additionalProperties}"
override fun toString() = "Response{data=$data, additionalProperties=$additionalProperties}"

companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ constructor(
return true
}

return /* spotless:off */ other is BatchListParams && this.after == other.after && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */
return /* spotless:off */ other is BatchListParams && after == other.after && limit == other.limit && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(after, limit, additionalHeaders, additionalQueryParams) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(after, limit, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"BatchListParams{after=$after, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,14 @@ private constructor(
return true
}

return /* spotless:off */ other is BatchRequestCounts && this.total == other.total && this.completed == other.completed && this.failed == other.failed && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is BatchRequestCounts && total == other.total && completed == other.completed && failed == other.failed && additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(total, completed, failed, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(total, completed, failed, additionalProperties) /* spotless:on */
}
return hashCode
}
override fun hashCode(): Int = hashCode

override fun toString() =
"BatchRequestCounts{total=$total, completed=$completed, failed=$failed, additionalProperties=$additionalProperties}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ constructor(
return true
}

return /* spotless:off */ other is BatchRetrieveParams && this.batchId == other.batchId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */
return /* spotless:off */ other is BatchRetrieveParams && batchId == other.batchId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams) /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"BatchRetrieveParams{batchId=$batchId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
Expand Down
Loading