Skip to content

Commit

Permalink
feat(api): manual updates (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 7, 2025
1 parent 1b91568 commit bfab160
Show file tree
Hide file tree
Showing 23 changed files with 2,654 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 38
configured_endpoints: 40
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-cf610d4dbb7e3d84161b5783a0861b2e551422eb5cf727dde86a839325d7ef76.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// File generated from our OpenAPI spec by Stainless.

package com.tryfinch.api.models

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.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.immutableEmptyMap
import com.tryfinch.api.core.toImmutable
import java.util.Objects

@NoAutoDetect
class DocumentListResponse
@JsonCreator
private constructor(
@JsonProperty("documents")
@ExcludeMissing
private val documents: JsonField<List<DocumentResponse>> = JsonMissing.of(),
@JsonProperty("paging")
@ExcludeMissing
private val paging: JsonField<Paging> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun documents(): List<DocumentResponse> = documents.getRequired("documents")

fun paging(): Paging = paging.getRequired("paging")

@JsonProperty("documents") @ExcludeMissing fun _documents() = documents

@JsonProperty("paging") @ExcludeMissing fun _paging() = paging

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

private var validated: Boolean = false

fun validate(): DocumentListResponse = apply {
if (!validated) {
documents().forEach { it.validate() }
paging().validate()
validated = true
}
}

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

companion object {

@JvmStatic fun builder() = Builder()
}

class Builder {

private var documents: JsonField<List<DocumentResponse>> = JsonMissing.of()
private var paging: JsonField<Paging> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(documentListResponse: DocumentListResponse) = apply {
documents = documentListResponse.documents
paging = documentListResponse.paging
additionalProperties = documentListResponse.additionalProperties.toMutableMap()
}

fun documents(documents: List<DocumentResponse>) = documents(JsonField.of(documents))

fun documents(documents: JsonField<List<DocumentResponse>>) = apply {
this.documents = documents
}

fun paging(paging: Paging) = paging(JsonField.of(paging))

fun paging(paging: JsonField<Paging>) = apply { this.paging = paging }

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

fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}

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

fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }

fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}

fun build(): DocumentListResponse =
DocumentListResponse(
documents.map { it.toImmutable() },
paging,
additionalProperties.toImmutable(),
)
}

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

return /* spotless:off */ other is DocumentListResponse && documents == other.documents && paging == other.paging && additionalProperties == other.additionalProperties /* spotless:on */
}

