diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 78058d763..727bf2d62 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.386.0" + ".": "0.387.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index bc6173cca..4bf821dee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 231 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-2304a782c25d2a6b9586de2f6e2b536b5abbf62735f9c18ed0551607f134b714.yml -openapi_spec_hash: 67d6de7181215abe88dcc3da557a1e0d -config_hash: 5a0bf28bf735edf93f36c6c808711847 +configured_endpoints: 227 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-60f9bca532c8805735c227730bbb14858faa64bfd5f83a1a78640f0119a3f99c.yml +openapi_spec_hash: 17ddd87efe6c029f2fa660c8781ccfaf +config_hash: ca52ca9a2968f330339fd50c1a386e05 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d675761d..471f0830e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.387.0 (2025-12-18) + +Full Changelog: [v0.386.0...v0.387.0](https://github.com/Increase/increase-java/compare/v0.386.0...v0.387.0) + +### Features + +* **api:** api update ([010a893](https://github.com/Increase/increase-java/commit/010a89332ca59f6c123c8d1d95c86c470e0aa15b)) + ## 0.386.0 (2025-12-18) Full Changelog: [v0.385.0...v0.386.0](https://github.com/Increase/increase-java/compare/v0.385.0...v0.386.0) diff --git a/README.md b/README.md index 0edb3dd46..340662753 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.386.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.386.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.386.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.387.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.387.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.387.0) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.386.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.387.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.386.0") +implementation("com.increase.api:increase-java:0.387.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.386.0") com.increase.api increase-java - 0.386.0 + 0.387.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index f01f4d5c2..2aae0c2a7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.386.0" // x-release-please-version + version = "0.387.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt index dc57ab706..e3f11a5cb 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt @@ -24,7 +24,6 @@ import com.increase.api.services.blocking.CheckTransferService import com.increase.api.services.blocking.DeclinedTransactionService import com.increase.api.services.blocking.DigitalCardProfileService import com.increase.api.services.blocking.DigitalWalletTokenService -import com.increase.api.services.blocking.DocumentService import com.increase.api.services.blocking.EntityService import com.increase.api.services.blocking.EventService import com.increase.api.services.blocking.EventSubscriptionService @@ -175,8 +174,6 @@ interface IncreaseClient { fun fileLinks(): FileLinkService - fun documents(): DocumentService - fun exports(): ExportService fun events(): EventService @@ -315,8 +312,6 @@ interface IncreaseClient { fun fileLinks(): FileLinkService.WithRawResponse - fun documents(): DocumentService.WithRawResponse - fun exports(): ExportService.WithRawResponse fun events(): EventService.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt index be4579776..5f2257a8f 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt @@ -24,7 +24,6 @@ import com.increase.api.services.async.CheckTransferServiceAsync import com.increase.api.services.async.DeclinedTransactionServiceAsync import com.increase.api.services.async.DigitalCardProfileServiceAsync import com.increase.api.services.async.DigitalWalletTokenServiceAsync -import com.increase.api.services.async.DocumentServiceAsync import com.increase.api.services.async.EntityServiceAsync import com.increase.api.services.async.EventServiceAsync import com.increase.api.services.async.EventSubscriptionServiceAsync @@ -175,8 +174,6 @@ interface IncreaseClientAsync { fun fileLinks(): FileLinkServiceAsync - fun documents(): DocumentServiceAsync - fun exports(): ExportServiceAsync fun events(): EventServiceAsync @@ -319,8 +316,6 @@ interface IncreaseClientAsync { fun fileLinks(): FileLinkServiceAsync.WithRawResponse - fun documents(): DocumentServiceAsync.WithRawResponse - fun exports(): ExportServiceAsync.WithRawResponse fun events(): EventServiceAsync.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt index ddb03d381..ffd99e1dd 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt @@ -46,8 +46,6 @@ import com.increase.api.services.async.DigitalCardProfileServiceAsync import com.increase.api.services.async.DigitalCardProfileServiceAsyncImpl import com.increase.api.services.async.DigitalWalletTokenServiceAsync import com.increase.api.services.async.DigitalWalletTokenServiceAsyncImpl -import com.increase.api.services.async.DocumentServiceAsync -import com.increase.api.services.async.DocumentServiceAsyncImpl import com.increase.api.services.async.EntityServiceAsync import com.increase.api.services.async.EntityServiceAsyncImpl import com.increase.api.services.async.EventServiceAsync @@ -288,10 +286,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa FileLinkServiceAsyncImpl(clientOptionsWithUserAgent) } - private val documents: DocumentServiceAsync by lazy { - DocumentServiceAsyncImpl(clientOptionsWithUserAgent) - } - private val exports: ExportServiceAsync by lazy { ExportServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -454,8 +448,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa override fun fileLinks(): FileLinkServiceAsync = fileLinks - override fun documents(): DocumentServiceAsync = documents - override fun exports(): ExportServiceAsync = exports override fun events(): EventServiceAsync = events @@ -658,10 +650,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa FileLinkServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val documents: DocumentServiceAsync.WithRawResponse by lazy { - DocumentServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val exports: ExportServiceAsync.WithRawResponse by lazy { ExportServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -839,8 +827,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa override fun fileLinks(): FileLinkServiceAsync.WithRawResponse = fileLinks - override fun documents(): DocumentServiceAsync.WithRawResponse = documents - override fun exports(): ExportServiceAsync.WithRawResponse = exports override fun events(): EventServiceAsync.WithRawResponse = events diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt index 021a9434d..411587c38 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt @@ -46,8 +46,6 @@ import com.increase.api.services.blocking.DigitalCardProfileService import com.increase.api.services.blocking.DigitalCardProfileServiceImpl import com.increase.api.services.blocking.DigitalWalletTokenService import com.increase.api.services.blocking.DigitalWalletTokenServiceImpl -import com.increase.api.services.blocking.DocumentService -import com.increase.api.services.blocking.DocumentServiceImpl import com.increase.api.services.blocking.EntityService import com.increase.api.services.blocking.EntityServiceImpl import com.increase.api.services.blocking.EventService @@ -279,10 +277,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli FileLinkServiceImpl(clientOptionsWithUserAgent) } - private val documents: DocumentService by lazy { - DocumentServiceImpl(clientOptionsWithUserAgent) - } - private val exports: ExportService by lazy { ExportServiceImpl(clientOptionsWithUserAgent) } private val events: EventService by lazy { EventServiceImpl(clientOptionsWithUserAgent) } @@ -437,8 +431,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli override fun fileLinks(): FileLinkService = fileLinks - override fun documents(): DocumentService = documents - override fun exports(): ExportService = exports override fun events(): EventService = events @@ -638,10 +630,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli FileLinkServiceImpl.WithRawResponseImpl(clientOptions) } - private val documents: DocumentService.WithRawResponse by lazy { - DocumentServiceImpl.WithRawResponseImpl(clientOptions) - } - private val exports: ExportService.WithRawResponse by lazy { ExportServiceImpl.WithRawResponseImpl(clientOptions) } @@ -816,8 +804,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli override fun fileLinks(): FileLinkService.WithRawResponse = fileLinks - override fun documents(): DocumentService.WithRawResponse = documents - override fun exports(): ExportService.WithRawResponse = exports override fun events(): EventService.WithRawResponse = events diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/Document.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/Document.kt deleted file mode 100644 index f1b1df6d4..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/Document.kt +++ /dev/null @@ -1,1215 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -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.increase.api.core.Enum -import com.increase.api.core.ExcludeMissing -import com.increase.api.core.JsonField -import com.increase.api.core.JsonMissing -import com.increase.api.core.JsonValue -import com.increase.api.core.checkRequired -import com.increase.api.errors.IncreaseInvalidDataException -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Increase generates certain documents / forms automatically for your application; they can be - * listed here. - */ -class Document -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val accountVerificationLetter: JsonField, - private val category: JsonField, - private val createdAt: JsonField, - private val entityId: JsonField, - private val fileId: JsonField, - private val fundingInstructions: JsonField, - private val idempotencyKey: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("account_verification_letter") - @ExcludeMissing - accountVerificationLetter: JsonField = JsonMissing.of(), - @JsonProperty("category") @ExcludeMissing category: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("entity_id") @ExcludeMissing entityId: JsonField = JsonMissing.of(), - @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), - @JsonProperty("funding_instructions") - @ExcludeMissing - fundingInstructions: JsonField = JsonMissing.of(), - @JsonProperty("idempotency_key") - @ExcludeMissing - idempotencyKey: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this( - id, - accountVerificationLetter, - category, - createdAt, - entityId, - fileId, - fundingInstructions, - idempotencyKey, - type, - mutableMapOf(), - ) - - /** - * The Document identifier. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * Properties of an account verification letter document. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun accountVerificationLetter(): Optional = - accountVerificationLetter.getOptional("account_verification_letter") - - /** - * The type of document. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun category(): Category = category.getRequired("category") - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Document was - * created. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * The identifier of the Entity the document was generated for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun entityId(): Optional = entityId.getOptional("entity_id") - - /** - * The identifier of the File containing the Document's contents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileId(): String = fileId.getRequired("file_id") - - /** - * Properties of a funding instructions document. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun fundingInstructions(): Optional = - fundingInstructions.getOptional("funding_instructions") - - /** - * The idempotency key you chose for this object. This value is unique across Increase and is - * used to ensure that a request is only processed once. Learn more about - * [idempotency](https://increase.com/documentation/idempotency-keys). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun idempotencyKey(): Optional = idempotencyKey.getOptional("idempotency_key") - - /** - * A constant representing the object's type. For this resource it will always be `document`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [accountVerificationLetter]. - * - * Unlike [accountVerificationLetter], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("account_verification_letter") - @ExcludeMissing - fun _accountVerificationLetter(): JsonField = - accountVerificationLetter - - /** - * Returns the raw JSON value of [category]. - * - * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [entityId]. - * - * Unlike [entityId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entity_id") @ExcludeMissing fun _entityId(): JsonField = entityId - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId - - /** - * Returns the raw JSON value of [fundingInstructions]. - * - * Unlike [fundingInstructions], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("funding_instructions") - @ExcludeMissing - fun _fundingInstructions(): JsonField = fundingInstructions - - /** - * Returns the raw JSON value of [idempotencyKey]. - * - * Unlike [idempotencyKey], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("idempotency_key") - @ExcludeMissing - fun _idempotencyKey(): JsonField = idempotencyKey - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Document]. - * - * The following fields are required: - * ```java - * .id() - * .accountVerificationLetter() - * .category() - * .createdAt() - * .entityId() - * .fileId() - * .fundingInstructions() - * .idempotencyKey() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Document]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var accountVerificationLetter: JsonField? = null - private var category: JsonField? = null - private var createdAt: JsonField? = null - private var entityId: JsonField? = null - private var fileId: JsonField? = null - private var fundingInstructions: JsonField? = null - private var idempotencyKey: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(document: Document) = apply { - id = document.id - accountVerificationLetter = document.accountVerificationLetter - category = document.category - createdAt = document.createdAt - entityId = document.entityId - fileId = document.fileId - fundingInstructions = document.fundingInstructions - idempotencyKey = document.idempotencyKey - type = document.type - additionalProperties = document.additionalProperties.toMutableMap() - } - - /** The Document identifier. */ - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** Properties of an account verification letter document. */ - fun accountVerificationLetter(accountVerificationLetter: AccountVerificationLetter?) = - accountVerificationLetter(JsonField.ofNullable(accountVerificationLetter)) - - /** - * Alias for calling [Builder.accountVerificationLetter] with - * `accountVerificationLetter.orElse(null)`. - */ - fun accountVerificationLetter( - accountVerificationLetter: Optional - ) = accountVerificationLetter(accountVerificationLetter.getOrNull()) - - /** - * Sets [Builder.accountVerificationLetter] to an arbitrary JSON value. - * - * You should usually call [Builder.accountVerificationLetter] with a well-typed - * [AccountVerificationLetter] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun accountVerificationLetter( - accountVerificationLetter: JsonField - ) = apply { this.accountVerificationLetter = accountVerificationLetter } - - /** The type of document. */ - fun category(category: Category) = category(JsonField.of(category)) - - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed [Category] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun category(category: JsonField) = apply { this.category = category } - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Document was - * created. - */ - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** The identifier of the Entity the document was generated for. */ - fun entityId(entityId: String?) = entityId(JsonField.ofNullable(entityId)) - - /** Alias for calling [Builder.entityId] with `entityId.orElse(null)`. */ - fun entityId(entityId: Optional) = entityId(entityId.getOrNull()) - - /** - * Sets [Builder.entityId] to an arbitrary JSON value. - * - * You should usually call [Builder.entityId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun entityId(entityId: JsonField) = apply { this.entityId = entityId } - - /** The identifier of the File containing the Document's contents. */ - fun fileId(fileId: String) = fileId(JsonField.of(fileId)) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - /** Properties of a funding instructions document. */ - fun fundingInstructions(fundingInstructions: FundingInstructions?) = - fundingInstructions(JsonField.ofNullable(fundingInstructions)) - - /** - * Alias for calling [Builder.fundingInstructions] with `fundingInstructions.orElse(null)`. - */ - fun fundingInstructions(fundingInstructions: Optional) = - fundingInstructions(fundingInstructions.getOrNull()) - - /** - * Sets [Builder.fundingInstructions] to an arbitrary JSON value. - * - * You should usually call [Builder.fundingInstructions] with a well-typed - * [FundingInstructions] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun fundingInstructions(fundingInstructions: JsonField) = apply { - this.fundingInstructions = fundingInstructions - } - - /** - * The idempotency key you chose for this object. This value is unique across Increase and - * is used to ensure that a request is only processed once. Learn more about - * [idempotency](https://increase.com/documentation/idempotency-keys). - */ - fun idempotencyKey(idempotencyKey: String?) = - idempotencyKey(JsonField.ofNullable(idempotencyKey)) - - /** Alias for calling [Builder.idempotencyKey] with `idempotencyKey.orElse(null)`. */ - fun idempotencyKey(idempotencyKey: Optional) = - idempotencyKey(idempotencyKey.getOrNull()) - - /** - * Sets [Builder.idempotencyKey] to an arbitrary JSON value. - * - * You should usually call [Builder.idempotencyKey] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun idempotencyKey(idempotencyKey: JsonField) = apply { - this.idempotencyKey = idempotencyKey - } - - /** - * A constant representing the object's type. For this resource it will always be - * `document`. - */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Document]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .accountVerificationLetter() - * .category() - * .createdAt() - * .entityId() - * .fileId() - * .fundingInstructions() - * .idempotencyKey() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Document = - Document( - checkRequired("id", id), - checkRequired("accountVerificationLetter", accountVerificationLetter), - checkRequired("category", category), - checkRequired("createdAt", createdAt), - checkRequired("entityId", entityId), - checkRequired("fileId", fileId), - checkRequired("fundingInstructions", fundingInstructions), - checkRequired("idempotencyKey", idempotencyKey), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Document = apply { - if (validated) { - return@apply - } - - id() - accountVerificationLetter().ifPresent { it.validate() } - category().validate() - createdAt() - entityId() - fileId() - fundingInstructions().ifPresent { it.validate() } - idempotencyKey() - type().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (accountVerificationLetter.asKnown().getOrNull()?.validity() ?: 0) + - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (entityId.asKnown().isPresent) 1 else 0) + - (if (fileId.asKnown().isPresent) 1 else 0) + - (fundingInstructions.asKnown().getOrNull()?.validity() ?: 0) + - (if (idempotencyKey.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** Properties of an account verification letter document. */ - class AccountVerificationLetter - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountNumberId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_number_id") - @ExcludeMissing - accountNumberId: JsonField = JsonMissing.of() - ) : this(accountNumberId, mutableMapOf()) - - /** - * The identifier of the Account Number the document was generated for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountNumberId(): String = accountNumberId.getRequired("account_number_id") - - /** - * Returns the raw JSON value of [accountNumberId]. - * - * Unlike [accountNumberId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_number_id") - @ExcludeMissing - fun _accountNumberId(): JsonField = accountNumberId - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [AccountVerificationLetter]. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AccountVerificationLetter]. */ - class Builder internal constructor() { - - private var accountNumberId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(accountVerificationLetter: AccountVerificationLetter) = apply { - accountNumberId = accountVerificationLetter.accountNumberId - additionalProperties = accountVerificationLetter.additionalProperties.toMutableMap() - } - - /** The identifier of the Account Number the document was generated for. */ - fun accountNumberId(accountNumberId: String) = - accountNumberId(JsonField.of(accountNumberId)) - - /** - * Sets [Builder.accountNumberId] to an arbitrary JSON value. - * - * You should usually call [Builder.accountNumberId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountNumberId(accountNumberId: JsonField) = apply { - this.accountNumberId = accountNumberId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [AccountVerificationLetter]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AccountVerificationLetter = - AccountVerificationLetter( - checkRequired("accountNumberId", accountNumberId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AccountVerificationLetter = apply { - if (validated) { - return@apply - } - - accountNumberId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (if (accountNumberId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AccountVerificationLetter && - accountNumberId == other.accountNumberId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(accountNumberId, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AccountVerificationLetter{accountNumberId=$accountNumberId, additionalProperties=$additionalProperties}" - } - - /** The type of document. */ - class Category @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** Internal Revenue Service Form 1099-INT. */ - @JvmField val FORM_1099_INT = of("form_1099_int") - - /** Internal Revenue Service Form 1099-MISC. */ - @JvmField val FORM_1099_MISC = of("form_1099_misc") - - /** - * A document submitted in response to a proof of authorization request for an ACH - * transfer. - */ - @JvmField val PROOF_OF_AUTHORIZATION = of("proof_of_authorization") - - /** - * Company information, such a policies or procedures, typically submitted during our - * due diligence process. - */ - @JvmField val COMPANY_INFORMATION = of("company_information") - - /** An account verification letter. */ - @JvmField val ACCOUNT_VERIFICATION_LETTER = of("account_verification_letter") - - /** Funding instructions. */ - @JvmField val FUNDING_INSTRUCTIONS = of("funding_instructions") - - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } - - /** An enum containing [Category]'s known values. */ - enum class Known { - /** Internal Revenue Service Form 1099-INT. */ - FORM_1099_INT, - /** Internal Revenue Service Form 1099-MISC. */ - FORM_1099_MISC, - /** - * A document submitted in response to a proof of authorization request for an ACH - * transfer. - */ - PROOF_OF_AUTHORIZATION, - /** - * Company information, such a policies or procedures, typically submitted during our - * due diligence process. - */ - COMPANY_INFORMATION, - /** An account verification letter. */ - ACCOUNT_VERIFICATION_LETTER, - /** Funding instructions. */ - FUNDING_INSTRUCTIONS, - } - - /** - * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Category] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Internal Revenue Service Form 1099-INT. */ - FORM_1099_INT, - /** Internal Revenue Service Form 1099-MISC. */ - FORM_1099_MISC, - /** - * A document submitted in response to a proof of authorization request for an ACH - * transfer. - */ - PROOF_OF_AUTHORIZATION, - /** - * Company information, such a policies or procedures, typically submitted during our - * due diligence process. - */ - COMPANY_INFORMATION, - /** An account verification letter. */ - ACCOUNT_VERIFICATION_LETTER, - /** Funding instructions. */ - FUNDING_INSTRUCTIONS, - /** An enum member indicating that [Category] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FORM_1099_INT -> Value.FORM_1099_INT - FORM_1099_MISC -> Value.FORM_1099_MISC - PROOF_OF_AUTHORIZATION -> Value.PROOF_OF_AUTHORIZATION - COMPANY_INFORMATION -> Value.COMPANY_INFORMATION - ACCOUNT_VERIFICATION_LETTER -> Value.ACCOUNT_VERIFICATION_LETTER - FUNDING_INSTRUCTIONS -> Value.FUNDING_INSTRUCTIONS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - FORM_1099_INT -> Known.FORM_1099_INT - FORM_1099_MISC -> Known.FORM_1099_MISC - PROOF_OF_AUTHORIZATION -> Known.PROOF_OF_AUTHORIZATION - COMPANY_INFORMATION -> Known.COMPANY_INFORMATION - ACCOUNT_VERIFICATION_LETTER -> Known.ACCOUNT_VERIFICATION_LETTER - FUNDING_INSTRUCTIONS -> Known.FUNDING_INSTRUCTIONS - else -> throw IncreaseInvalidDataException("Unknown Category: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Category = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Category && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Properties of a funding instructions document. */ - class FundingInstructions - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountNumberId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_number_id") - @ExcludeMissing - accountNumberId: JsonField = JsonMissing.of() - ) : this(accountNumberId, mutableMapOf()) - - /** - * The identifier of the Account Number the document was generated for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountNumberId(): String = accountNumberId.getRequired("account_number_id") - - /** - * Returns the raw JSON value of [accountNumberId]. - * - * Unlike [accountNumberId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_number_id") - @ExcludeMissing - fun _accountNumberId(): JsonField = accountNumberId - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [FundingInstructions]. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FundingInstructions]. */ - class Builder internal constructor() { - - private var accountNumberId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(fundingInstructions: FundingInstructions) = apply { - accountNumberId = fundingInstructions.accountNumberId - additionalProperties = fundingInstructions.additionalProperties.toMutableMap() - } - - /** The identifier of the Account Number the document was generated for. */ - fun accountNumberId(accountNumberId: String) = - accountNumberId(JsonField.of(accountNumberId)) - - /** - * Sets [Builder.accountNumberId] to an arbitrary JSON value. - * - * You should usually call [Builder.accountNumberId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountNumberId(accountNumberId: JsonField) = apply { - this.accountNumberId = accountNumberId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [FundingInstructions]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): FundingInstructions = - FundingInstructions( - checkRequired("accountNumberId", accountNumberId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FundingInstructions = apply { - if (validated) { - return@apply - } - - accountNumberId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (if (accountNumberId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is FundingInstructions && - accountNumberId == other.accountNumberId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(accountNumberId, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FundingInstructions{accountNumberId=$accountNumberId, additionalProperties=$additionalProperties}" - } - - /** - * A constant representing the object's type. For this resource it will always be `document`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DOCUMENT = of("document") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - DOCUMENT - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DOCUMENT, - /** An enum member indicating that [Type] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DOCUMENT -> Value.DOCUMENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DOCUMENT -> Known.DOCUMENT - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Document && - id == other.id && - accountVerificationLetter == other.accountVerificationLetter && - category == other.category && - createdAt == other.createdAt && - entityId == other.entityId && - fileId == other.fileId && - fundingInstructions == other.fundingInstructions && - idempotencyKey == other.idempotencyKey && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - accountVerificationLetter, - category, - createdAt, - entityId, - fileId, - fundingInstructions, - idempotencyKey, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Document{id=$id, accountVerificationLetter=$accountVerificationLetter, category=$category, createdAt=$createdAt, entityId=$entityId, fileId=$fileId, fundingInstructions=$fundingInstructions, idempotencyKey=$idempotencyKey, type=$type, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentCreateParams.kt deleted file mode 100644 index fe31568fe..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentCreateParams.kt +++ /dev/null @@ -1,1123 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -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.increase.api.core.Enum -import com.increase.api.core.ExcludeMissing -import com.increase.api.core.JsonField -import com.increase.api.core.JsonMissing -import com.increase.api.core.JsonValue -import com.increase.api.core.Params -import com.increase.api.core.checkRequired -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import com.increase.api.errors.IncreaseInvalidDataException -import java.time.LocalDate -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Create a Document */ -class DocumentCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * The type of document to create. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun category(): Category = body.category() - - /** - * An account verification letter. Required if and only if `category` is - * `account_verification_letter`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun accountVerificationLetter(): Optional = - body.accountVerificationLetter() - - /** - * Funding instructions. Required if and only if `category` is `funding_instructions`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun fundingInstructions(): Optional = body.fundingInstructions() - - /** - * Returns the raw JSON value of [category]. - * - * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _category(): JsonField = body._category() - - /** - * Returns the raw JSON value of [accountVerificationLetter]. - * - * Unlike [accountVerificationLetter], this method doesn't throw if the JSON field has an - * unexpected type. - */ - fun _accountVerificationLetter(): JsonField = - body._accountVerificationLetter() - - /** - * Returns the raw JSON value of [fundingInstructions]. - * - * Unlike [fundingInstructions], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _fundingInstructions(): JsonField = body._fundingInstructions() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [DocumentCreateParams]. - * - * The following fields are required: - * ```java - * .category() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentCreateParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(documentCreateParams: DocumentCreateParams) = apply { - body = documentCreateParams.body.toBuilder() - additionalHeaders = documentCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = documentCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [category] - * - [accountVerificationLetter] - * - [fundingInstructions] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The type of document to create. */ - fun category(category: Category) = apply { body.category(category) } - - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed [Category] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun category(category: JsonField) = apply { body.category(category) } - - /** - * An account verification letter. Required if and only if `category` is - * `account_verification_letter`. - */ - fun accountVerificationLetter(accountVerificationLetter: AccountVerificationLetter) = - apply { - body.accountVerificationLetter(accountVerificationLetter) - } - - /** - * Sets [Builder.accountVerificationLetter] to an arbitrary JSON value. - * - * You should usually call [Builder.accountVerificationLetter] with a well-typed - * [AccountVerificationLetter] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun accountVerificationLetter( - accountVerificationLetter: JsonField - ) = apply { body.accountVerificationLetter(accountVerificationLetter) } - - /** Funding instructions. Required if and only if `category` is `funding_instructions`. */ - fun fundingInstructions(fundingInstructions: FundingInstructions) = apply { - body.fundingInstructions(fundingInstructions) - } - - /** - * Sets [Builder.fundingInstructions] to an arbitrary JSON value. - * - * You should usually call [Builder.fundingInstructions] with a well-typed - * [FundingInstructions] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun fundingInstructions(fundingInstructions: JsonField) = apply { - body.fundingInstructions(fundingInstructions) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [DocumentCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .category() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DocumentCreateParams = - DocumentCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val category: JsonField, - private val accountVerificationLetter: JsonField, - private val fundingInstructions: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("account_verification_letter") - @ExcludeMissing - accountVerificationLetter: JsonField = JsonMissing.of(), - @JsonProperty("funding_instructions") - @ExcludeMissing - fundingInstructions: JsonField = JsonMissing.of(), - ) : this(category, accountVerificationLetter, fundingInstructions, mutableMapOf()) - - /** - * The type of document to create. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun category(): Category = category.getRequired("category") - - /** - * An account verification letter. Required if and only if `category` is - * `account_verification_letter`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun accountVerificationLetter(): Optional = - accountVerificationLetter.getOptional("account_verification_letter") - - /** - * Funding instructions. Required if and only if `category` is `funding_instructions`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun fundingInstructions(): Optional = - fundingInstructions.getOptional("funding_instructions") - - /** - * Returns the raw JSON value of [category]. - * - * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category - - /** - * Returns the raw JSON value of [accountVerificationLetter]. - * - * Unlike [accountVerificationLetter], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("account_verification_letter") - @ExcludeMissing - fun _accountVerificationLetter(): JsonField = - accountVerificationLetter - - /** - * Returns the raw JSON value of [fundingInstructions]. - * - * Unlike [fundingInstructions], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("funding_instructions") - @ExcludeMissing - fun _fundingInstructions(): JsonField = fundingInstructions - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .category() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var category: JsonField? = null - private var accountVerificationLetter: JsonField = - JsonMissing.of() - private var fundingInstructions: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - category = body.category - accountVerificationLetter = body.accountVerificationLetter - fundingInstructions = body.fundingInstructions - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The type of document to create. */ - fun category(category: Category) = category(JsonField.of(category)) - - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed [Category] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun category(category: JsonField) = apply { this.category = category } - - /** - * An account verification letter. Required if and only if `category` is - * `account_verification_letter`. - */ - fun accountVerificationLetter(accountVerificationLetter: AccountVerificationLetter) = - accountVerificationLetter(JsonField.of(accountVerificationLetter)) - - /** - * Sets [Builder.accountVerificationLetter] to an arbitrary JSON value. - * - * You should usually call [Builder.accountVerificationLetter] with a well-typed - * [AccountVerificationLetter] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun accountVerificationLetter( - accountVerificationLetter: JsonField - ) = apply { this.accountVerificationLetter = accountVerificationLetter } - - /** - * Funding instructions. Required if and only if `category` is `funding_instructions`. - */ - fun fundingInstructions(fundingInstructions: FundingInstructions) = - fundingInstructions(JsonField.of(fundingInstructions)) - - /** - * Sets [Builder.fundingInstructions] to an arbitrary JSON value. - * - * You should usually call [Builder.fundingInstructions] with a well-typed - * [FundingInstructions] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun fundingInstructions(fundingInstructions: JsonField) = apply { - this.fundingInstructions = fundingInstructions - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .category() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("category", category), - accountVerificationLetter, - fundingInstructions, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - category().validate() - accountVerificationLetter().ifPresent { it.validate() } - fundingInstructions().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (accountVerificationLetter.asKnown().getOrNull()?.validity() ?: 0) + - (fundingInstructions.asKnown().getOrNull()?.validity() ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - category == other.category && - accountVerificationLetter == other.accountVerificationLetter && - fundingInstructions == other.fundingInstructions && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - category, - accountVerificationLetter, - fundingInstructions, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{category=$category, accountVerificationLetter=$accountVerificationLetter, fundingInstructions=$fundingInstructions, additionalProperties=$additionalProperties}" - } - - /** The type of document to create. */ - class Category @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** An account verification letter. */ - @JvmField val ACCOUNT_VERIFICATION_LETTER = of("account_verification_letter") - - /** Funding instructions. */ - @JvmField val FUNDING_INSTRUCTIONS = of("funding_instructions") - - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } - - /** An enum containing [Category]'s known values. */ - enum class Known { - /** An account verification letter. */ - ACCOUNT_VERIFICATION_LETTER, - /** Funding instructions. */ - FUNDING_INSTRUCTIONS, - } - - /** - * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Category] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** An account verification letter. */ - ACCOUNT_VERIFICATION_LETTER, - /** Funding instructions. */ - FUNDING_INSTRUCTIONS, - /** An enum member indicating that [Category] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNT_VERIFICATION_LETTER -> Value.ACCOUNT_VERIFICATION_LETTER - FUNDING_INSTRUCTIONS -> Value.FUNDING_INSTRUCTIONS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ACCOUNT_VERIFICATION_LETTER -> Known.ACCOUNT_VERIFICATION_LETTER - FUNDING_INSTRUCTIONS -> Known.FUNDING_INSTRUCTIONS - else -> throw IncreaseInvalidDataException("Unknown Category: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Category = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Category && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * An account verification letter. Required if and only if `category` is - * `account_verification_letter`. - */ - class AccountVerificationLetter - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountNumberId: JsonField, - private val balanceDate: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_number_id") - @ExcludeMissing - accountNumberId: JsonField = JsonMissing.of(), - @JsonProperty("balance_date") - @ExcludeMissing - balanceDate: JsonField = JsonMissing.of(), - ) : this(accountNumberId, balanceDate, mutableMapOf()) - - /** - * The Account Number the bank letter should be generated for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountNumberId(): String = accountNumberId.getRequired("account_number_id") - - /** - * If provided, the letter will include the Account's balance as of the date. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun balanceDate(): Optional = balanceDate.getOptional("balance_date") - - /** - * Returns the raw JSON value of [accountNumberId]. - * - * Unlike [accountNumberId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_number_id") - @ExcludeMissing - fun _accountNumberId(): JsonField = accountNumberId - - /** - * Returns the raw JSON value of [balanceDate]. - * - * Unlike [balanceDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("balance_date") - @ExcludeMissing - fun _balanceDate(): JsonField = balanceDate - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [AccountVerificationLetter]. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AccountVerificationLetter]. */ - class Builder internal constructor() { - - private var accountNumberId: JsonField? = null - private var balanceDate: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(accountVerificationLetter: AccountVerificationLetter) = apply { - accountNumberId = accountVerificationLetter.accountNumberId - balanceDate = accountVerificationLetter.balanceDate - additionalProperties = accountVerificationLetter.additionalProperties.toMutableMap() - } - - /** The Account Number the bank letter should be generated for. */ - fun accountNumberId(accountNumberId: String) = - accountNumberId(JsonField.of(accountNumberId)) - - /** - * Sets [Builder.accountNumberId] to an arbitrary JSON value. - * - * You should usually call [Builder.accountNumberId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountNumberId(accountNumberId: JsonField) = apply { - this.accountNumberId = accountNumberId - } - - /** If provided, the letter will include the Account's balance as of the date. */ - fun balanceDate(balanceDate: LocalDate) = balanceDate(JsonField.of(balanceDate)) - - /** - * Sets [Builder.balanceDate] to an arbitrary JSON value. - * - * You should usually call [Builder.balanceDate] with a well-typed [LocalDate] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun balanceDate(balanceDate: JsonField) = apply { - this.balanceDate = balanceDate - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [AccountVerificationLetter]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AccountVerificationLetter = - AccountVerificationLetter( - checkRequired("accountNumberId", accountNumberId), - balanceDate, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AccountVerificationLetter = apply { - if (validated) { - return@apply - } - - accountNumberId() - balanceDate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (accountNumberId.asKnown().isPresent) 1 else 0) + - (if (balanceDate.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AccountVerificationLetter && - accountNumberId == other.accountNumberId && - balanceDate == other.balanceDate && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(accountNumberId, balanceDate, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AccountVerificationLetter{accountNumberId=$accountNumberId, balanceDate=$balanceDate, additionalProperties=$additionalProperties}" - } - - /** Funding instructions. Required if and only if `category` is `funding_instructions`. */ - class FundingInstructions - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountNumberId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_number_id") - @ExcludeMissing - accountNumberId: JsonField = JsonMissing.of() - ) : this(accountNumberId, mutableMapOf()) - - /** - * The Account Number the funding instructions should be generated for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountNumberId(): String = accountNumberId.getRequired("account_number_id") - - /** - * Returns the raw JSON value of [accountNumberId]. - * - * Unlike [accountNumberId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_number_id") - @ExcludeMissing - fun _accountNumberId(): JsonField = accountNumberId - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [FundingInstructions]. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FundingInstructions]. */ - class Builder internal constructor() { - - private var accountNumberId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(fundingInstructions: FundingInstructions) = apply { - accountNumberId = fundingInstructions.accountNumberId - additionalProperties = fundingInstructions.additionalProperties.toMutableMap() - } - - /** The Account Number the funding instructions should be generated for. */ - fun accountNumberId(accountNumberId: String) = - accountNumberId(JsonField.of(accountNumberId)) - - /** - * Sets [Builder.accountNumberId] to an arbitrary JSON value. - * - * You should usually call [Builder.accountNumberId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountNumberId(accountNumberId: JsonField) = apply { - this.accountNumberId = accountNumberId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [FundingInstructions]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountNumberId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): FundingInstructions = - FundingInstructions( - checkRequired("accountNumberId", accountNumberId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FundingInstructions = apply { - if (validated) { - return@apply - } - - accountNumberId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (if (accountNumberId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is FundingInstructions && - accountNumberId == other.accountNumberId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(accountNumberId, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FundingInstructions{accountNumberId=$accountNumberId, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "DocumentCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPage.kt deleted file mode 100644 index 43fe262a0..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPage.kt +++ /dev/null @@ -1,132 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.increase.api.core.AutoPager -import com.increase.api.core.Page -import com.increase.api.core.checkRequired -import com.increase.api.services.blocking.DocumentService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see DocumentService.list */ -class DocumentListPage -private constructor( - private val service: DocumentService, - private val params: DocumentListParams, - private val response: DocumentListPageResponse, -) : Page { - - /** - * Delegates to [DocumentListPageResponse], but gracefully handles missing data. - * - * @see DocumentListPageResponse.data - */ - fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [DocumentListPageResponse], but gracefully handles missing data. - * - * @see DocumentListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): DocumentListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): DocumentListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): DocumentListParams = params - - /** The response that this page was parsed from. */ - fun response(): DocumentListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [DocumentListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentListPage]. */ - class Builder internal constructor() { - - private var service: DocumentService? = null - private var params: DocumentListParams? = null - private var response: DocumentListPageResponse? = null - - @JvmSynthetic - internal fun from(documentListPage: DocumentListPage) = apply { - service = documentListPage.service - params = documentListPage.params - response = documentListPage.response - } - - fun service(service: DocumentService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: DocumentListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: DocumentListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [DocumentListPage]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DocumentListPage = - DocumentListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = - "DocumentListPage{service=$service, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPageAsync.kt deleted file mode 100644 index 1f25b5f54..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPageAsync.kt +++ /dev/null @@ -1,146 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.increase.api.core.AutoPagerAsync -import com.increase.api.core.PageAsync -import com.increase.api.core.checkRequired -import com.increase.api.services.async.DocumentServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see DocumentServiceAsync.list */ -class DocumentListPageAsync -private constructor( - private val service: DocumentServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: DocumentListParams, - private val response: DocumentListPageResponse, -) : PageAsync { - - /** - * Delegates to [DocumentListPageResponse], but gracefully handles missing data. - * - * @see DocumentListPageResponse.data - */ - fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [DocumentListPageResponse], but gracefully handles missing data. - * - * @see DocumentListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): DocumentListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): CompletableFuture = - service.list(nextPageParams()) - - fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) - - /** The parameters that were used to request this page. */ - fun params(): DocumentListParams = params - - /** The response that this page was parsed from. */ - fun response(): DocumentListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [DocumentListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentListPageAsync]. */ - class Builder internal constructor() { - - private var service: DocumentServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: DocumentListParams? = null - private var response: DocumentListPageResponse? = null - - @JvmSynthetic - internal fun from(documentListPageAsync: DocumentListPageAsync) = apply { - service = documentListPageAsync.service - streamHandlerExecutor = documentListPageAsync.streamHandlerExecutor - params = documentListPageAsync.params - response = documentListPageAsync.response - } - - fun service(service: DocumentServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: DocumentListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: DocumentListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [DocumentListPageAsync]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DocumentListPageAsync = - DocumentListPageAsync( - checkRequired("service", service), - checkRequired("streamHandlerExecutor", streamHandlerExecutor), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentListPageAsync && - service == other.service && - streamHandlerExecutor == other.streamHandlerExecutor && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) - - override fun toString() = - "DocumentListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPageResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPageResponse.kt deleted file mode 100644 index 93f51e96a..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListPageResponse.kt +++ /dev/null @@ -1,237 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -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.increase.api.core.ExcludeMissing -import com.increase.api.core.JsonField -import com.increase.api.core.JsonMissing -import com.increase.api.core.JsonValue -import com.increase.api.core.checkKnown -import com.increase.api.core.checkRequired -import com.increase.api.core.toImmutable -import com.increase.api.errors.IncreaseInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** A list of Document objects. */ -class DocumentListPageResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val data: JsonField>, - private val nextCursor: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), - @JsonProperty("next_cursor") - @ExcludeMissing - nextCursor: JsonField = JsonMissing.of(), - ) : this(data, nextCursor, mutableMapOf()) - - /** - * The contents of the list. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun data(): List = data.getRequired("data") - - /** - * A pointer to a place in the list. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun nextCursor(): Optional = nextCursor.getOptional("next_cursor") - - /** - * Returns the raw JSON value of [data]. - * - * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data - - /** - * Returns the raw JSON value of [nextCursor]. - * - * Unlike [nextCursor], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("next_cursor") @ExcludeMissing fun _nextCursor(): JsonField = nextCursor - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [DocumentListPageResponse]. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentListPageResponse]. */ - class Builder internal constructor() { - - private var data: JsonField>? = null - private var nextCursor: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(documentListPageResponse: DocumentListPageResponse) = apply { - data = documentListPageResponse.data.map { it.toMutableList() } - nextCursor = documentListPageResponse.nextCursor - additionalProperties = documentListPageResponse.additionalProperties.toMutableMap() - } - - /** The contents of the list. */ - fun data(data: List) = data(JsonField.of(data)) - - /** - * Sets [Builder.data] to an arbitrary JSON value. - * - * You should usually call [Builder.data] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun data(data: JsonField>) = apply { - this.data = data.map { it.toMutableList() } - } - - /** - * Adds a single [Document] to [Builder.data]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addData(data: Document) = apply { - this.data = - (this.data ?: JsonField.of(mutableListOf())).also { - checkKnown("data", it).add(data) - } - } - - /** A pointer to a place in the list. */ - fun nextCursor(nextCursor: String?) = nextCursor(JsonField.ofNullable(nextCursor)) - - /** Alias for calling [Builder.nextCursor] with `nextCursor.orElse(null)`. */ - fun nextCursor(nextCursor: Optional) = nextCursor(nextCursor.getOrNull()) - - /** - * Sets [Builder.nextCursor] to an arbitrary JSON value. - * - * You should usually call [Builder.nextCursor] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun nextCursor(nextCursor: JsonField) = apply { this.nextCursor = nextCursor } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [DocumentListPageResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DocumentListPageResponse = - DocumentListPageResponse( - checkRequired("data", data).map { it.toImmutable() }, - checkRequired("nextCursor", nextCursor), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DocumentListPageResponse = apply { - if (validated) { - return@apply - } - - data().forEach { it.validate() } - nextCursor() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (nextCursor.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentListPageResponse && - data == other.data && - nextCursor == other.nextCursor && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(data, nextCursor, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DocumentListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListParams.kt deleted file mode 100644 index aea25a3f3..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentListParams.kt +++ /dev/null @@ -1,825 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.fasterxml.jackson.annotation.JsonCreator -import com.increase.api.core.Enum -import com.increase.api.core.JsonField -import com.increase.api.core.Params -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import com.increase.api.core.toImmutable -import com.increase.api.errors.IncreaseInvalidDataException -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** List Documents */ -class DocumentListParams -private constructor( - private val category: Category?, - private val createdAt: CreatedAt?, - private val cursor: String?, - private val entityId: String?, - private val idempotencyKey: String?, - private val limit: Long?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun category(): Optional = Optional.ofNullable(category) - - fun createdAt(): Optional = Optional.ofNullable(createdAt) - - /** Return the page of entries after this one. */ - fun cursor(): Optional = Optional.ofNullable(cursor) - - /** Filter Documents to ones belonging to the specified Entity. */ - fun entityId(): Optional = Optional.ofNullable(entityId) - - /** - * Filter records to the one with the specified `idempotency_key` you chose for that object. - * This value is unique across Increase and is used to ensure that a request is only processed - * once. Learn more about [idempotency](https://increase.com/documentation/idempotency-keys). - */ - fun idempotencyKey(): Optional = Optional.ofNullable(idempotencyKey) - - /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ - fun limit(): Optional = Optional.ofNullable(limit) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): DocumentListParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [DocumentListParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentListParams]. */ - class Builder internal constructor() { - - private var category: Category? = null - private var createdAt: CreatedAt? = null - private var cursor: String? = null - private var entityId: String? = null - private var idempotencyKey: String? = null - private var limit: Long? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(documentListParams: DocumentListParams) = apply { - category = documentListParams.category - createdAt = documentListParams.createdAt - cursor = documentListParams.cursor - entityId = documentListParams.entityId - idempotencyKey = documentListParams.idempotencyKey - limit = documentListParams.limit - additionalHeaders = documentListParams.additionalHeaders.toBuilder() - additionalQueryParams = documentListParams.additionalQueryParams.toBuilder() - } - - fun category(category: Category?) = apply { this.category = category } - - /** Alias for calling [Builder.category] with `category.orElse(null)`. */ - fun category(category: Optional) = category(category.getOrNull()) - - fun createdAt(createdAt: CreatedAt?) = apply { this.createdAt = createdAt } - - /** Alias for calling [Builder.createdAt] with `createdAt.orElse(null)`. */ - fun createdAt(createdAt: Optional) = createdAt(createdAt.getOrNull()) - - /** Return the page of entries after this one. */ - fun cursor(cursor: String?) = apply { this.cursor = cursor } - - /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ - fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) - - /** Filter Documents to ones belonging to the specified Entity. */ - fun entityId(entityId: String?) = apply { this.entityId = entityId } - - /** Alias for calling [Builder.entityId] with `entityId.orElse(null)`. */ - fun entityId(entityId: Optional) = entityId(entityId.getOrNull()) - - /** - * Filter records to the one with the specified `idempotency_key` you chose for that object. - * This value is unique across Increase and is used to ensure that a request is only - * processed once. Learn more about - * [idempotency](https://increase.com/documentation/idempotency-keys). - */ - fun idempotencyKey(idempotencyKey: String?) = apply { this.idempotencyKey = idempotencyKey } - - /** Alias for calling [Builder.idempotencyKey] with `idempotencyKey.orElse(null)`. */ - fun idempotencyKey(idempotencyKey: Optional) = - idempotencyKey(idempotencyKey.getOrNull()) - - /** - * Limit the size of the list that is returned. The default (and maximum) is 100 objects. - */ - fun limit(limit: Long?) = apply { this.limit = limit } - - /** - * Alias for [Builder.limit]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun limit(limit: Long) = limit(limit as Long?) - - /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ - fun limit(limit: Optional) = limit(limit.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [DocumentListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): DocumentListParams = - DocumentListParams( - category, - createdAt, - cursor, - entityId, - idempotencyKey, - limit, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - category?.let { - it.in_().ifPresent { - put("category.in", it.joinToString(",") { it.toString() }) - } - it._additionalProperties().keys().forEach { key -> - it._additionalProperties().values(key).forEach { value -> - put("category.$key", value) - } - } - } - createdAt?.let { - it.after().ifPresent { - put("created_at.after", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) - } - it.before().ifPresent { - put("created_at.before", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) - } - it.onOrAfter().ifPresent { - put( - "created_at.on_or_after", - DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), - ) - } - it.onOrBefore().ifPresent { - put( - "created_at.on_or_before", - DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), - ) - } - it._additionalProperties().keys().forEach { key -> - it._additionalProperties().values(key).forEach { value -> - put("created_at.$key", value) - } - } - } - cursor?.let { put("cursor", it) } - entityId?.let { put("entity_id", it) } - idempotencyKey?.let { put("idempotency_key", it) } - limit?.let { put("limit", it.toString()) } - putAll(additionalQueryParams) - } - .build() - - class Category - private constructor(private val in_: List?, private val additionalProperties: QueryParams) { - - /** - * Filter Documents for those with the specified category or categories. For GET requests, - * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. - */ - fun in_(): Optional> = Optional.ofNullable(in_) - - /** Query params to send with the request. */ - fun _additionalProperties(): QueryParams = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Category]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Category]. */ - class Builder internal constructor() { - - private var in_: MutableList? = null - private var additionalProperties: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(category: Category) = apply { - in_ = category.in_?.toMutableList() - additionalProperties = category.additionalProperties.toBuilder() - } - - /** - * Filter Documents for those with the specified category or categories. For GET - * requests, this should be encoded as a comma-delimited string, such as - * `?in=one,two,three`. - */ - fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } - - /** Alias for calling [Builder.in_] with `in_.orElse(null)`. */ - fun in_(in_: Optional>) = in_(in_.getOrNull()) - - /** - * Adds a single [In] to [Builder.in_]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIn(in_: In) = apply { - this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } - } - - fun additionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun additionalProperties(additionalProperties: Map>) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: String) = apply { - additionalProperties.put(key, value) - } - - fun putAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.put(key, values) - } - - fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun putAllAdditionalProperties(additionalProperties: Map>) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun replaceAdditionalProperties(key: String, value: String) = apply { - additionalProperties.replace(key, value) - } - - fun replaceAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.replace(key, values) - } - - fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.replaceAll(additionalProperties) - } - - fun replaceAllAdditionalProperties( - additionalProperties: Map> - ) = apply { this.additionalProperties.replaceAll(additionalProperties) } - - fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - additionalProperties.removeAll(keys) - } - - /** - * Returns an immutable instance of [Category]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Category = Category(in_?.toImmutable(), additionalProperties.build()) - } - - class In @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** Internal Revenue Service Form 1099-INT. */ - @JvmField val FORM_1099_INT = of("form_1099_int") - - /** Internal Revenue Service Form 1099-MISC. */ - @JvmField val FORM_1099_MISC = of("form_1099_misc") - - /** - * A document submitted in response to a proof of authorization request for an ACH - * transfer. - */ - @JvmField val PROOF_OF_AUTHORIZATION = of("proof_of_authorization") - - /** - * Company information, such a policies or procedures, typically submitted during - * our due diligence process. - */ - @JvmField val COMPANY_INFORMATION = of("company_information") - - /** An account verification letter. */ - @JvmField val ACCOUNT_VERIFICATION_LETTER = of("account_verification_letter") - - /** Funding instructions. */ - @JvmField val FUNDING_INSTRUCTIONS = of("funding_instructions") - - @JvmStatic fun of(value: String) = In(JsonField.of(value)) - } - - /** An enum containing [In]'s known values. */ - enum class Known { - /** Internal Revenue Service Form 1099-INT. */ - FORM_1099_INT, - /** Internal Revenue Service Form 1099-MISC. */ - FORM_1099_MISC, - /** - * A document submitted in response to a proof of authorization request for an ACH - * transfer. - */ - PROOF_OF_AUTHORIZATION, - /** - * Company information, such a policies or procedures, typically submitted during - * our due diligence process. - */ - COMPANY_INFORMATION, - /** An account verification letter. */ - ACCOUNT_VERIFICATION_LETTER, - /** Funding instructions. */ - FUNDING_INSTRUCTIONS, - } - - /** - * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [In] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Internal Revenue Service Form 1099-INT. */ - FORM_1099_INT, - /** Internal Revenue Service Form 1099-MISC. */ - FORM_1099_MISC, - /** - * A document submitted in response to a proof of authorization request for an ACH - * transfer. - */ - PROOF_OF_AUTHORIZATION, - /** - * Company information, such a policies or procedures, typically submitted during - * our due diligence process. - */ - COMPANY_INFORMATION, - /** An account verification letter. */ - ACCOUNT_VERIFICATION_LETTER, - /** Funding instructions. */ - FUNDING_INSTRUCTIONS, - /** An enum member indicating that [In] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FORM_1099_INT -> Value.FORM_1099_INT - FORM_1099_MISC -> Value.FORM_1099_MISC - PROOF_OF_AUTHORIZATION -> Value.PROOF_OF_AUTHORIZATION - COMPANY_INFORMATION -> Value.COMPANY_INFORMATION - ACCOUNT_VERIFICATION_LETTER -> Value.ACCOUNT_VERIFICATION_LETTER - FUNDING_INSTRUCTIONS -> Value.FUNDING_INSTRUCTIONS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - FORM_1099_INT -> Known.FORM_1099_INT - FORM_1099_MISC -> Known.FORM_1099_MISC - PROOF_OF_AUTHORIZATION -> Known.PROOF_OF_AUTHORIZATION - COMPANY_INFORMATION -> Known.COMPANY_INFORMATION - ACCOUNT_VERIFICATION_LETTER -> Known.ACCOUNT_VERIFICATION_LETTER - FUNDING_INSTRUCTIONS -> Known.FUNDING_INSTRUCTIONS - else -> throw IncreaseInvalidDataException("Unknown In: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): In = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is In && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Category && - in_ == other.in_ && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Category{in_=$in_, additionalProperties=$additionalProperties}" - } - - class CreatedAt - private constructor( - private val after: OffsetDateTime?, - private val before: OffsetDateTime?, - private val onOrAfter: OffsetDateTime?, - private val onOrBefore: OffsetDateTime?, - private val additionalProperties: QueryParams, - ) { - - /** - * Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. - */ - fun after(): Optional = Optional.ofNullable(after) - - /** - * Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. - */ - fun before(): Optional = Optional.ofNullable(before) - - /** - * Return results on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrAfter(): Optional = Optional.ofNullable(onOrAfter) - - /** - * Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrBefore(): Optional = Optional.ofNullable(onOrBefore) - - /** Query params to send with the request. */ - fun _additionalProperties(): QueryParams = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [CreatedAt]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CreatedAt]. */ - class Builder internal constructor() { - - private var after: OffsetDateTime? = null - private var before: OffsetDateTime? = null - private var onOrAfter: OffsetDateTime? = null - private var onOrBefore: OffsetDateTime? = null - private var additionalProperties: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(createdAt: CreatedAt) = apply { - after = createdAt.after - before = createdAt.before - onOrAfter = createdAt.onOrAfter - onOrBefore = createdAt.onOrBefore - additionalProperties = createdAt.additionalProperties.toBuilder() - } - - /** - * Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun after(after: OffsetDateTime?) = apply { this.after = after } - - /** Alias for calling [Builder.after] with `after.orElse(null)`. */ - fun after(after: Optional) = after(after.getOrNull()) - - /** - * Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun before(before: OffsetDateTime?) = apply { this.before = before } - - /** Alias for calling [Builder.before] with `before.orElse(null)`. */ - fun before(before: Optional) = before(before.getOrNull()) - - /** - * Return results on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrAfter(onOrAfter: OffsetDateTime?) = apply { this.onOrAfter = onOrAfter } - - /** Alias for calling [Builder.onOrAfter] with `onOrAfter.orElse(null)`. */ - fun onOrAfter(onOrAfter: Optional) = onOrAfter(onOrAfter.getOrNull()) - - /** - * Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrBefore(onOrBefore: OffsetDateTime?) = apply { this.onOrBefore = onOrBefore } - - /** Alias for calling [Builder.onOrBefore] with `onOrBefore.orElse(null)`. */ - fun onOrBefore(onOrBefore: Optional) = - onOrBefore(onOrBefore.getOrNull()) - - fun additionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun additionalProperties(additionalProperties: Map>) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: String) = apply { - additionalProperties.put(key, value) - } - - fun putAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.put(key, values) - } - - fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun putAllAdditionalProperties(additionalProperties: Map>) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun replaceAdditionalProperties(key: String, value: String) = apply { - additionalProperties.replace(key, value) - } - - fun replaceAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.replace(key, values) - } - - fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.replaceAll(additionalProperties) - } - - fun replaceAllAdditionalProperties( - additionalProperties: Map> - ) = apply { this.additionalProperties.replaceAll(additionalProperties) } - - fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - additionalProperties.removeAll(keys) - } - - /** - * Returns an immutable instance of [CreatedAt]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CreatedAt = - CreatedAt(after, before, onOrAfter, onOrBefore, additionalProperties.build()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreatedAt && - after == other.after && - before == other.before && - onOrAfter == other.onOrAfter && - onOrBefore == other.onOrBefore && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(after, before, onOrAfter, onOrBefore, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentListParams && - category == other.category && - createdAt == other.createdAt && - cursor == other.cursor && - entityId == other.entityId && - idempotencyKey == other.idempotencyKey && - limit == other.limit && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - category, - createdAt, - cursor, - entityId, - idempotencyKey, - limit, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "DocumentListParams{category=$category, createdAt=$createdAt, cursor=$cursor, entityId=$entityId, idempotencyKey=$idempotencyKey, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentRetrieveParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentRetrieveParams.kt deleted file mode 100644 index 95f168ce4..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/documents/DocumentRetrieveParams.kt +++ /dev/null @@ -1,196 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.increase.api.core.Params -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Retrieve a Document */ -class DocumentRetrieveParams -private constructor( - private val documentId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier of the Document to retrieve. */ - fun documentId(): Optional = Optional.ofNullable(documentId) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): DocumentRetrieveParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [DocumentRetrieveParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentRetrieveParams]. */ - class Builder internal constructor() { - - private var documentId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(documentRetrieveParams: DocumentRetrieveParams) = apply { - documentId = documentRetrieveParams.documentId - additionalHeaders = documentRetrieveParams.additionalHeaders.toBuilder() - additionalQueryParams = documentRetrieveParams.additionalQueryParams.toBuilder() - } - - /** The identifier of the Document to retrieve. */ - fun documentId(documentId: String?) = apply { this.documentId = documentId } - - /** Alias for calling [Builder.documentId] with `documentId.orElse(null)`. */ - fun documentId(documentId: Optional) = documentId(documentId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [DocumentRetrieveParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): DocumentRetrieveParams = - DocumentRetrieveParams( - documentId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> documentId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentRetrieveParams && - documentId == other.documentId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(documentId, additionalHeaders, additionalQueryParams) - - override fun toString() = - "DocumentRetrieveParams{documentId=$documentId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/documents/DocumentCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/documents/DocumentCreateParams.kt deleted file mode 100644 index c0eba0158..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/documents/DocumentCreateParams.kt +++ /dev/null @@ -1,418 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.simulations.documents - -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.increase.api.core.ExcludeMissing -import com.increase.api.core.JsonField -import com.increase.api.core.JsonMissing -import com.increase.api.core.JsonValue -import com.increase.api.core.Params -import com.increase.api.core.checkRequired -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import com.increase.api.errors.IncreaseInvalidDataException -import java.util.Collections -import java.util.Objects - -/** Simulates an tax document being created for an account. */ -class DocumentCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * The identifier of the Account the tax document is for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountId(): String = body.accountId() - - /** - * Returns the raw JSON value of [accountId]. - * - * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _accountId(): JsonField = body._accountId() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [DocumentCreateParams]. - * - * The following fields are required: - * ```java - * .accountId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DocumentCreateParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(documentCreateParams: DocumentCreateParams) = apply { - body = documentCreateParams.body.toBuilder() - additionalHeaders = documentCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = documentCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [accountId] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The identifier of the Account the tax document is for. */ - fun accountId(accountId: String) = apply { body.accountId(accountId) } - - /** - * Sets [Builder.accountId] to an arbitrary JSON value. - * - * You should usually call [Builder.accountId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun accountId(accountId: JsonField) = apply { body.accountId(accountId) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [DocumentCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DocumentCreateParams = - DocumentCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_id") - @ExcludeMissing - accountId: JsonField = JsonMissing.of() - ) : this(accountId, mutableMapOf()) - - /** - * The identifier of the Account the tax document is for. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountId(): String = accountId.getRequired("account_id") - - /** - * Returns the raw JSON value of [accountId]. - * - * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .accountId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var accountId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - accountId = body.accountId - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The identifier of the Account the tax document is for. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) - - /** - * Sets [Builder.accountId] to an arbitrary JSON value. - * - * You should usually call [Builder.accountId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body(checkRequired("accountId", accountId), additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - accountId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = (if (accountId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - accountId == other.accountId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(accountId, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{accountId=$accountId, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "DocumentCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/DocumentServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/DocumentServiceAsync.kt deleted file mode 100644 index 7937b5154..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/DocumentServiceAsync.kt +++ /dev/null @@ -1,181 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.documents.Document -import com.increase.api.models.documents.DocumentCreateParams -import com.increase.api.models.documents.DocumentListPageAsync -import com.increase.api.models.documents.DocumentListParams -import com.increase.api.models.documents.DocumentRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface DocumentServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): DocumentServiceAsync - - /** Create a Document */ - fun create(params: DocumentCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** Retrieve a Document */ - fun retrieve(documentId: String): CompletableFuture = - retrieve(documentId, DocumentRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - ): CompletableFuture = retrieve(documentId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see retrieve */ - fun retrieve(params: DocumentRetrieveParams): CompletableFuture = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(documentId: String, requestOptions: RequestOptions): CompletableFuture = - retrieve(documentId, DocumentRetrieveParams.none(), requestOptions) - - /** List Documents */ - fun list(): CompletableFuture = list(DocumentListParams.none()) - - /** @see list */ - fun list( - params: DocumentListParams = DocumentListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: DocumentListParams = DocumentListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(DocumentListParams.none(), requestOptions) - - /** - * A view of [DocumentServiceAsync] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): DocumentServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /documents`, but is otherwise the same as - * [DocumentServiceAsync.create]. - */ - fun create(params: DocumentCreateParams): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /documents/{document_id}`, but is otherwise the same - * as [DocumentServiceAsync.retrieve]. - */ - fun retrieve(documentId: String): CompletableFuture> = - retrieve(documentId, DocumentRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - ): CompletableFuture> = - retrieve(documentId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see retrieve */ - fun retrieve(params: DocumentRetrieveParams): CompletableFuture> = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - documentId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - retrieve(documentId, DocumentRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /documents`, but is otherwise the same as - * [DocumentServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(DocumentListParams.none()) - - /** @see list */ - fun list( - params: DocumentListParams = DocumentListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: DocumentListParams = DocumentListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(DocumentListParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/DocumentServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/DocumentServiceAsyncImpl.kt deleted file mode 100644 index 52526bde0..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/DocumentServiceAsyncImpl.kt +++ /dev/null @@ -1,177 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.checkRequired -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepareAsync -import com.increase.api.models.documents.Document -import com.increase.api.models.documents.DocumentCreateParams -import com.increase.api.models.documents.DocumentListPageAsync -import com.increase.api.models.documents.DocumentListPageResponse -import com.increase.api.models.documents.DocumentListParams -import com.increase.api.models.documents.DocumentRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class DocumentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentServiceAsync { - - private val withRawResponse: DocumentServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): DocumentServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): DocumentServiceAsync = - DocumentServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /documents - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /documents/{document_id} - withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: DocumentListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /documents - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): DocumentServiceAsync.WithRawResponse = - DocumentServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("documents") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("documentId", params.documentId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("documents", params._pathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: DocumentListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("documents") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - DocumentListPageAsync.builder() - .service(DocumentServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt index a065803d2..016acdba8 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt @@ -19,7 +19,6 @@ import com.increase.api.services.async.simulations.CardTokenServiceAsync import com.increase.api.services.async.simulations.CheckDepositServiceAsync import com.increase.api.services.async.simulations.CheckTransferServiceAsync import com.increase.api.services.async.simulations.DigitalWalletTokenRequestServiceAsync -import com.increase.api.services.async.simulations.DocumentServiceAsync import com.increase.api.services.async.simulations.ExportServiceAsync import com.increase.api.services.async.simulations.InboundAchTransferServiceAsync import com.increase.api.services.async.simulations.InboundCheckDepositServiceAsync @@ -109,8 +108,6 @@ interface SimulationServiceAsync { fun accountStatements(): AccountStatementServiceAsync - fun documents(): DocumentServiceAsync - fun exports(): ExportServiceAsync fun cardTokens(): CardTokenServiceAsync @@ -189,8 +186,6 @@ interface SimulationServiceAsync { fun accountStatements(): AccountStatementServiceAsync.WithRawResponse - fun documents(): DocumentServiceAsync.WithRawResponse - fun exports(): ExportServiceAsync.WithRawResponse fun cardTokens(): CardTokenServiceAsync.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt index cf2ce443f..de0424b9a 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt @@ -35,8 +35,6 @@ import com.increase.api.services.async.simulations.CheckTransferServiceAsync import com.increase.api.services.async.simulations.CheckTransferServiceAsyncImpl import com.increase.api.services.async.simulations.DigitalWalletTokenRequestServiceAsync import com.increase.api.services.async.simulations.DigitalWalletTokenRequestServiceAsyncImpl -import com.increase.api.services.async.simulations.DocumentServiceAsync -import com.increase.api.services.async.simulations.DocumentServiceAsyncImpl import com.increase.api.services.async.simulations.ExportServiceAsync import com.increase.api.services.async.simulations.ExportServiceAsyncImpl import com.increase.api.services.async.simulations.InboundAchTransferServiceAsync @@ -191,8 +189,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: AccountStatementServiceAsyncImpl(clientOptions) } - private val documents: DocumentServiceAsync by lazy { DocumentServiceAsyncImpl(clientOptions) } - private val exports: ExportServiceAsync by lazy { ExportServiceAsyncImpl(clientOptions) } private val cardTokens: CardTokenServiceAsync by lazy { @@ -268,8 +264,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun accountStatements(): AccountStatementServiceAsync = accountStatements - override fun documents(): DocumentServiceAsync = documents - override fun exports(): ExportServiceAsync = exports override fun cardTokens(): CardTokenServiceAsync = cardTokens @@ -400,10 +394,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: AccountStatementServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val documents: DocumentServiceAsync.WithRawResponse by lazy { - DocumentServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val exports: ExportServiceAsync.WithRawResponse by lazy { ExportServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -496,8 +486,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun accountStatements(): AccountStatementServiceAsync.WithRawResponse = accountStatements - override fun documents(): DocumentServiceAsync.WithRawResponse = documents - override fun exports(): ExportServiceAsync.WithRawResponse = exports override fun cardTokens(): CardTokenServiceAsync.WithRawResponse = cardTokens diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsync.kt deleted file mode 100644 index a3a23deed..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsync.kt +++ /dev/null @@ -1,64 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async.simulations - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.documents.Document -import com.increase.api.models.simulations.documents.DocumentCreateParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface DocumentServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): DocumentServiceAsync - - /** Simulates an tax document being created for an account. */ - fun create(params: DocumentCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** - * A view of [DocumentServiceAsync] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): DocumentServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /simulations/documents`, but is otherwise the same - * as [DocumentServiceAsync.create]. - */ - fun create(params: DocumentCreateParams): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsyncImpl.kt deleted file mode 100644 index 947c853a1..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsyncImpl.kt +++ /dev/null @@ -1,86 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async.simulations - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepareAsync -import com.increase.api.models.documents.Document -import com.increase.api.models.simulations.documents.DocumentCreateParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -class DocumentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentServiceAsync { - - private val withRawResponse: DocumentServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): DocumentServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): DocumentServiceAsync = - DocumentServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /simulations/documents - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): DocumentServiceAsync.WithRawResponse = - DocumentServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("simulations", "documents") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/DocumentService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/DocumentService.kt deleted file mode 100644 index e605ab8a4..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/DocumentService.kt +++ /dev/null @@ -1,179 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking - -import com.google.errorprone.annotations.MustBeClosed -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.documents.Document -import com.increase.api.models.documents.DocumentCreateParams -import com.increase.api.models.documents.DocumentListPage -import com.increase.api.models.documents.DocumentListParams -import com.increase.api.models.documents.DocumentRetrieveParams -import java.util.function.Consumer - -interface DocumentService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): DocumentService - - /** Create a Document */ - fun create(params: DocumentCreateParams): Document = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Document - - /** Retrieve a Document */ - fun retrieve(documentId: String): Document = retrieve(documentId, DocumentRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): Document = retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - ): Document = retrieve(documentId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Document - - /** @see retrieve */ - fun retrieve(params: DocumentRetrieveParams): Document = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(documentId: String, requestOptions: RequestOptions): Document = - retrieve(documentId, DocumentRetrieveParams.none(), requestOptions) - - /** List Documents */ - fun list(): DocumentListPage = list(DocumentListParams.none()) - - /** @see list */ - fun list( - params: DocumentListParams = DocumentListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): DocumentListPage - - /** @see list */ - fun list(params: DocumentListParams = DocumentListParams.none()): DocumentListPage = - list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): DocumentListPage = - list(DocumentListParams.none(), requestOptions) - - /** A view of [DocumentService] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): DocumentService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /documents`, but is otherwise the same as - * [DocumentService.create]. - */ - @MustBeClosed - fun create(params: DocumentCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /documents/{document_id}`, but is otherwise the same - * as [DocumentService.retrieve]. - */ - @MustBeClosed - fun retrieve(documentId: String): HttpResponseFor = - retrieve(documentId, DocumentRetrieveParams.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - documentId: String, - params: DocumentRetrieveParams = DocumentRetrieveParams.none(), - ): HttpResponseFor = retrieve(documentId, params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see retrieve */ - @MustBeClosed - fun retrieve(params: DocumentRetrieveParams): HttpResponseFor = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - documentId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - retrieve(documentId, DocumentRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /documents`, but is otherwise the same as - * [DocumentService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = list(DocumentListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: DocumentListParams = DocumentListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: DocumentListParams = DocumentListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(DocumentListParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/DocumentServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/DocumentServiceImpl.kt deleted file mode 100644 index fb6b1e538..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/DocumentServiceImpl.kt +++ /dev/null @@ -1,163 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.checkRequired -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepare -import com.increase.api.models.documents.Document -import com.increase.api.models.documents.DocumentCreateParams -import com.increase.api.models.documents.DocumentListPage -import com.increase.api.models.documents.DocumentListPageResponse -import com.increase.api.models.documents.DocumentListParams -import com.increase.api.models.documents.DocumentRetrieveParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class DocumentServiceImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentService { - - private val withRawResponse: DocumentService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): DocumentService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): DocumentService = - DocumentServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create(params: DocumentCreateParams, requestOptions: RequestOptions): Document = - // post /documents - withRawResponse().create(params, requestOptions).parse() - - override fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions, - ): Document = - // get /documents/{document_id} - withRawResponse().retrieve(params, requestOptions).parse() - - override fun list( - params: DocumentListParams, - requestOptions: RequestOptions, - ): DocumentListPage = - // get /documents - withRawResponse().list(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): DocumentService.WithRawResponse = - DocumentServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("documents") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: DocumentRetrieveParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("documentId", params.documentId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("documents", params._pathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: DocumentListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("documents") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - DocumentListPage.builder() - .service(DocumentServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt index 2b6b3098d..718263730 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt @@ -19,7 +19,6 @@ import com.increase.api.services.blocking.simulations.CardTokenService import com.increase.api.services.blocking.simulations.CheckDepositService import com.increase.api.services.blocking.simulations.CheckTransferService import com.increase.api.services.blocking.simulations.DigitalWalletTokenRequestService -import com.increase.api.services.blocking.simulations.DocumentService import com.increase.api.services.blocking.simulations.ExportService import com.increase.api.services.blocking.simulations.InboundAchTransferService import com.increase.api.services.blocking.simulations.InboundCheckDepositService @@ -109,8 +108,6 @@ interface SimulationService { fun accountStatements(): AccountStatementService - fun documents(): DocumentService - fun exports(): ExportService fun cardTokens(): CardTokenService @@ -186,8 +183,6 @@ interface SimulationService { fun accountStatements(): AccountStatementService.WithRawResponse - fun documents(): DocumentService.WithRawResponse - fun exports(): ExportService.WithRawResponse fun cardTokens(): CardTokenService.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt index 9b47f23e7..027f9e4fe 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt @@ -35,8 +35,6 @@ import com.increase.api.services.blocking.simulations.CheckTransferService import com.increase.api.services.blocking.simulations.CheckTransferServiceImpl import com.increase.api.services.blocking.simulations.DigitalWalletTokenRequestService import com.increase.api.services.blocking.simulations.DigitalWalletTokenRequestServiceImpl -import com.increase.api.services.blocking.simulations.DocumentService -import com.increase.api.services.blocking.simulations.DocumentServiceImpl import com.increase.api.services.blocking.simulations.ExportService import com.increase.api.services.blocking.simulations.ExportServiceImpl import com.increase.api.services.blocking.simulations.InboundAchTransferService @@ -184,8 +182,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie AccountStatementServiceImpl(clientOptions) } - private val documents: DocumentService by lazy { DocumentServiceImpl(clientOptions) } - private val exports: ExportService by lazy { ExportServiceImpl(clientOptions) } private val cardTokens: CardTokenService by lazy { CardTokenServiceImpl(clientOptions) } @@ -258,8 +254,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun accountStatements(): AccountStatementService = accountStatements - override fun documents(): DocumentService = documents - override fun exports(): ExportService = exports override fun cardTokens(): CardTokenService = cardTokens @@ -388,10 +382,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie AccountStatementServiceImpl.WithRawResponseImpl(clientOptions) } - private val documents: DocumentService.WithRawResponse by lazy { - DocumentServiceImpl.WithRawResponseImpl(clientOptions) - } - private val exports: ExportService.WithRawResponse by lazy { ExportServiceImpl.WithRawResponseImpl(clientOptions) } @@ -481,8 +471,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun accountStatements(): AccountStatementService.WithRawResponse = accountStatements - override fun documents(): DocumentService.WithRawResponse = documents - override fun exports(): ExportService.WithRawResponse = exports override fun cardTokens(): CardTokenService.WithRawResponse = cardTokens diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/DocumentService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/DocumentService.kt deleted file mode 100644 index 09a21a473..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/DocumentService.kt +++ /dev/null @@ -1,61 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking.simulations - -import com.google.errorprone.annotations.MustBeClosed -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.documents.Document -import com.increase.api.models.simulations.documents.DocumentCreateParams -import java.util.function.Consumer - -interface DocumentService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): DocumentService - - /** Simulates an tax document being created for an account. */ - fun create(params: DocumentCreateParams): Document = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Document - - /** A view of [DocumentService] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): DocumentService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /simulations/documents`, but is otherwise the same - * as [DocumentService.create]. - */ - @MustBeClosed - fun create(params: DocumentCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/DocumentServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/DocumentServiceImpl.kt deleted file mode 100644 index f0843a991..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/DocumentServiceImpl.kt +++ /dev/null @@ -1,79 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking.simulations - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepare -import com.increase.api.models.documents.Document -import com.increase.api.models.simulations.documents.DocumentCreateParams -import java.util.function.Consumer - -class DocumentServiceImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentService { - - private val withRawResponse: DocumentService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): DocumentService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): DocumentService = - DocumentServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create(params: DocumentCreateParams, requestOptions: RequestOptions): Document = - // post /simulations/documents - withRawResponse().create(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - DocumentService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): DocumentService.WithRawResponse = - DocumentServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: DocumentCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("simulations", "documents") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentCreateParamsTest.kt deleted file mode 100644 index 9a5194c47..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentCreateParamsTest.kt +++ /dev/null @@ -1,78 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import java.time.LocalDate -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DocumentCreateParamsTest { - - @Test - fun create() { - DocumentCreateParams.builder() - .category(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - .accountVerificationLetter( - DocumentCreateParams.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .balanceDate(LocalDate.parse("2024-12-31")) - .build() - ) - .fundingInstructions( - DocumentCreateParams.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .build() - } - - @Test - fun body() { - val params = - DocumentCreateParams.builder() - .category(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - .accountVerificationLetter( - DocumentCreateParams.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .balanceDate(LocalDate.parse("2024-12-31")) - .build() - ) - .fundingInstructions( - DocumentCreateParams.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .build() - - val body = params._body() - - assertThat(body.category()) - .isEqualTo(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - assertThat(body.accountVerificationLetter()) - .contains( - DocumentCreateParams.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .balanceDate(LocalDate.parse("2024-12-31")) - .build() - ) - assertThat(body.fundingInstructions()) - .contains( - DocumentCreateParams.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - DocumentCreateParams.builder() - .category(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - .build() - - val body = params._body() - - assertThat(body.category()) - .isEqualTo(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentListPageResponseTest.kt deleted file mode 100644 index a70ea25e2..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentListPageResponseTest.kt +++ /dev/null @@ -1,103 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DocumentListPageResponseTest { - - @Test - fun create() { - val documentListPageResponse = - DocumentListPageResponse.builder() - .addData( - Document.builder() - .id("document_qjtqc6s4c14ve2q89izm") - .accountVerificationLetter( - Document.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .build() - ) - .category(Document.Category.ACCOUNT_VERIFICATION_LETTER) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entityId("entity_n8y8tnk2p9339ti393yi") - .fileId("file_makxrc67oh9l6sg7w9yc") - .fundingInstructions( - Document.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .idempotencyKey(null) - .type(Document.Type.DOCUMENT) - .build() - ) - .nextCursor("v57w5d") - .build() - - assertThat(documentListPageResponse.data()) - .containsExactly( - Document.builder() - .id("document_qjtqc6s4c14ve2q89izm") - .accountVerificationLetter( - Document.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .build() - ) - .category(Document.Category.ACCOUNT_VERIFICATION_LETTER) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entityId("entity_n8y8tnk2p9339ti393yi") - .fileId("file_makxrc67oh9l6sg7w9yc") - .fundingInstructions( - Document.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .idempotencyKey(null) - .type(Document.Type.DOCUMENT) - .build() - ) - assertThat(documentListPageResponse.nextCursor()).contains("v57w5d") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val documentListPageResponse = - DocumentListPageResponse.builder() - .addData( - Document.builder() - .id("document_qjtqc6s4c14ve2q89izm") - .accountVerificationLetter( - Document.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .build() - ) - .category(Document.Category.ACCOUNT_VERIFICATION_LETTER) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entityId("entity_n8y8tnk2p9339ti393yi") - .fileId("file_makxrc67oh9l6sg7w9yc") - .fundingInstructions( - Document.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .idempotencyKey(null) - .type(Document.Type.DOCUMENT) - .build() - ) - .nextCursor("v57w5d") - .build() - - val roundtrippedDocumentListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(documentListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDocumentListPageResponse).isEqualTo(documentListPageResponse) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentListParamsTest.kt deleted file mode 100644 index 13c5dd1a0..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentListParamsTest.kt +++ /dev/null @@ -1,84 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.increase.api.core.http.QueryParams -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DocumentListParamsTest { - - @Test - fun create() { - DocumentListParams.builder() - .category( - DocumentListParams.Category.builder() - .addIn(DocumentListParams.Category.In.FORM_1099_INT) - .build() - ) - .createdAt( - DocumentListParams.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .cursor("cursor") - .entityId("entity_id") - .idempotencyKey("x") - .limit(1L) - .build() - } - - @Test - fun queryParams() { - val params = - DocumentListParams.builder() - .category( - DocumentListParams.Category.builder() - .addIn(DocumentListParams.Category.In.FORM_1099_INT) - .build() - ) - .createdAt( - DocumentListParams.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .cursor("cursor") - .entityId("entity_id") - .idempotencyKey("x") - .limit(1L) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("category.in", listOf("form_1099_int").joinToString(",")) - .put("created_at.after", "2019-12-27T18:11:19.117Z") - .put("created_at.before", "2019-12-27T18:11:19.117Z") - .put("created_at.on_or_after", "2019-12-27T18:11:19.117Z") - .put("created_at.on_or_before", "2019-12-27T18:11:19.117Z") - .put("cursor", "cursor") - .put("entity_id", "entity_id") - .put("idempotency_key", "x") - .put("limit", "1") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = DocumentListParams.builder().build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentRetrieveParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentRetrieveParamsTest.kt deleted file mode 100644 index 501a7b9e8..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentRetrieveParamsTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DocumentRetrieveParamsTest { - - @Test - fun create() { - DocumentRetrieveParams.builder().documentId("document_qjtqc6s4c14ve2q89izm").build() - } - - @Test - fun pathParams() { - val params = - DocumentRetrieveParams.builder().documentId("document_qjtqc6s4c14ve2q89izm").build() - - assertThat(params._pathParam(0)).isEqualTo("document_qjtqc6s4c14ve2q89izm") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentTest.kt deleted file mode 100644 index 01e185f5a..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/documents/DocumentTest.kt +++ /dev/null @@ -1,87 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.documents - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DocumentTest { - - @Test - fun create() { - val document = - Document.builder() - .id("document_qjtqc6s4c14ve2q89izm") - .accountVerificationLetter( - Document.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .build() - ) - .category(Document.Category.ACCOUNT_VERIFICATION_LETTER) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entityId("entity_n8y8tnk2p9339ti393yi") - .fileId("file_makxrc67oh9l6sg7w9yc") - .fundingInstructions( - Document.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .idempotencyKey(null) - .type(Document.Type.DOCUMENT) - .build() - - assertThat(document.id()).isEqualTo("document_qjtqc6s4c14ve2q89izm") - assertThat(document.accountVerificationLetter()) - .contains( - Document.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .build() - ) - assertThat(document.category()).isEqualTo(Document.Category.ACCOUNT_VERIFICATION_LETTER) - assertThat(document.createdAt()).isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - assertThat(document.entityId()).contains("entity_n8y8tnk2p9339ti393yi") - assertThat(document.fileId()).isEqualTo("file_makxrc67oh9l6sg7w9yc") - assertThat(document.fundingInstructions()) - .contains( - Document.FundingInstructions.builder().accountNumberId("account_number_id").build() - ) - assertThat(document.idempotencyKey()).isEmpty - assertThat(document.type()).isEqualTo(Document.Type.DOCUMENT) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val document = - Document.builder() - .id("document_qjtqc6s4c14ve2q89izm") - .accountVerificationLetter( - Document.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .build() - ) - .category(Document.Category.ACCOUNT_VERIFICATION_LETTER) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entityId("entity_n8y8tnk2p9339ti393yi") - .fileId("file_makxrc67oh9l6sg7w9yc") - .fundingInstructions( - Document.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .idempotencyKey(null) - .type(Document.Type.DOCUMENT) - .build() - - val roundtrippedDocument = - jsonMapper.readValue( - jsonMapper.writeValueAsString(document), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDocument).isEqualTo(document) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/documents/DocumentCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/documents/DocumentCreateParamsTest.kt deleted file mode 100644 index 338b2a02c..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/documents/DocumentCreateParamsTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.simulations.documents - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DocumentCreateParamsTest { - - @Test - fun create() { - DocumentCreateParams.builder().accountId("account_in71c4amph0vgo2qllky").build() - } - - @Test - fun body() { - val params = - DocumentCreateParams.builder().accountId("account_in71c4amph0vgo2qllky").build() - - val body = params._body() - - assertThat(body.accountId()).isEqualTo("account_in71c4amph0vgo2qllky") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/DocumentServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/DocumentServiceAsyncTest.kt deleted file mode 100644 index fe7058967..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/DocumentServiceAsyncTest.kt +++ /dev/null @@ -1,75 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync -import com.increase.api.models.documents.DocumentCreateParams -import java.time.LocalDate -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class DocumentServiceAsyncTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentServiceAsync = client.documents() - - val documentFuture = - documentServiceAsync.create( - DocumentCreateParams.builder() - .category(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - .accountVerificationLetter( - DocumentCreateParams.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .balanceDate(LocalDate.parse("2024-12-31")) - .build() - ) - .fundingInstructions( - DocumentCreateParams.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .build() - ) - - val document = documentFuture.get() - document.validate() - } - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentServiceAsync = client.documents() - - val documentFuture = documentServiceAsync.retrieve("document_qjtqc6s4c14ve2q89izm") - - val document = documentFuture.get() - document.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentServiceAsync = client.documents() - - val pageFuture = documentServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsyncTest.kt deleted file mode 100644 index b62f20f89..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/DocumentServiceAsyncTest.kt +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async.simulations - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync -import com.increase.api.models.simulations.documents.DocumentCreateParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class DocumentServiceAsyncTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentServiceAsync = client.simulations().documents() - - val documentFuture = - documentServiceAsync.create( - DocumentCreateParams.builder().accountId("account_in71c4amph0vgo2qllky").build() - ) - - val document = documentFuture.get() - document.validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/DocumentServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/DocumentServiceTest.kt deleted file mode 100644 index e64bfb09d..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/DocumentServiceTest.kt +++ /dev/null @@ -1,72 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClient -import com.increase.api.models.documents.DocumentCreateParams -import java.time.LocalDate -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class DocumentServiceTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentService = client.documents() - - val document = - documentService.create( - DocumentCreateParams.builder() - .category(DocumentCreateParams.Category.ACCOUNT_VERIFICATION_LETTER) - .accountVerificationLetter( - DocumentCreateParams.AccountVerificationLetter.builder() - .accountNumberId("account_number_v18nkfqm6afpsrvy82b2") - .balanceDate(LocalDate.parse("2024-12-31")) - .build() - ) - .fundingInstructions( - DocumentCreateParams.FundingInstructions.builder() - .accountNumberId("account_number_id") - .build() - ) - .build() - ) - - document.validate() - } - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentService = client.documents() - - val document = documentService.retrieve("document_qjtqc6s4c14ve2q89izm") - - document.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentService = client.documents() - - val page = documentService.list() - - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/DocumentServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/DocumentServiceTest.kt deleted file mode 100644 index c28ac092a..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/DocumentServiceTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking.simulations - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClient -import com.increase.api.models.simulations.documents.DocumentCreateParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class DocumentServiceTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val documentService = client.simulations().documents() - - val document = - documentService.create( - DocumentCreateParams.builder().accountId("account_in71c4amph0vgo2qllky").build() - ) - - document.validate() - } -} diff --git a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt index 4b3d3ef42..d850038e5 100644 --- a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt +++ b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt @@ -87,7 +87,6 @@ internal class ProGuardCompatibilityTest { assertThat(client.accountStatements()).isNotNull() assertThat(client.files()).isNotNull() assertThat(client.fileLinks()).isNotNull() - assertThat(client.documents()).isNotNull() assertThat(client.exports()).isNotNull() assertThat(client.events()).isNotNull() assertThat(client.eventSubscriptions()).isNotNull()