Skip to content
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
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 123
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik/x-twitter-scraper-323137ebb1ee9824cd9cfb63a325c0839deb81f17244e42e8154d6567e7af954.yml
openapi_spec_hash: 48da9c2747c1e7c474dd514d39c28c49
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik/x-twitter-scraper-5f26f3694399b4ac5a4431c66f7d27c4024f9d0dcd899702de5fde1150e28330.yml
openapi_spec_hash: 362e24e622f9a74ded8b38018e50460c
config_hash: dab26921eb273c16e5570c0485c9ac2c
Original file line number Diff line number Diff line change
Expand Up @@ -359,30 +359,20 @@ private constructor(
class AiGenerated
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val canEdit: JsonField<Boolean>,
private val detectionSource: JsonField<String>,
private val hasAiGeneratedMedia: JsonField<Boolean>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("canEdit") @ExcludeMissing canEdit: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("detectionSource")
@ExcludeMissing
detectionSource: JsonField<String> = JsonMissing.of(),
@JsonProperty("hasAiGeneratedMedia")
@ExcludeMissing
hasAiGeneratedMedia: JsonField<Boolean> = JsonMissing.of(),
) : this(canEdit, detectionSource, hasAiGeneratedMedia, mutableMapOf())

/**
* Whether the disclosure can be edited on X.
*
* @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type
* (e.g. if the server responded with an unexpected value).
*/
fun canEdit(): Optional<Boolean> = canEdit.getOptional("canEdit")
) : this(detectionSource, hasAiGeneratedMedia, mutableMapOf())

/**
* Source of the AI-generated media disclosure.
Expand All @@ -401,13 +391,6 @@ private constructor(
fun hasAiGeneratedMedia(): Optional<Boolean> =
hasAiGeneratedMedia.getOptional("hasAiGeneratedMedia")

/**
* Returns the raw JSON value of [canEdit].
*
* Unlike [canEdit], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("canEdit") @ExcludeMissing fun _canEdit(): JsonField<Boolean> = canEdit

/**
* Returns the raw JSON value of [detectionSource].
*
Expand Down Expand Up @@ -449,31 +432,17 @@ private constructor(
/** A builder for [AiGenerated]. */
class Builder internal constructor() {

private var canEdit: JsonField<Boolean> = JsonMissing.of()
private var detectionSource: JsonField<String> = JsonMissing.of()
private var hasAiGeneratedMedia: JsonField<Boolean> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(aiGenerated: AiGenerated) = apply {
canEdit = aiGenerated.canEdit
detectionSource = aiGenerated.detectionSource
hasAiGeneratedMedia = aiGenerated.hasAiGeneratedMedia
additionalProperties = aiGenerated.additionalProperties.toMutableMap()
}

/** Whether the disclosure can be edited on X. */
fun canEdit(canEdit: Boolean) = canEdit(JsonField.of(canEdit))

/**
* Sets [Builder.canEdit] to an arbitrary JSON value.
*
* You should usually call [Builder.canEdit] with a well-typed [Boolean] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun canEdit(canEdit: JsonField<Boolean>) = apply { this.canEdit = canEdit }

/** Source of the AI-generated media disclosure. */
fun detectionSource(detectionSource: String) =
detectionSource(JsonField.of(detectionSource))
Expand Down Expand Up @@ -530,7 +499,6 @@ private constructor(
*/
fun build(): AiGenerated =
AiGenerated(
canEdit,
detectionSource,
hasAiGeneratedMedia,
additionalProperties.toMutableMap(),
Expand All @@ -553,7 +521,6 @@ private constructor(
return@apply
}

canEdit()
detectionSource()
hasAiGeneratedMedia()
validated = true
Expand All @@ -575,8 +542,7 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(if (canEdit.asKnown().isPresent) 1 else 0) +
(if (detectionSource.asKnown().isPresent) 1 else 0) +
(if (detectionSource.asKnown().isPresent) 1 else 0) +
(if (hasAiGeneratedMedia.asKnown().isPresent) 1 else 0)

override fun equals(other: Any?): Boolean {
Expand All @@ -585,20 +551,19 @@ private constructor(
}

return other is AiGenerated &&
canEdit == other.canEdit &&
detectionSource == other.detectionSource &&
hasAiGeneratedMedia == other.hasAiGeneratedMedia &&
additionalProperties == other.additionalProperties
}

private val hashCode: Int by lazy {
Objects.hash(canEdit, detectionSource, hasAiGeneratedMedia, additionalProperties)
Objects.hash(detectionSource, hasAiGeneratedMedia, additionalProperties)
}

override fun hashCode(): Int = hashCode

override fun toString() =
"AiGenerated{canEdit=$canEdit, detectionSource=$detectionSource, hasAiGeneratedMedia=$hasAiGeneratedMedia, additionalProperties=$additionalProperties}"
"AiGenerated{detectionSource=$detectionSource, hasAiGeneratedMedia=$hasAiGeneratedMedia, additionalProperties=$additionalProperties}"
}

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