/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(documents, paging, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int = hashCode

override fun toString() =
"DocumentListResponse{documents=$documents, paging=$paging, additionalProperties=$additionalProperties}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
// File generated from our OpenAPI spec by Stainless.

package com.tryfinch.api.models

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.tryfinch.api.core.Enum
import com.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.immutableEmptyMap
import com.tryfinch.api.core.toImmutable
import com.tryfinch.api.errors.FinchInvalidDataException
import java.util.Objects
import java.util.Optional

@NoAutoDetect
class DocumentResponse
@JsonCreator
private constructor(
@JsonProperty("id") @ExcludeMissing private val id: JsonField<String> = JsonMissing.of(),
@JsonProperty("individual_id")
@ExcludeMissing
private val individualId: JsonField<String> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing private val type: JsonField<Type> = JsonMissing.of(),
@JsonProperty("url") @ExcludeMissing private val url: JsonField<String> = JsonMissing.of(),
@JsonProperty("year") @ExcludeMissing private val year: JsonField<Double> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

/** A stable Finch id for the document. */
fun id(): Optional<String> = Optional.ofNullable(id.getNullable("id"))

/**
* The ID of the individual associated with the document. This will be null for employer-level
* documents.
*/
fun individualId(): Optional<String> =
Optional.ofNullable(individualId.getNullable("individual_id"))

/** The type of document. */
fun type(): Optional<Type> = Optional.ofNullable(type.getNullable("type"))

/**
* A URL to access the document. Format:
* `https://api.tryfinch.com/employer/documents/:document_id`.
*/
fun url(): Optional<String> = Optional.ofNullable(url.getNullable("url"))

/** The year the document applies to, if available. */
fun year(): Optional<Double> = Optional.ofNullable(year.getNullable("year"))

/** A stable Finch id for the document. */
@JsonProperty("id") @ExcludeMissing fun _id() = id

/**
* The ID of the individual associated with the document. This will be null for employer-level
* documents.
*/
@JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId

/** The type of document. */
@JsonProperty("type") @ExcludeMissing fun _type() = type

/**
* A URL to access the document. Format:
* `https://api.tryfinch.com/employer/documents/:document_id`.
*/
@JsonProperty("url") @ExcludeMissing fun _url() = url

/** The year the document applies to, if available. */
@JsonProperty("year") @ExcludeMissing fun _year() = year

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

private var validated: Boolean = false

fun validate(): DocumentResponse = apply {
if (!validated) {
id()
individualId()
type()
url()
year()
validated = true
}
}

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

companion object {

@JvmStatic fun builder() = Builder()
}

class Builder {

private var id: JsonField<String> = JsonMissing.of()
private var individualId: JsonField<String> = JsonMissing.of()
private var type: JsonField<Type> = JsonMissing.of()
private var url: JsonField<String> = JsonMissing.of()
private var year: JsonField<Double> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(documentResponse: DocumentResponse) = apply {
id = documentResponse.id
individualId = documentResponse.individualId
type = documentResponse.type
url = documentResponse.url
year = documentResponse.year
additionalProperties = documentResponse.additionalProperties.toMutableMap()
}

/** A stable Finch id for the document. */
fun id(id: String) = id(JsonField.of(id))

/** A stable Finch id for the document. */
fun id(id: JsonField<String>) = apply { this.id = id }

/**
* The ID of the individual associated with the document. This will be null for
* employer-level documents.
*/
fun individualId(individualId: String) = individualId(JsonField.of(individualId))

/**
* The ID of the individual associated with the document. This will be null for
* employer-level documents.
*/
fun individualId(individualId: JsonField<String>) = apply {
this.individualId = individualId
}

/** The type of document. */
fun type(type: Type) = type(JsonField.of(type))

/** The type of document. */
fun type(type: JsonField<Type>) = apply { this.type = type }

/**
* A URL to access the document. Format:
* `https://api.tryfinch.com/employer/documents/:document_id`.
*/
fun url(url: String) = url(JsonField.of(url))

/**
* A URL to access the document. Format:
* `https://api.tryfinch.com/employer/documents/:document_id`.
*/
fun url(url: JsonField<String>) = apply { this.url = url }

/** The year the document applies to, if available. */
fun year(year: Double) = year(JsonField.of(year))

/** The year the document applies to, if available. */
fun year(year: JsonField<Double>) = apply { this.year = year }

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

fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}

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

fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }

fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}

fun build(): DocumentResponse =
DocumentResponse(
id,
individualId,
type,
url,
year,
additionalProperties.toImmutable(),
)
}

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

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

companion object {

@JvmField val W4_2020 = of("w4_2020")

@JvmField val W4_2005 = of("w4_2005")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}

enum class Known {
W4_2020,
W4_2005,
}

enum class Value {
W4_2020,
W4_2005,
_UNKNOWN,
}

fun value(): Value =
when (this) {
W4_2020 -> Value.W4_2020
W4_2005 -> Value.W4_2005
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
W4_2020 -> Known.W4_2020
W4_2005 -> Known.W4_2005
else -> throw FinchInvalidDataException("Unknown Type: $value")
}

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

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

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

override fun hashCode() = value.hashCode()

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

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

return /* spotless:off */ other is DocumentResponse && id == other.id && individualId == other.individualId && type == other.type && url == other.url && year == other.year && additionalProperties == other.additionalProperties /* spotless:on */
}

/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(id, individualId, type, url, year, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int = hashCode

override fun toString() =
"DocumentResponse{id=$id, individualId=$individualId, type=$type, url=$url, year=$year, additionalProperties=$additionalProperties}"
}
Loading

0 comments on commit bfab160

Please sign in to comment.