From ba3039fbae8b969ba5e54aa11985dace5d7158c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2026 00:52:07 +0000 Subject: [PATCH 1/3] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2715c40d0..589ad94b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 241 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-1f2c653a8b55e63d756d60f9110ceadb18f87a6039762b5ee31b5373bbc4499a.yml -openapi_spec_hash: a7b01c23c92b07f280117e6ba6262a7e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-7b98c487ac889f6d4cc96bef7abc480ba9ca7c40aac03cdccd28a8fb4b433193.yml +openapi_spec_hash: 0f6ad52ac90a9478f14fd762f958b01f config_hash: cb5b8736705c06b670f6a25484622d62 From 988c18c167cd5c84b0a16fb106e85ca4b1f8c77f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:42:39 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 8 +- .../com/increase/api/client/IncreaseClient.kt | 15 - .../api/client/IncreaseClientAsync.kt | 15 - .../api/client/IncreaseClientAsyncImpl.kt | 45 - .../increase/api/client/IncreaseClientImpl.kt | 45 - .../bookkeepingaccounts/BookkeepingAccount.kt | 728 --------------- .../BookkeepingAccountBalanceParams.kt | 229 ----- .../BookkeepingAccountCreateParams.kt | 771 ---------------- .../BookkeepingAccountListPage.kt | 135 --- .../BookkeepingAccountListPageAsync.kt | 152 ---- .../BookkeepingAccountListPageResponse.kt | 246 ------ .../BookkeepingAccountListParams.kt | 247 ------ .../BookkeepingAccountUpdateParams.kt | 444 ---------- .../BookkeepingBalanceLookup.kt | 394 --------- .../bookkeepingentries/BookkeepingEntry.kt | 506 ----------- .../BookkeepingEntryListPage.kt | 135 --- .../BookkeepingEntryListPageAsync.kt | 151 ---- .../BookkeepingEntryListPageResponse.kt | 246 ------ .../BookkeepingEntryListParams.kt | 237 ----- .../BookkeepingEntryRetrieveParams.kt | 204 ----- .../BookkeepingEntrySet.kt | 832 ------------------ .../BookkeepingEntrySetCreateParams.kt | 804 ----------------- .../BookkeepingEntrySetListPage.kt | 135 --- .../BookkeepingEntrySetListPageAsync.kt | 152 ---- .../BookkeepingEntrySetListPageResponse.kt | 247 ------ .../BookkeepingEntrySetListParams.kt | 271 ------ .../BookkeepingEntrySetRetrieveParams.kt | 207 ----- .../async/BookkeepingAccountServiceAsync.kt | 264 ------ .../BookkeepingAccountServiceAsyncImpl.kt | 224 ----- .../async/BookkeepingEntryServiceAsync.kt | 170 ---- .../async/BookkeepingEntryServiceAsyncImpl.kt | 139 --- .../async/BookkeepingEntrySetServiceAsync.kt | 204 ----- .../BookkeepingEntrySetServiceAsyncImpl.kt | 182 ---- .../blocking/BookkeepingAccountService.kt | 266 ------ .../blocking/BookkeepingAccountServiceImpl.kt | 206 ----- .../blocking/BookkeepingEntryService.kt | 168 ---- .../blocking/BookkeepingEntryServiceImpl.kt | 129 --- .../blocking/BookkeepingEntrySetService.kt | 205 ----- .../BookkeepingEntrySetServiceImpl.kt | 168 ---- .../BookkeepingAccountBalanceParamsTest.kt | 57 -- .../BookkeepingAccountCreateParamsTest.kt | 49 -- .../BookkeepingAccountListPageResponseTest.kt | 73 -- .../BookkeepingAccountListParamsTest.kt | 49 -- .../BookkeepingAccountTest.kt | 57 -- .../BookkeepingAccountUpdateParamsTest.kt | 43 - .../BookkeepingBalanceLookupTest.kt | 46 - .../BookkeepingEntryListPageResponseTest.kt | 71 -- .../BookkeepingEntryListParamsTest.kt | 49 -- .../BookkeepingEntryRetrieveParamsTest.kt | 28 - .../BookkeepingEntryTest.kt | 57 -- .../BookkeepingEntrySetCreateParamsTest.kt | 100 --- ...BookkeepingEntrySetListPageResponseTest.kt | 113 --- .../BookkeepingEntrySetListParamsTest.kt | 52 -- .../BookkeepingEntrySetRetrieveParamsTest.kt | 28 - .../BookkeepingEntrySetTest.kt | 98 --- .../BookkeepingAccountServiceAsyncTest.kt | 98 --- .../async/BookkeepingEntryServiceAsyncTest.kt | 43 - .../BookkeepingEntrySetServiceAsyncTest.kt | 78 -- .../blocking/BookkeepingAccountServiceTest.kt | 94 -- .../blocking/BookkeepingEntryServiceTest.kt | 41 - .../BookkeepingEntrySetServiceTest.kt | 75 -- .../api/proguard/ProGuardCompatibilityTest.kt | 3 - 62 files changed, 4 insertions(+), 11324 deletions(-) delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccount.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookup.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntry.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySet.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncImpl.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncImpl.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncImpl.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountService.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceImpl.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryService.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceImpl.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetService.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceImpl.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponseTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookupTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponseTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponseTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 589ad94b5..e029231b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 241 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-7b98c487ac889f6d4cc96bef7abc480ba9ca7c40aac03cdccd28a8fb4b433193.yml -openapi_spec_hash: 0f6ad52ac90a9478f14fd762f958b01f -config_hash: cb5b8736705c06b670f6a25484622d62 +configured_endpoints: 232 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-4615e5953fac5a76724144fc2e1f9f675a9722dc05adaeab23e4d09c9577086b.yml +openapi_spec_hash: 6db98497c4dda09b575d5ee12371ef83 +config_hash: b24ba63471a818520cec39b4695e1825 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 afd764ab5..325f50a3e 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 @@ -10,9 +10,6 @@ import com.increase.api.services.blocking.AccountTransferService import com.increase.api.services.blocking.AchPrenotificationService import com.increase.api.services.blocking.AchTransferService import com.increase.api.services.blocking.BeneficialOwnerService -import com.increase.api.services.blocking.BookkeepingAccountService -import com.increase.api.services.blocking.BookkeepingEntryService -import com.increase.api.services.blocking.BookkeepingEntrySetService import com.increase.api.services.blocking.CardDisputeService import com.increase.api.services.blocking.CardPaymentService import com.increase.api.services.blocking.CardPurchaseSupplementService @@ -190,12 +187,6 @@ interface IncreaseClient { fun realTimeDecisions(): RealTimeDecisionService - fun bookkeepingAccounts(): BookkeepingAccountService - - fun bookkeepingEntrySets(): BookkeepingEntrySetService - - fun bookkeepingEntries(): BookkeepingEntryService - fun groups(): GroupService fun oauthApplications(): OAuthApplicationService @@ -332,12 +323,6 @@ interface IncreaseClient { fun realTimeDecisions(): RealTimeDecisionService.WithRawResponse - fun bookkeepingAccounts(): BookkeepingAccountService.WithRawResponse - - fun bookkeepingEntrySets(): BookkeepingEntrySetService.WithRawResponse - - fun bookkeepingEntries(): BookkeepingEntryService.WithRawResponse - fun groups(): GroupService.WithRawResponse fun oauthApplications(): OAuthApplicationService.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 0f74f0f91..eb524b929 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 @@ -10,9 +10,6 @@ import com.increase.api.services.async.AccountTransferServiceAsync import com.increase.api.services.async.AchPrenotificationServiceAsync import com.increase.api.services.async.AchTransferServiceAsync import com.increase.api.services.async.BeneficialOwnerServiceAsync -import com.increase.api.services.async.BookkeepingAccountServiceAsync -import com.increase.api.services.async.BookkeepingEntryServiceAsync -import com.increase.api.services.async.BookkeepingEntrySetServiceAsync import com.increase.api.services.async.CardDisputeServiceAsync import com.increase.api.services.async.CardPaymentServiceAsync import com.increase.api.services.async.CardPurchaseSupplementServiceAsync @@ -190,12 +187,6 @@ interface IncreaseClientAsync { fun realTimeDecisions(): RealTimeDecisionServiceAsync - fun bookkeepingAccounts(): BookkeepingAccountServiceAsync - - fun bookkeepingEntrySets(): BookkeepingEntrySetServiceAsync - - fun bookkeepingEntries(): BookkeepingEntryServiceAsync - fun groups(): GroupServiceAsync fun oauthApplications(): OAuthApplicationServiceAsync @@ -336,12 +327,6 @@ interface IncreaseClientAsync { fun realTimeDecisions(): RealTimeDecisionServiceAsync.WithRawResponse - fun bookkeepingAccounts(): BookkeepingAccountServiceAsync.WithRawResponse - - fun bookkeepingEntrySets(): BookkeepingEntrySetServiceAsync.WithRawResponse - - fun bookkeepingEntries(): BookkeepingEntryServiceAsync.WithRawResponse - fun groups(): GroupServiceAsync.WithRawResponse fun oauthApplications(): OAuthApplicationServiceAsync.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 19629f4e2..23415543b 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 @@ -18,12 +18,6 @@ import com.increase.api.services.async.AchTransferServiceAsync import com.increase.api.services.async.AchTransferServiceAsyncImpl import com.increase.api.services.async.BeneficialOwnerServiceAsync import com.increase.api.services.async.BeneficialOwnerServiceAsyncImpl -import com.increase.api.services.async.BookkeepingAccountServiceAsync -import com.increase.api.services.async.BookkeepingAccountServiceAsyncImpl -import com.increase.api.services.async.BookkeepingEntryServiceAsync -import com.increase.api.services.async.BookkeepingEntryServiceAsyncImpl -import com.increase.api.services.async.BookkeepingEntrySetServiceAsync -import com.increase.api.services.async.BookkeepingEntrySetServiceAsyncImpl import com.increase.api.services.async.CardDisputeServiceAsync import com.increase.api.services.async.CardDisputeServiceAsyncImpl import com.increase.api.services.async.CardPaymentServiceAsync @@ -318,18 +312,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa RealTimeDecisionServiceAsyncImpl(clientOptionsWithUserAgent) } - private val bookkeepingAccounts: BookkeepingAccountServiceAsync by lazy { - BookkeepingAccountServiceAsyncImpl(clientOptionsWithUserAgent) - } - - private val bookkeepingEntrySets: BookkeepingEntrySetServiceAsync by lazy { - BookkeepingEntrySetServiceAsyncImpl(clientOptionsWithUserAgent) - } - - private val bookkeepingEntries: BookkeepingEntryServiceAsync by lazy { - BookkeepingEntryServiceAsyncImpl(clientOptionsWithUserAgent) - } - private val groups: GroupServiceAsync by lazy { GroupServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -477,12 +459,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa override fun realTimeDecisions(): RealTimeDecisionServiceAsync = realTimeDecisions - override fun bookkeepingAccounts(): BookkeepingAccountServiceAsync = bookkeepingAccounts - - override fun bookkeepingEntrySets(): BookkeepingEntrySetServiceAsync = bookkeepingEntrySets - - override fun bookkeepingEntries(): BookkeepingEntryServiceAsync = bookkeepingEntries - override fun groups(): GroupServiceAsync = groups override fun oauthApplications(): OAuthApplicationServiceAsync = oauthApplications @@ -698,18 +674,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa RealTimeDecisionServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val bookkeepingAccounts: BookkeepingAccountServiceAsync.WithRawResponse by lazy { - BookkeepingAccountServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - - private val bookkeepingEntrySets: BookkeepingEntrySetServiceAsync.WithRawResponse by lazy { - BookkeepingEntrySetServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - - private val bookkeepingEntries: BookkeepingEntryServiceAsync.WithRawResponse by lazy { - BookkeepingEntryServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val groups: GroupServiceAsync.WithRawResponse by lazy { GroupServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -877,15 +841,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa override fun realTimeDecisions(): RealTimeDecisionServiceAsync.WithRawResponse = realTimeDecisions - override fun bookkeepingAccounts(): BookkeepingAccountServiceAsync.WithRawResponse = - bookkeepingAccounts - - override fun bookkeepingEntrySets(): BookkeepingEntrySetServiceAsync.WithRawResponse = - bookkeepingEntrySets - - override fun bookkeepingEntries(): BookkeepingEntryServiceAsync.WithRawResponse = - bookkeepingEntries - override fun groups(): GroupServiceAsync.WithRawResponse = groups override fun oauthApplications(): OAuthApplicationServiceAsync.WithRawResponse = 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 306af6c3b..cd5cece97 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 @@ -18,12 +18,6 @@ import com.increase.api.services.blocking.AchTransferService import com.increase.api.services.blocking.AchTransferServiceImpl import com.increase.api.services.blocking.BeneficialOwnerService import com.increase.api.services.blocking.BeneficialOwnerServiceImpl -import com.increase.api.services.blocking.BookkeepingAccountService -import com.increase.api.services.blocking.BookkeepingAccountServiceImpl -import com.increase.api.services.blocking.BookkeepingEntryService -import com.increase.api.services.blocking.BookkeepingEntryServiceImpl -import com.increase.api.services.blocking.BookkeepingEntrySetService -import com.increase.api.services.blocking.BookkeepingEntrySetServiceImpl import com.increase.api.services.blocking.CardDisputeService import com.increase.api.services.blocking.CardDisputeServiceImpl import com.increase.api.services.blocking.CardPaymentService @@ -305,18 +299,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli RealTimeDecisionServiceImpl(clientOptionsWithUserAgent) } - private val bookkeepingAccounts: BookkeepingAccountService by lazy { - BookkeepingAccountServiceImpl(clientOptionsWithUserAgent) - } - - private val bookkeepingEntrySets: BookkeepingEntrySetService by lazy { - BookkeepingEntrySetServiceImpl(clientOptionsWithUserAgent) - } - - private val bookkeepingEntries: BookkeepingEntryService by lazy { - BookkeepingEntryServiceImpl(clientOptionsWithUserAgent) - } - private val groups: GroupService by lazy { GroupServiceImpl(clientOptionsWithUserAgent) } private val oauthApplications: OAuthApplicationService by lazy { @@ -460,12 +442,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli override fun realTimeDecisions(): RealTimeDecisionService = realTimeDecisions - override fun bookkeepingAccounts(): BookkeepingAccountService = bookkeepingAccounts - - override fun bookkeepingEntrySets(): BookkeepingEntrySetService = bookkeepingEntrySets - - override fun bookkeepingEntries(): BookkeepingEntryService = bookkeepingEntries - override fun groups(): GroupService = groups override fun oauthApplications(): OAuthApplicationService = oauthApplications @@ -678,18 +654,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli RealTimeDecisionServiceImpl.WithRawResponseImpl(clientOptions) } - private val bookkeepingAccounts: BookkeepingAccountService.WithRawResponse by lazy { - BookkeepingAccountServiceImpl.WithRawResponseImpl(clientOptions) - } - - private val bookkeepingEntrySets: BookkeepingEntrySetService.WithRawResponse by lazy { - BookkeepingEntrySetServiceImpl.WithRawResponseImpl(clientOptions) - } - - private val bookkeepingEntries: BookkeepingEntryService.WithRawResponse by lazy { - BookkeepingEntryServiceImpl.WithRawResponseImpl(clientOptions) - } - private val groups: GroupService.WithRawResponse by lazy { GroupServiceImpl.WithRawResponseImpl(clientOptions) } @@ -853,15 +817,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli override fun realTimeDecisions(): RealTimeDecisionService.WithRawResponse = realTimeDecisions - override fun bookkeepingAccounts(): BookkeepingAccountService.WithRawResponse = - bookkeepingAccounts - - override fun bookkeepingEntrySets(): BookkeepingEntrySetService.WithRawResponse = - bookkeepingEntrySets - - override fun bookkeepingEntries(): BookkeepingEntryService.WithRawResponse = - bookkeepingEntries - override fun groups(): GroupService.WithRawResponse = groups override fun oauthApplications(): OAuthApplicationService.WithRawResponse = diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccount.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccount.kt deleted file mode 100644 index 5ec6cc62b..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccount.kt +++ /dev/null @@ -1,728 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Accounts are T-accounts. They can store accounting entries. Your compliance setup might require - * annotating money movements using this API. Learn more in our - * [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping). - */ -class BookkeepingAccount -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val accountId: JsonField, - private val complianceCategory: JsonField, - private val entityId: JsonField, - private val idempotencyKey: JsonField, - private val name: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), - @JsonProperty("compliance_category") - @ExcludeMissing - complianceCategory: JsonField = JsonMissing.of(), - @JsonProperty("entity_id") @ExcludeMissing entityId: JsonField = JsonMissing.of(), - @JsonProperty("idempotency_key") - @ExcludeMissing - idempotencyKey: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this( - id, - accountId, - complianceCategory, - entityId, - idempotencyKey, - name, - type, - mutableMapOf(), - ) - - /** - * The account 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") - - /** - * The API Account associated with this bookkeeping account. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun accountId(): Optional = accountId.getOptional("account_id") - - /** - * The compliance category of the account. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun complianceCategory(): Optional = - complianceCategory.getOptional("compliance_category") - - /** - * The Entity associated with this bookkeeping account. - * - * @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 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") - - /** - * The name you choose for the account. - * - * @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 name(): String = name.getRequired("name") - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_account`. - * - * @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 [accountId]. - * - * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId - - /** - * Returns the raw JSON value of [complianceCategory]. - * - * Unlike [complianceCategory], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("compliance_category") - @ExcludeMissing - fun _complianceCategory(): JsonField = complianceCategory - - /** - * 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 [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 [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * 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 [BookkeepingAccount]. - * - * The following fields are required: - * ```java - * .id() - * .accountId() - * .complianceCategory() - * .entityId() - * .idempotencyKey() - * .name() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccount]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var accountId: JsonField? = null - private var complianceCategory: JsonField? = null - private var entityId: JsonField? = null - private var idempotencyKey: JsonField? = null - private var name: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookkeepingAccount: BookkeepingAccount) = apply { - id = bookkeepingAccount.id - accountId = bookkeepingAccount.accountId - complianceCategory = bookkeepingAccount.complianceCategory - entityId = bookkeepingAccount.entityId - idempotencyKey = bookkeepingAccount.idempotencyKey - name = bookkeepingAccount.name - type = bookkeepingAccount.type - additionalProperties = bookkeepingAccount.additionalProperties.toMutableMap() - } - - /** The account 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 } - - /** The API Account associated with this bookkeeping account. */ - fun accountId(accountId: String?) = accountId(JsonField.ofNullable(accountId)) - - /** Alias for calling [Builder.accountId] with `accountId.orElse(null)`. */ - fun accountId(accountId: Optional) = accountId(accountId.getOrNull()) - - /** - * 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 } - - /** The compliance category of the account. */ - fun complianceCategory(complianceCategory: ComplianceCategory?) = - complianceCategory(JsonField.ofNullable(complianceCategory)) - - /** - * Alias for calling [Builder.complianceCategory] with `complianceCategory.orElse(null)`. - */ - fun complianceCategory(complianceCategory: Optional) = - complianceCategory(complianceCategory.getOrNull()) - - /** - * Sets [Builder.complianceCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.complianceCategory] with a well-typed - * [ComplianceCategory] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun complianceCategory(complianceCategory: JsonField) = apply { - this.complianceCategory = complianceCategory - } - - /** The Entity associated with this bookkeeping account. */ - 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 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 - } - - /** The name you choose for the account. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_account`. - */ - 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 [BookkeepingAccount]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .accountId() - * .complianceCategory() - * .entityId() - * .idempotencyKey() - * .name() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingAccount = - BookkeepingAccount( - checkRequired("id", id), - checkRequired("accountId", accountId), - checkRequired("complianceCategory", complianceCategory), - checkRequired("entityId", entityId), - checkRequired("idempotencyKey", idempotencyKey), - checkRequired("name", name), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingAccount = apply { - if (validated) { - return@apply - } - - id() - accountId() - complianceCategory().ifPresent { it.validate() } - entityId() - idempotencyKey() - name() - 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) + - (if (accountId.asKnown().isPresent) 1 else 0) + - (complianceCategory.asKnown().getOrNull()?.validity() ?: 0) + - (if (entityId.asKnown().isPresent) 1 else 0) + - (if (idempotencyKey.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** The compliance category of the account. */ - class ComplianceCategory - @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 { - - /** A cash in an commingled Increase Account. */ - @JvmField val COMMINGLED_CASH = of("commingled_cash") - - /** A customer balance. */ - @JvmField val CUSTOMER_BALANCE = of("customer_balance") - - @JvmStatic fun of(value: String) = ComplianceCategory(JsonField.of(value)) - } - - /** An enum containing [ComplianceCategory]'s known values. */ - enum class Known { - /** A cash in an commingled Increase Account. */ - COMMINGLED_CASH, - /** A customer balance. */ - CUSTOMER_BALANCE, - } - - /** - * An enum containing [ComplianceCategory]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ComplianceCategory] 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 { - /** A cash in an commingled Increase Account. */ - COMMINGLED_CASH, - /** A customer balance. */ - CUSTOMER_BALANCE, - /** - * An enum member indicating that [ComplianceCategory] 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) { - COMMINGLED_CASH -> Value.COMMINGLED_CASH - CUSTOMER_BALANCE -> Value.CUSTOMER_BALANCE - 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) { - COMMINGLED_CASH -> Known.COMMINGLED_CASH - CUSTOMER_BALANCE -> Known.CUSTOMER_BALANCE - else -> throw IncreaseInvalidDataException("Unknown ComplianceCategory: $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(): ComplianceCategory = 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 ComplianceCategory && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_account`. - */ - 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 BOOKKEEPING_ACCOUNT = of("bookkeeping_account") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - BOOKKEEPING_ACCOUNT - } - - /** - * 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 { - BOOKKEEPING_ACCOUNT, - /** 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) { - BOOKKEEPING_ACCOUNT -> Value.BOOKKEEPING_ACCOUNT - 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) { - BOOKKEEPING_ACCOUNT -> Known.BOOKKEEPING_ACCOUNT - 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 BookkeepingAccount && - id == other.id && - accountId == other.accountId && - complianceCategory == other.complianceCategory && - entityId == other.entityId && - idempotencyKey == other.idempotencyKey && - name == other.name && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - accountId, - complianceCategory, - entityId, - idempotencyKey, - name, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookkeepingAccount{id=$id, accountId=$accountId, complianceCategory=$complianceCategory, entityId=$entityId, idempotencyKey=$idempotencyKey, name=$name, type=$type, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParams.kt deleted file mode 100644 index b4cdd3e4f..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParams.kt +++ /dev/null @@ -1,229 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.increase.api.core.Params -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Retrieve a Bookkeeping Account Balance */ -class BookkeepingAccountBalanceParams -private constructor( - private val bookkeepingAccountId: String?, - private val atTime: OffsetDateTime?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier of the Bookkeeping Account to retrieve. */ - fun bookkeepingAccountId(): Optional = Optional.ofNullable(bookkeepingAccountId) - - /** The moment to query the balance at. If not set, returns the current balances. */ - fun atTime(): Optional = Optional.ofNullable(atTime) - - /** 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(): BookkeepingAccountBalanceParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingAccountBalanceParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountBalanceParams]. */ - class Builder internal constructor() { - - private var bookkeepingAccountId: String? = null - private var atTime: OffsetDateTime? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(bookkeepingAccountBalanceParams: BookkeepingAccountBalanceParams) = - apply { - bookkeepingAccountId = bookkeepingAccountBalanceParams.bookkeepingAccountId - atTime = bookkeepingAccountBalanceParams.atTime - additionalHeaders = bookkeepingAccountBalanceParams.additionalHeaders.toBuilder() - additionalQueryParams = - bookkeepingAccountBalanceParams.additionalQueryParams.toBuilder() - } - - /** The identifier of the Bookkeeping Account to retrieve. */ - fun bookkeepingAccountId(bookkeepingAccountId: String?) = apply { - this.bookkeepingAccountId = bookkeepingAccountId - } - - /** - * Alias for calling [Builder.bookkeepingAccountId] with - * `bookkeepingAccountId.orElse(null)`. - */ - fun bookkeepingAccountId(bookkeepingAccountId: Optional) = - bookkeepingAccountId(bookkeepingAccountId.getOrNull()) - - /** The moment to query the balance at. If not set, returns the current balances. */ - fun atTime(atTime: OffsetDateTime?) = apply { this.atTime = atTime } - - /** Alias for calling [Builder.atTime] with `atTime.orElse(null)`. */ - fun atTime(atTime: Optional) = atTime(atTime.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 [BookkeepingAccountBalanceParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): BookkeepingAccountBalanceParams = - BookkeepingAccountBalanceParams( - bookkeepingAccountId, - atTime, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> bookkeepingAccountId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - atTime?.let { put("at_time", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingAccountBalanceParams && - bookkeepingAccountId == other.bookkeepingAccountId && - atTime == other.atTime && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(bookkeepingAccountId, atTime, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingAccountBalanceParams{bookkeepingAccountId=$bookkeepingAccountId, atTime=$atTime, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParams.kt deleted file mode 100644 index 3517a92b4..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParams.kt +++ /dev/null @@ -1,771 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Create a Bookkeeping Account */ -class BookkeepingAccountCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * The name you choose for the account. - * - * @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 name(): String = body.name() - - /** - * The account, if `compliance_category` is `commingled_cash`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun accountId(): Optional = body.accountId() - - /** - * The account compliance category. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun complianceCategory(): Optional = body.complianceCategory() - - /** - * The entity, if `compliance_category` is `customer_balance`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun entityId(): Optional = body.entityId() - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _name(): JsonField = body._name() - - /** - * 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() - - /** - * Returns the raw JSON value of [complianceCategory]. - * - * Unlike [complianceCategory], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _complianceCategory(): JsonField = body._complianceCategory() - - /** - * Returns the raw JSON value of [entityId]. - * - * Unlike [entityId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _entityId(): JsonField = body._entityId() - - 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 - * [BookkeepingAccountCreateParams]. - * - * The following fields are required: - * ```java - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountCreateParams]. */ - 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(bookkeepingAccountCreateParams: BookkeepingAccountCreateParams) = apply { - body = bookkeepingAccountCreateParams.body.toBuilder() - additionalHeaders = bookkeepingAccountCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = bookkeepingAccountCreateParams.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: - * - [name] - * - [accountId] - * - [complianceCategory] - * - [entityId] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The name you choose for the account. */ - fun name(name: String) = apply { body.name(name) } - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { body.name(name) } - - /** The account, if `compliance_category` is `commingled_cash`. */ - 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) } - - /** The account compliance category. */ - fun complianceCategory(complianceCategory: ComplianceCategory) = apply { - body.complianceCategory(complianceCategory) - } - - /** - * Sets [Builder.complianceCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.complianceCategory] with a well-typed - * [ComplianceCategory] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun complianceCategory(complianceCategory: JsonField) = apply { - body.complianceCategory(complianceCategory) - } - - /** The entity, if `compliance_category` is `customer_balance`. */ - fun entityId(entityId: String) = apply { body.entityId(entityId) } - - /** - * 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 { body.entityId(entityId) } - - 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 [BookkeepingAccountCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingAccountCreateParams = - BookkeepingAccountCreateParams( - 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 name: JsonField, - private val accountId: JsonField, - private val complianceCategory: JsonField, - private val entityId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("account_id") - @ExcludeMissing - accountId: JsonField = JsonMissing.of(), - @JsonProperty("compliance_category") - @ExcludeMissing - complianceCategory: JsonField = JsonMissing.of(), - @JsonProperty("entity_id") - @ExcludeMissing - entityId: JsonField = JsonMissing.of(), - ) : this(name, accountId, complianceCategory, entityId, mutableMapOf()) - - /** - * The name you choose for the account. - * - * @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 name(): String = name.getRequired("name") - - /** - * The account, if `compliance_category` is `commingled_cash`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun accountId(): Optional = accountId.getOptional("account_id") - - /** - * The account compliance category. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun complianceCategory(): Optional = - complianceCategory.getOptional("compliance_category") - - /** - * The entity, if `compliance_category` is `customer_balance`. - * - * @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") - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * 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 - - /** - * Returns the raw JSON value of [complianceCategory]. - * - * Unlike [complianceCategory], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("compliance_category") - @ExcludeMissing - fun _complianceCategory(): JsonField = complianceCategory - - /** - * 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 - - @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 - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var name: JsonField? = null - private var accountId: JsonField = JsonMissing.of() - private var complianceCategory: JsonField = JsonMissing.of() - private var entityId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - name = body.name - accountId = body.accountId - complianceCategory = body.complianceCategory - entityId = body.entityId - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The name you choose for the account. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** The account, if `compliance_category` is `commingled_cash`. */ - 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 } - - /** The account compliance category. */ - fun complianceCategory(complianceCategory: ComplianceCategory) = - complianceCategory(JsonField.of(complianceCategory)) - - /** - * Sets [Builder.complianceCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.complianceCategory] with a well-typed - * [ComplianceCategory] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun complianceCategory(complianceCategory: JsonField) = apply { - this.complianceCategory = complianceCategory - } - - /** The entity, if `compliance_category` is `customer_balance`. */ - fun entityId(entityId: String) = entityId(JsonField.of(entityId)) - - /** - * 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 } - - 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 - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("name", name), - accountId, - complianceCategory, - entityId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - name() - accountId() - complianceCategory().ifPresent { it.validate() } - entityId() - 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 (name.asKnown().isPresent) 1 else 0) + - (if (accountId.asKnown().isPresent) 1 else 0) + - (complianceCategory.asKnown().getOrNull()?.validity() ?: 0) + - (if (entityId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - name == other.name && - accountId == other.accountId && - complianceCategory == other.complianceCategory && - entityId == other.entityId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(name, accountId, complianceCategory, entityId, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{name=$name, accountId=$accountId, complianceCategory=$complianceCategory, entityId=$entityId, additionalProperties=$additionalProperties}" - } - - /** The account compliance category. */ - class ComplianceCategory - @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 { - - /** A cash in an commingled Increase Account. */ - @JvmField val COMMINGLED_CASH = of("commingled_cash") - - /** A customer balance. */ - @JvmField val CUSTOMER_BALANCE = of("customer_balance") - - @JvmStatic fun of(value: String) = ComplianceCategory(JsonField.of(value)) - } - - /** An enum containing [ComplianceCategory]'s known values. */ - enum class Known { - /** A cash in an commingled Increase Account. */ - COMMINGLED_CASH, - /** A customer balance. */ - CUSTOMER_BALANCE, - } - - /** - * An enum containing [ComplianceCategory]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ComplianceCategory] 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 { - /** A cash in an commingled Increase Account. */ - COMMINGLED_CASH, - /** A customer balance. */ - CUSTOMER_BALANCE, - /** - * An enum member indicating that [ComplianceCategory] 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) { - COMMINGLED_CASH -> Value.COMMINGLED_CASH - CUSTOMER_BALANCE -> Value.CUSTOMER_BALANCE - 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) { - COMMINGLED_CASH -> Known.COMMINGLED_CASH - CUSTOMER_BALANCE -> Known.CUSTOMER_BALANCE - else -> throw IncreaseInvalidDataException("Unknown ComplianceCategory: $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(): ComplianceCategory = 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 ComplianceCategory && 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 BookkeepingAccountCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingAccountCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt deleted file mode 100644 index cd7b6b4e7..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPage.kt +++ /dev/null @@ -1,135 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.increase.api.core.AutoPager -import com.increase.api.core.Page -import com.increase.api.core.checkRequired -import com.increase.api.services.blocking.BookkeepingAccountService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see BookkeepingAccountService.list */ -class BookkeepingAccountListPage -private constructor( - private val service: BookkeepingAccountService, - private val params: BookkeepingAccountListParams, - private val response: BookkeepingAccountListPageResponse, -) : Page { - - /** - * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingAccountListPageResponse.data - */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingAccountListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): BookkeepingAccountListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): BookkeepingAccountListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): BookkeepingAccountListParams = params - - /** The response that this page was parsed from. */ - fun response(): BookkeepingAccountListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [BookkeepingAccountListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountListPage]. */ - class Builder internal constructor() { - - private var service: BookkeepingAccountService? = null - private var params: BookkeepingAccountListParams? = null - private var response: BookkeepingAccountListPageResponse? = null - - @JvmSynthetic - internal fun from(bookkeepingAccountListPage: BookkeepingAccountListPage) = apply { - service = bookkeepingAccountListPage.service - params = bookkeepingAccountListPage.params - response = bookkeepingAccountListPage.response - } - - fun service(service: BookkeepingAccountService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: BookkeepingAccountListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: BookkeepingAccountListPageResponse) = apply { - this.response = response - } - - /** - * Returns an immutable instance of [BookkeepingAccountListPage]. - * - * 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(): BookkeepingAccountListPage = - BookkeepingAccountListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingAccountListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = - "BookkeepingAccountListPage{service=$service, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt deleted file mode 100644 index 80eecd7c9..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageAsync.kt +++ /dev/null @@ -1,152 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.increase.api.core.AutoPagerAsync -import com.increase.api.core.PageAsync -import com.increase.api.core.checkRequired -import com.increase.api.services.async.BookkeepingAccountServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see BookkeepingAccountServiceAsync.list */ -class BookkeepingAccountListPageAsync -private constructor( - private val service: BookkeepingAccountServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: BookkeepingAccountListParams, - private val response: BookkeepingAccountListPageResponse, -) : PageAsync { - - /** - * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingAccountListPageResponse.data - */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [BookkeepingAccountListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingAccountListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): BookkeepingAccountListParams { - 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(): BookkeepingAccountListParams = params - - /** The response that this page was parsed from. */ - fun response(): BookkeepingAccountListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingAccountListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountListPageAsync]. */ - class Builder internal constructor() { - - private var service: BookkeepingAccountServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: BookkeepingAccountListParams? = null - private var response: BookkeepingAccountListPageResponse? = null - - @JvmSynthetic - internal fun from(bookkeepingAccountListPageAsync: BookkeepingAccountListPageAsync) = - apply { - service = bookkeepingAccountListPageAsync.service - streamHandlerExecutor = bookkeepingAccountListPageAsync.streamHandlerExecutor - params = bookkeepingAccountListPageAsync.params - response = bookkeepingAccountListPageAsync.response - } - - fun service(service: BookkeepingAccountServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: BookkeepingAccountListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: BookkeepingAccountListPageResponse) = apply { - this.response = response - } - - /** - * Returns an immutable instance of [BookkeepingAccountListPageAsync]. - * - * 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(): BookkeepingAccountListPageAsync = - BookkeepingAccountListPageAsync( - 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 BookkeepingAccountListPageAsync && - 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() = - "BookkeepingAccountListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt deleted file mode 100644 index 1b661f937..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponse.kt +++ /dev/null @@ -1,246 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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 Bookkeeping Account objects. */ -class BookkeepingAccountListPageResponse -@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. Pass this as the `cursor` parameter to retrieve the next - * page of results. If there are no more results, the value will be `null`. - * - * @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 - * [BookkeepingAccountListPageResponse]. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountListPageResponse]. */ - class Builder internal constructor() { - - private var data: JsonField>? = null - private var nextCursor: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookkeepingAccountListPageResponse: BookkeepingAccountListPageResponse) = - apply { - data = bookkeepingAccountListPageResponse.data.map { it.toMutableList() } - nextCursor = bookkeepingAccountListPageResponse.nextCursor - additionalProperties = - bookkeepingAccountListPageResponse.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 [BookkeepingAccount] to [Builder.data]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addData(data: BookkeepingAccount) = apply { - this.data = - (this.data ?: JsonField.of(mutableListOf())).also { - checkKnown("data", it).add(data) - } - } - - /** - * A pointer to a place in the list. Pass this as the `cursor` parameter to retrieve the - * next page of results. If there are no more results, the value will be `null`. - */ - 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 [BookkeepingAccountListPageResponse]. - * - * 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(): BookkeepingAccountListPageResponse = - BookkeepingAccountListPageResponse( - checkRequired("data", data).map { it.toImmutable() }, - checkRequired("nextCursor", nextCursor), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingAccountListPageResponse = 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 BookkeepingAccountListPageResponse && - 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() = - "BookkeepingAccountListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParams.kt deleted file mode 100644 index 33f07577f..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParams.kt +++ /dev/null @@ -1,247 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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 - -/** List Bookkeeping Accounts */ -class BookkeepingAccountListParams -private constructor( - private val cursor: String?, - private val idempotencyKey: String?, - private val limit: Long?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Return the page of entries after this one. */ - fun cursor(): Optional = Optional.ofNullable(cursor) - - /** - * 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(): BookkeepingAccountListParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [BookkeepingAccountListParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountListParams]. */ - class Builder internal constructor() { - - private var cursor: 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(bookkeepingAccountListParams: BookkeepingAccountListParams) = apply { - cursor = bookkeepingAccountListParams.cursor - idempotencyKey = bookkeepingAccountListParams.idempotencyKey - limit = bookkeepingAccountListParams.limit - additionalHeaders = bookkeepingAccountListParams.additionalHeaders.toBuilder() - additionalQueryParams = bookkeepingAccountListParams.additionalQueryParams.toBuilder() - } - - /** 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 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 [BookkeepingAccountListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): BookkeepingAccountListParams = - BookkeepingAccountListParams( - cursor, - idempotencyKey, - limit, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - cursor?.let { put("cursor", it) } - idempotencyKey?.let { put("idempotency_key", it) } - limit?.let { put("limit", it.toString()) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingAccountListParams && - cursor == other.cursor && - idempotencyKey == other.idempotencyKey && - limit == other.limit && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(cursor, idempotencyKey, limit, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingAccountListParams{cursor=$cursor, idempotencyKey=$idempotencyKey, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParams.kt deleted file mode 100644 index 5a90a6dcd..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParams.kt +++ /dev/null @@ -1,444 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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 -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Update a Bookkeeping Account */ -class BookkeepingAccountUpdateParams -private constructor( - private val bookkeepingAccountId: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The bookkeeping account you would like to update. */ - fun bookkeepingAccountId(): Optional = Optional.ofNullable(bookkeepingAccountId) - - /** - * The name you choose for the account. - * - * @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 name(): String = body.name() - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _name(): JsonField = body._name() - - 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 - * [BookkeepingAccountUpdateParams]. - * - * The following fields are required: - * ```java - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingAccountUpdateParams]. */ - class Builder internal constructor() { - - private var bookkeepingAccountId: String? = null - 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(bookkeepingAccountUpdateParams: BookkeepingAccountUpdateParams) = apply { - bookkeepingAccountId = bookkeepingAccountUpdateParams.bookkeepingAccountId - body = bookkeepingAccountUpdateParams.body.toBuilder() - additionalHeaders = bookkeepingAccountUpdateParams.additionalHeaders.toBuilder() - additionalQueryParams = bookkeepingAccountUpdateParams.additionalQueryParams.toBuilder() - } - - /** The bookkeeping account you would like to update. */ - fun bookkeepingAccountId(bookkeepingAccountId: String?) = apply { - this.bookkeepingAccountId = bookkeepingAccountId - } - - /** - * Alias for calling [Builder.bookkeepingAccountId] with - * `bookkeepingAccountId.orElse(null)`. - */ - fun bookkeepingAccountId(bookkeepingAccountId: Optional) = - bookkeepingAccountId(bookkeepingAccountId.getOrNull()) - - /** - * 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: - * - [name] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The name you choose for the account. */ - fun name(name: String) = apply { body.name(name) } - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { body.name(name) } - - 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 [BookkeepingAccountUpdateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingAccountUpdateParams = - BookkeepingAccountUpdateParams( - bookkeepingAccountId, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> bookkeepingAccountId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val name: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() - ) : this(name, mutableMapOf()) - - /** - * The name you choose for the account. - * - * @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 name(): String = name.getRequired("name") - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @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 - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var name: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - name = body.name - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The name you choose for the account. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - 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 - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body(checkRequired("name", name), additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - name() - 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 (name.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - name == other.name && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Body{name=$name, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingAccountUpdateParams && - bookkeepingAccountId == other.bookkeepingAccountId && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(bookkeepingAccountId, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingAccountUpdateParams{bookkeepingAccountId=$bookkeepingAccountId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookup.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookup.kt deleted file mode 100644 index dca69e8bf..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookup.kt +++ /dev/null @@ -1,394 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -/** Represents a request to lookup the balance of a Bookkeeping Account at a given point in time. */ -class BookkeepingBalanceLookup -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val balance: JsonField, - private val bookkeepingAccountId: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of(), - @JsonProperty("bookkeeping_account_id") - @ExcludeMissing - bookkeepingAccountId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(balance, bookkeepingAccountId, type, mutableMapOf()) - - /** - * The Bookkeeping Account's current balance, representing the sum of all Bookkeeping Entries on - * the Bookkeeping Account. - * - * @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 balance(): Long = balance.getRequired("balance") - - /** - * The identifier for the account for which the balance was queried. - * - * @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 bookkeepingAccountId(): String = bookkeepingAccountId.getRequired("bookkeeping_account_id") - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_balance_lookup`. - * - * @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 [balance]. - * - * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField = balance - - /** - * Returns the raw JSON value of [bookkeepingAccountId]. - * - * Unlike [bookkeepingAccountId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("bookkeeping_account_id") - @ExcludeMissing - fun _bookkeepingAccountId(): JsonField = bookkeepingAccountId - - /** - * 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 [BookkeepingBalanceLookup]. - * - * The following fields are required: - * ```java - * .balance() - * .bookkeepingAccountId() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingBalanceLookup]. */ - class Builder internal constructor() { - - private var balance: JsonField? = null - private var bookkeepingAccountId: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookkeepingBalanceLookup: BookkeepingBalanceLookup) = apply { - balance = bookkeepingBalanceLookup.balance - bookkeepingAccountId = bookkeepingBalanceLookup.bookkeepingAccountId - type = bookkeepingBalanceLookup.type - additionalProperties = bookkeepingBalanceLookup.additionalProperties.toMutableMap() - } - - /** - * The Bookkeeping Account's current balance, representing the sum of all Bookkeeping - * Entries on the Bookkeeping Account. - */ - fun balance(balance: Long) = balance(JsonField.of(balance)) - - /** - * Sets [Builder.balance] to an arbitrary JSON value. - * - * You should usually call [Builder.balance] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun balance(balance: JsonField) = apply { this.balance = balance } - - /** The identifier for the account for which the balance was queried. */ - fun bookkeepingAccountId(bookkeepingAccountId: String) = - bookkeepingAccountId(JsonField.of(bookkeepingAccountId)) - - /** - * Sets [Builder.bookkeepingAccountId] to an arbitrary JSON value. - * - * You should usually call [Builder.bookkeepingAccountId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun bookkeepingAccountId(bookkeepingAccountId: JsonField) = apply { - this.bookkeepingAccountId = bookkeepingAccountId - } - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_balance_lookup`. - */ - 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 [BookkeepingBalanceLookup]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .balance() - * .bookkeepingAccountId() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingBalanceLookup = - BookkeepingBalanceLookup( - checkRequired("balance", balance), - checkRequired("bookkeepingAccountId", bookkeepingAccountId), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingBalanceLookup = apply { - if (validated) { - return@apply - } - - balance() - bookkeepingAccountId() - 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 (balance.asKnown().isPresent) 1 else 0) + - (if (bookkeepingAccountId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_balance_lookup`. - */ - 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 BOOKKEEPING_BALANCE_LOOKUP = of("bookkeeping_balance_lookup") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - BOOKKEEPING_BALANCE_LOOKUP - } - - /** - * 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 { - BOOKKEEPING_BALANCE_LOOKUP, - /** 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) { - BOOKKEEPING_BALANCE_LOOKUP -> Value.BOOKKEEPING_BALANCE_LOOKUP - 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) { - BOOKKEEPING_BALANCE_LOOKUP -> Known.BOOKKEEPING_BALANCE_LOOKUP - 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 BookkeepingBalanceLookup && - balance == other.balance && - bookkeepingAccountId == other.bookkeepingAccountId && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(balance, bookkeepingAccountId, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookkeepingBalanceLookup{balance=$balance, bookkeepingAccountId=$bookkeepingAccountId, type=$type, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntry.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntry.kt deleted file mode 100644 index 3812c42ea..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntry.kt +++ /dev/null @@ -1,506 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -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 kotlin.jvm.optionals.getOrNull - -/** - * Entries are T-account entries recording debits and credits. Your compliance setup might require - * annotating money movements using this API. Learn more in our - * [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping). - */ -class BookkeepingEntry -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val accountId: JsonField, - private val amount: JsonField, - private val createdAt: JsonField, - private val entrySetId: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("entry_set_id") - @ExcludeMissing - entrySetId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(id, accountId, amount, createdAt, entrySetId, type, mutableMapOf()) - - /** - * The entry 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") - - /** - * The identifier for the Account the Entry belongs to. - * - * @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") - - /** - * The Entry amount in the minor unit of its currency. For dollars, for example, this is cents. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * When the entry set 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 for the Entry Set the Entry belongs to. - * - * @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 entrySetId(): String = entrySetId.getRequired("entry_set_id") - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_entry`. - * - * @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 [accountId]. - * - * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * 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 [entrySetId]. - * - * Unlike [entrySetId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entry_set_id") @ExcludeMissing fun _entrySetId(): JsonField = entrySetId - - /** - * 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 [BookkeepingEntry]. - * - * The following fields are required: - * ```java - * .id() - * .accountId() - * .amount() - * .createdAt() - * .entrySetId() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntry]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var accountId: JsonField? = null - private var amount: JsonField? = null - private var createdAt: JsonField? = null - private var entrySetId: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookkeepingEntry: BookkeepingEntry) = apply { - id = bookkeepingEntry.id - accountId = bookkeepingEntry.accountId - amount = bookkeepingEntry.amount - createdAt = bookkeepingEntry.createdAt - entrySetId = bookkeepingEntry.entrySetId - type = bookkeepingEntry.type - additionalProperties = bookkeepingEntry.additionalProperties.toMutableMap() - } - - /** The entry 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 } - - /** The identifier for the Account the Entry belongs to. */ - 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 } - - /** - * The Entry amount in the minor unit of its currency. For dollars, for example, this is - * cents. - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** When the entry set 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 for the Entry Set the Entry belongs to. */ - fun entrySetId(entrySetId: String) = entrySetId(JsonField.of(entrySetId)) - - /** - * Sets [Builder.entrySetId] to an arbitrary JSON value. - * - * You should usually call [Builder.entrySetId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun entrySetId(entrySetId: JsonField) = apply { this.entrySetId = entrySetId } - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_entry`. - */ - 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 [BookkeepingEntry]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .accountId() - * .amount() - * .createdAt() - * .entrySetId() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingEntry = - BookkeepingEntry( - checkRequired("id", id), - checkRequired("accountId", accountId), - checkRequired("amount", amount), - checkRequired("createdAt", createdAt), - checkRequired("entrySetId", entrySetId), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingEntry = apply { - if (validated) { - return@apply - } - - id() - accountId() - amount() - createdAt() - entrySetId() - 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) + - (if (accountId.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (entrySetId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_entry`. - */ - 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 BOOKKEEPING_ENTRY = of("bookkeeping_entry") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - BOOKKEEPING_ENTRY - } - - /** - * 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 { - BOOKKEEPING_ENTRY, - /** 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) { - BOOKKEEPING_ENTRY -> Value.BOOKKEEPING_ENTRY - 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) { - BOOKKEEPING_ENTRY -> Known.BOOKKEEPING_ENTRY - 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 BookkeepingEntry && - id == other.id && - accountId == other.accountId && - amount == other.amount && - createdAt == other.createdAt && - entrySetId == other.entrySetId && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(id, accountId, amount, createdAt, entrySetId, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookkeepingEntry{id=$id, accountId=$accountId, amount=$amount, createdAt=$createdAt, entrySetId=$entrySetId, type=$type, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt deleted file mode 100644 index 7a7224782..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPage.kt +++ /dev/null @@ -1,135 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -import com.increase.api.core.AutoPager -import com.increase.api.core.Page -import com.increase.api.core.checkRequired -import com.increase.api.services.blocking.BookkeepingEntryService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see BookkeepingEntryService.list */ -class BookkeepingEntryListPage -private constructor( - private val service: BookkeepingEntryService, - private val params: BookkeepingEntryListParams, - private val response: BookkeepingEntryListPageResponse, -) : Page { - - /** - * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntryListPageResponse.data - */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntryListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): BookkeepingEntryListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): BookkeepingEntryListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): BookkeepingEntryListParams = params - - /** The response that this page was parsed from. */ - fun response(): BookkeepingEntryListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [BookkeepingEntryListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntryListPage]. */ - class Builder internal constructor() { - - private var service: BookkeepingEntryService? = null - private var params: BookkeepingEntryListParams? = null - private var response: BookkeepingEntryListPageResponse? = null - - @JvmSynthetic - internal fun from(bookkeepingEntryListPage: BookkeepingEntryListPage) = apply { - service = bookkeepingEntryListPage.service - params = bookkeepingEntryListPage.params - response = bookkeepingEntryListPage.response - } - - fun service(service: BookkeepingEntryService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: BookkeepingEntryListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: BookkeepingEntryListPageResponse) = apply { - this.response = response - } - - /** - * Returns an immutable instance of [BookkeepingEntryListPage]. - * - * 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(): BookkeepingEntryListPage = - BookkeepingEntryListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingEntryListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = - "BookkeepingEntryListPage{service=$service, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt deleted file mode 100644 index 0b5495cb4..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageAsync.kt +++ /dev/null @@ -1,151 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -import com.increase.api.core.AutoPagerAsync -import com.increase.api.core.PageAsync -import com.increase.api.core.checkRequired -import com.increase.api.services.async.BookkeepingEntryServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see BookkeepingEntryServiceAsync.list */ -class BookkeepingEntryListPageAsync -private constructor( - private val service: BookkeepingEntryServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: BookkeepingEntryListParams, - private val response: BookkeepingEntryListPageResponse, -) : PageAsync { - - /** - * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntryListPageResponse.data - */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [BookkeepingEntryListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntryListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): BookkeepingEntryListParams { - 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(): BookkeepingEntryListParams = params - - /** The response that this page was parsed from. */ - fun response(): BookkeepingEntryListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingEntryListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntryListPageAsync]. */ - class Builder internal constructor() { - - private var service: BookkeepingEntryServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: BookkeepingEntryListParams? = null - private var response: BookkeepingEntryListPageResponse? = null - - @JvmSynthetic - internal fun from(bookkeepingEntryListPageAsync: BookkeepingEntryListPageAsync) = apply { - service = bookkeepingEntryListPageAsync.service - streamHandlerExecutor = bookkeepingEntryListPageAsync.streamHandlerExecutor - params = bookkeepingEntryListPageAsync.params - response = bookkeepingEntryListPageAsync.response - } - - fun service(service: BookkeepingEntryServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: BookkeepingEntryListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: BookkeepingEntryListPageResponse) = apply { - this.response = response - } - - /** - * Returns an immutable instance of [BookkeepingEntryListPageAsync]. - * - * 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(): BookkeepingEntryListPageAsync = - BookkeepingEntryListPageAsync( - 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 BookkeepingEntryListPageAsync && - 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() = - "BookkeepingEntryListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt deleted file mode 100644 index 4530ac179..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponse.kt +++ /dev/null @@ -1,246 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -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 Bookkeeping Entry objects. */ -class BookkeepingEntryListPageResponse -@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. Pass this as the `cursor` parameter to retrieve the next - * page of results. If there are no more results, the value will be `null`. - * - * @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 - * [BookkeepingEntryListPageResponse]. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntryListPageResponse]. */ - class Builder internal constructor() { - - private var data: JsonField>? = null - private var nextCursor: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookkeepingEntryListPageResponse: BookkeepingEntryListPageResponse) = - apply { - data = bookkeepingEntryListPageResponse.data.map { it.toMutableList() } - nextCursor = bookkeepingEntryListPageResponse.nextCursor - additionalProperties = - bookkeepingEntryListPageResponse.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 [BookkeepingEntry] to [Builder.data]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addData(data: BookkeepingEntry) = apply { - this.data = - (this.data ?: JsonField.of(mutableListOf())).also { - checkKnown("data", it).add(data) - } - } - - /** - * A pointer to a place in the list. Pass this as the `cursor` parameter to retrieve the - * next page of results. If there are no more results, the value will be `null`. - */ - 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 [BookkeepingEntryListPageResponse]. - * - * 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(): BookkeepingEntryListPageResponse = - BookkeepingEntryListPageResponse( - checkRequired("data", data).map { it.toImmutable() }, - checkRequired("nextCursor", nextCursor), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingEntryListPageResponse = 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 BookkeepingEntryListPageResponse && - 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() = - "BookkeepingEntryListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParams.kt deleted file mode 100644 index 09b7bd8c8..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParams.kt +++ /dev/null @@ -1,237 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -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 - -/** List Bookkeeping Entries */ -class BookkeepingEntryListParams -private constructor( - private val accountId: String?, - private val cursor: String?, - private val limit: Long?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier for the Bookkeeping Account to filter by. */ - fun accountId(): Optional = Optional.ofNullable(accountId) - - /** Return the page of entries after this one. */ - fun cursor(): Optional = Optional.ofNullable(cursor) - - /** 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(): BookkeepingEntryListParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [BookkeepingEntryListParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntryListParams]. */ - class Builder internal constructor() { - - private var accountId: String? = null - private var cursor: 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(bookkeepingEntryListParams: BookkeepingEntryListParams) = apply { - accountId = bookkeepingEntryListParams.accountId - cursor = bookkeepingEntryListParams.cursor - limit = bookkeepingEntryListParams.limit - additionalHeaders = bookkeepingEntryListParams.additionalHeaders.toBuilder() - additionalQueryParams = bookkeepingEntryListParams.additionalQueryParams.toBuilder() - } - - /** The identifier for the Bookkeeping Account to filter by. */ - fun accountId(accountId: String?) = apply { this.accountId = accountId } - - /** Alias for calling [Builder.accountId] with `accountId.orElse(null)`. */ - fun accountId(accountId: Optional) = accountId(accountId.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()) - - /** - * 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 [BookkeepingEntryListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): BookkeepingEntryListParams = - BookkeepingEntryListParams( - accountId, - cursor, - limit, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - accountId?.let { put("account_id", it) } - cursor?.let { put("cursor", it) } - limit?.let { put("limit", it.toString()) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingEntryListParams && - accountId == other.accountId && - cursor == other.cursor && - limit == other.limit && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(accountId, cursor, limit, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingEntryListParams{accountId=$accountId, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParams.kt deleted file mode 100644 index 9e3d57884..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParams.kt +++ /dev/null @@ -1,204 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -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 Bookkeeping Entry */ -class BookkeepingEntryRetrieveParams -private constructor( - private val bookkeepingEntryId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier of the Bookkeeping Entry. */ - fun bookkeepingEntryId(): Optional = Optional.ofNullable(bookkeepingEntryId) - - /** 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(): BookkeepingEntryRetrieveParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingEntryRetrieveParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntryRetrieveParams]. */ - class Builder internal constructor() { - - private var bookkeepingEntryId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(bookkeepingEntryRetrieveParams: BookkeepingEntryRetrieveParams) = apply { - bookkeepingEntryId = bookkeepingEntryRetrieveParams.bookkeepingEntryId - additionalHeaders = bookkeepingEntryRetrieveParams.additionalHeaders.toBuilder() - additionalQueryParams = bookkeepingEntryRetrieveParams.additionalQueryParams.toBuilder() - } - - /** The identifier of the Bookkeeping Entry. */ - fun bookkeepingEntryId(bookkeepingEntryId: String?) = apply { - this.bookkeepingEntryId = bookkeepingEntryId - } - - /** - * Alias for calling [Builder.bookkeepingEntryId] with `bookkeepingEntryId.orElse(null)`. - */ - fun bookkeepingEntryId(bookkeepingEntryId: Optional) = - bookkeepingEntryId(bookkeepingEntryId.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 [BookkeepingEntryRetrieveParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): BookkeepingEntryRetrieveParams = - BookkeepingEntryRetrieveParams( - bookkeepingEntryId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> bookkeepingEntryId ?: "" - 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 BookkeepingEntryRetrieveParams && - bookkeepingEntryId == other.bookkeepingEntryId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(bookkeepingEntryId, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingEntryRetrieveParams{bookkeepingEntryId=$bookkeepingEntryId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySet.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySet.kt deleted file mode 100644 index 64a3fe2e5..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySet.kt +++ /dev/null @@ -1,832 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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.checkKnown -import com.increase.api.core.checkRequired -import com.increase.api.core.toImmutable -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 - -/** - * Entry Sets are accounting entries that are transactionally applied. Your compliance setup might - * require annotating money movements using this API. Learn more in our - * [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping). - */ -class BookkeepingEntrySet -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val createdAt: JsonField, - private val date: JsonField, - private val entries: JsonField>, - private val idempotencyKey: JsonField, - private val transactionId: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("date") @ExcludeMissing date: JsonField = JsonMissing.of(), - @JsonProperty("entries") @ExcludeMissing entries: JsonField> = JsonMissing.of(), - @JsonProperty("idempotency_key") - @ExcludeMissing - idempotencyKey: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(id, createdAt, date, entries, idempotencyKey, transactionId, type, mutableMapOf()) - - /** - * The entry set 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") - - /** - * When the entry set 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 timestamp of the entry set. - * - * @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 date(): OffsetDateTime = date.getRequired("date") - - /** - * The entries. - * - * @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 entries(): List = entries.getRequired("entries") - - /** - * 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") - - /** - * The transaction identifier, if any. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_entry_set`. - * - * @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 [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 [date]. - * - * Unlike [date], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("date") @ExcludeMissing fun _date(): JsonField = date - - /** - * Returns the raw JSON value of [entries]. - * - * Unlike [entries], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entries") @ExcludeMissing fun _entries(): JsonField> = entries - - /** - * 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 [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId - - /** - * 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 [BookkeepingEntrySet]. - * - * The following fields are required: - * ```java - * .id() - * .createdAt() - * .date() - * .entries() - * .idempotencyKey() - * .transactionId() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySet]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var createdAt: JsonField? = null - private var date: JsonField? = null - private var entries: JsonField>? = null - private var idempotencyKey: JsonField? = null - private var transactionId: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookkeepingEntrySet: BookkeepingEntrySet) = apply { - id = bookkeepingEntrySet.id - createdAt = bookkeepingEntrySet.createdAt - date = bookkeepingEntrySet.date - entries = bookkeepingEntrySet.entries.map { it.toMutableList() } - idempotencyKey = bookkeepingEntrySet.idempotencyKey - transactionId = bookkeepingEntrySet.transactionId - type = bookkeepingEntrySet.type - additionalProperties = bookkeepingEntrySet.additionalProperties.toMutableMap() - } - - /** The entry set 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 } - - /** When the entry set 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 timestamp of the entry set. */ - fun date(date: OffsetDateTime) = date(JsonField.of(date)) - - /** - * Sets [Builder.date] to an arbitrary JSON value. - * - * You should usually call [Builder.date] with a well-typed [OffsetDateTime] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun date(date: JsonField) = apply { this.date = date } - - /** The entries. */ - fun entries(entries: List) = entries(JsonField.of(entries)) - - /** - * Sets [Builder.entries] to an arbitrary JSON value. - * - * You should usually call [Builder.entries] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun entries(entries: JsonField>) = apply { - this.entries = entries.map { it.toMutableList() } - } - - /** - * Adds a single [Entry] to [entries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEntry(entry: Entry) = apply { - entries = - (entries ?: JsonField.of(mutableListOf())).also { - checkKnown("entries", it).add(entry) - } - } - - /** - * 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 - } - - /** The transaction identifier, if any. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) - - /** Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) - - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_entry_set`. - */ - 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 [BookkeepingEntrySet]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .createdAt() - * .date() - * .entries() - * .idempotencyKey() - * .transactionId() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingEntrySet = - BookkeepingEntrySet( - checkRequired("id", id), - checkRequired("createdAt", createdAt), - checkRequired("date", date), - checkRequired("entries", entries).map { it.toImmutable() }, - checkRequired("idempotencyKey", idempotencyKey), - checkRequired("transactionId", transactionId), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingEntrySet = apply { - if (validated) { - return@apply - } - - id() - createdAt() - date() - entries().forEach { it.validate() } - idempotencyKey() - transactionId() - 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) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (date.asKnown().isPresent) 1 else 0) + - (entries.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (idempotencyKey.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - class Entry - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val accountId: JsonField, - private val amount: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("account_id") - @ExcludeMissing - accountId: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - ) : this(id, accountId, amount, mutableMapOf()) - - /** - * The entry 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") - - /** - * The bookkeeping account impacted by the entry. - * - * @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") - - /** - * The amount of the entry in minor units. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * 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 [accountId]. - * - * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @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 [Entry]. - * - * The following fields are required: - * ```java - * .id() - * .accountId() - * .amount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Entry]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var accountId: JsonField? = null - private var amount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(entry: Entry) = apply { - id = entry.id - accountId = entry.accountId - amount = entry.amount - additionalProperties = entry.additionalProperties.toMutableMap() - } - - /** The entry 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 } - - /** The bookkeeping account impacted by the entry. */ - 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 } - - /** The amount of the entry in minor units. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - 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 [Entry]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .accountId() - * .amount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Entry = - Entry( - checkRequired("id", id), - checkRequired("accountId", accountId), - checkRequired("amount", amount), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Entry = apply { - if (validated) { - return@apply - } - - id() - accountId() - amount() - 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) + - (if (accountId.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Entry && - id == other.id && - accountId == other.accountId && - amount == other.amount && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(id, accountId, amount, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Entry{id=$id, accountId=$accountId, amount=$amount, additionalProperties=$additionalProperties}" - } - - /** - * A constant representing the object's type. For this resource it will always be - * `bookkeeping_entry_set`. - */ - 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 BOOKKEEPING_ENTRY_SET = of("bookkeeping_entry_set") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - BOOKKEEPING_ENTRY_SET - } - - /** - * 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 { - BOOKKEEPING_ENTRY_SET, - /** 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) { - BOOKKEEPING_ENTRY_SET -> Value.BOOKKEEPING_ENTRY_SET - 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) { - BOOKKEEPING_ENTRY_SET -> Known.BOOKKEEPING_ENTRY_SET - 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 BookkeepingEntrySet && - id == other.id && - createdAt == other.createdAt && - date == other.date && - entries == other.entries && - idempotencyKey == other.idempotencyKey && - transactionId == other.transactionId && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - createdAt, - date, - entries, - idempotencyKey, - transactionId, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookkeepingEntrySet{id=$id, createdAt=$createdAt, date=$date, entries=$entries, idempotencyKey=$idempotencyKey, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParams.kt deleted file mode 100644 index 2a0de41cc..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParams.kt +++ /dev/null @@ -1,804 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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.checkKnown -import com.increase.api.core.checkRequired -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.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Create a Bookkeeping Entry Set */ -class BookkeepingEntrySetCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * The bookkeeping entries. - * - * @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 entries(): List = body.entries() - - /** - * The date of the transaction. Optional if `transaction_id` is provided, in which case we use - * the `date` of that transaction. Required otherwise. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun date(): Optional = body.date() - - /** - * The identifier of the Transaction related to this entry set, if any. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun transactionId(): Optional = body.transactionId() - - /** - * Returns the raw JSON value of [entries]. - * - * Unlike [entries], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _entries(): JsonField> = body._entries() - - /** - * Returns the raw JSON value of [date]. - * - * Unlike [date], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _date(): JsonField = body._date() - - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _transactionId(): JsonField = body._transactionId() - - 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 - * [BookkeepingEntrySetCreateParams]. - * - * The following fields are required: - * ```java - * .entries() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySetCreateParams]. */ - 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(bookkeepingEntrySetCreateParams: BookkeepingEntrySetCreateParams) = - apply { - body = bookkeepingEntrySetCreateParams.body.toBuilder() - additionalHeaders = bookkeepingEntrySetCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = - bookkeepingEntrySetCreateParams.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: - * - [entries] - * - [date] - * - [transactionId] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The bookkeeping entries. */ - fun entries(entries: List) = apply { body.entries(entries) } - - /** - * Sets [Builder.entries] to an arbitrary JSON value. - * - * You should usually call [Builder.entries] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun entries(entries: JsonField>) = apply { body.entries(entries) } - - /** - * Adds a single [Entry] to [entries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEntry(entry: Entry) = apply { body.addEntry(entry) } - - /** - * The date of the transaction. Optional if `transaction_id` is provided, in which case we - * use the `date` of that transaction. Required otherwise. - */ - fun date(date: OffsetDateTime) = apply { body.date(date) } - - /** - * Sets [Builder.date] to an arbitrary JSON value. - * - * You should usually call [Builder.date] with a well-typed [OffsetDateTime] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun date(date: JsonField) = apply { body.date(date) } - - /** The identifier of the Transaction related to this entry set, if any. */ - fun transactionId(transactionId: String) = apply { body.transactionId(transactionId) } - - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun transactionId(transactionId: JsonField) = apply { - body.transactionId(transactionId) - } - - 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 [BookkeepingEntrySetCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .entries() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookkeepingEntrySetCreateParams = - BookkeepingEntrySetCreateParams( - 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 entries: JsonField>, - private val date: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("entries") - @ExcludeMissing - entries: JsonField> = JsonMissing.of(), - @JsonProperty("date") - @ExcludeMissing - date: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(entries, date, transactionId, mutableMapOf()) - - /** - * The bookkeeping entries. - * - * @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 entries(): List = entries.getRequired("entries") - - /** - * The date of the transaction. Optional if `transaction_id` is provided, in which case we - * use the `date` of that transaction. Required otherwise. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun date(): Optional = date.getOptional("date") - - /** - * The identifier of the Transaction related to this entry set, if any. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") - - /** - * Returns the raw JSON value of [entries]. - * - * Unlike [entries], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("entries") @ExcludeMissing fun _entries(): JsonField> = entries - - /** - * Returns the raw JSON value of [date]. - * - * Unlike [date], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("date") @ExcludeMissing fun _date(): JsonField = date - - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId - - @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 - * .entries() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var entries: JsonField>? = null - private var date: JsonField = JsonMissing.of() - private var transactionId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - entries = body.entries.map { it.toMutableList() } - date = body.date - transactionId = body.transactionId - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The bookkeeping entries. */ - fun entries(entries: List) = entries(JsonField.of(entries)) - - /** - * Sets [Builder.entries] to an arbitrary JSON value. - * - * You should usually call [Builder.entries] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun entries(entries: JsonField>) = apply { - this.entries = entries.map { it.toMutableList() } - } - - /** - * Adds a single [Entry] to [entries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEntry(entry: Entry) = apply { - entries = - (entries ?: JsonField.of(mutableListOf())).also { - checkKnown("entries", it).add(entry) - } - } - - /** - * The date of the transaction. Optional if `transaction_id` is provided, in which case - * we use the `date` of that transaction. Required otherwise. - */ - fun date(date: OffsetDateTime) = date(JsonField.of(date)) - - /** - * Sets [Builder.date] to an arbitrary JSON value. - * - * You should usually call [Builder.date] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun date(date: JsonField) = apply { this.date = date } - - /** The identifier of the Transaction related to this entry set, if any. */ - fun transactionId(transactionId: String) = transactionId(JsonField.of(transactionId)) - - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - 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 - * .entries() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("entries", entries).map { it.toImmutable() }, - date, - transactionId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - entries().forEach { it.validate() } - date() - transactionId() - 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 = - (entries.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (date.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - entries == other.entries && - date == other.date && - transactionId == other.transactionId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(entries, date, transactionId, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{entries=$entries, date=$date, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } - - class Entry - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountId: JsonField, - private val amount: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_id") - @ExcludeMissing - accountId: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - ) : this(accountId, amount, mutableMapOf()) - - /** - * The identifier for the Bookkeeping Account impacted by this entry. - * - * @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") - - /** - * The entry amount in the minor unit of the account currency. For dollars, for example, - * this is cents. Debit entries have positive amounts; credit entries have negative amounts. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * 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 - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @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 [Entry]. - * - * The following fields are required: - * ```java - * .accountId() - * .amount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Entry]. */ - class Builder internal constructor() { - - private var accountId: JsonField? = null - private var amount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(entry: Entry) = apply { - accountId = entry.accountId - amount = entry.amount - additionalProperties = entry.additionalProperties.toMutableMap() - } - - /** The identifier for the Bookkeeping Account impacted by this entry. */ - 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 } - - /** - * The entry amount in the minor unit of the account currency. For dollars, for example, - * this is cents. Debit entries have positive amounts; credit entries have negative - * amounts. - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - 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 [Entry]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountId() - * .amount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Entry = - Entry( - checkRequired("accountId", accountId), - checkRequired("amount", amount), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Entry = apply { - if (validated) { - return@apply - } - - accountId() - amount() - 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) + - (if (amount.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Entry && - accountId == other.accountId && - amount == other.amount && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(accountId, amount, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Entry{accountId=$accountId, amount=$amount, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingEntrySetCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingEntrySetCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt deleted file mode 100644 index daaa7cd7d..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPage.kt +++ /dev/null @@ -1,135 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -import com.increase.api.core.AutoPager -import com.increase.api.core.Page -import com.increase.api.core.checkRequired -import com.increase.api.services.blocking.BookkeepingEntrySetService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see BookkeepingEntrySetService.list */ -class BookkeepingEntrySetListPage -private constructor( - private val service: BookkeepingEntrySetService, - private val params: BookkeepingEntrySetListParams, - private val response: BookkeepingEntrySetListPageResponse, -) : Page { - - /** - * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntrySetListPageResponse.data - */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntrySetListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): BookkeepingEntrySetListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): BookkeepingEntrySetListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): BookkeepingEntrySetListParams = params - - /** The response that this page was parsed from. */ - fun response(): BookkeepingEntrySetListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [BookkeepingEntrySetListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySetListPage]. */ - class Builder internal constructor() { - - private var service: BookkeepingEntrySetService? = null - private var params: BookkeepingEntrySetListParams? = null - private var response: BookkeepingEntrySetListPageResponse? = null - - @JvmSynthetic - internal fun from(bookkeepingEntrySetListPage: BookkeepingEntrySetListPage) = apply { - service = bookkeepingEntrySetListPage.service - params = bookkeepingEntrySetListPage.params - response = bookkeepingEntrySetListPage.response - } - - fun service(service: BookkeepingEntrySetService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: BookkeepingEntrySetListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: BookkeepingEntrySetListPageResponse) = apply { - this.response = response - } - - /** - * Returns an immutable instance of [BookkeepingEntrySetListPage]. - * - * 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(): BookkeepingEntrySetListPage = - BookkeepingEntrySetListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingEntrySetListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = - "BookkeepingEntrySetListPage{service=$service, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt deleted file mode 100644 index b7b003f0a..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageAsync.kt +++ /dev/null @@ -1,152 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -import com.increase.api.core.AutoPagerAsync -import com.increase.api.core.PageAsync -import com.increase.api.core.checkRequired -import com.increase.api.services.async.BookkeepingEntrySetServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see BookkeepingEntrySetServiceAsync.list */ -class BookkeepingEntrySetListPageAsync -private constructor( - private val service: BookkeepingEntrySetServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: BookkeepingEntrySetListParams, - private val response: BookkeepingEntrySetListPageResponse, -) : PageAsync { - - /** - * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntrySetListPageResponse.data - */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [BookkeepingEntrySetListPageResponse], but gracefully handles missing data. - * - * @see BookkeepingEntrySetListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): BookkeepingEntrySetListParams { - 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(): BookkeepingEntrySetListParams = params - - /** The response that this page was parsed from. */ - fun response(): BookkeepingEntrySetListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingEntrySetListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySetListPageAsync]. */ - class Builder internal constructor() { - - private var service: BookkeepingEntrySetServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: BookkeepingEntrySetListParams? = null - private var response: BookkeepingEntrySetListPageResponse? = null - - @JvmSynthetic - internal fun from(bookkeepingEntrySetListPageAsync: BookkeepingEntrySetListPageAsync) = - apply { - service = bookkeepingEntrySetListPageAsync.service - streamHandlerExecutor = bookkeepingEntrySetListPageAsync.streamHandlerExecutor - params = bookkeepingEntrySetListPageAsync.params - response = bookkeepingEntrySetListPageAsync.response - } - - fun service(service: BookkeepingEntrySetServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: BookkeepingEntrySetListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: BookkeepingEntrySetListPageResponse) = apply { - this.response = response - } - - /** - * Returns an immutable instance of [BookkeepingEntrySetListPageAsync]. - * - * 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(): BookkeepingEntrySetListPageAsync = - BookkeepingEntrySetListPageAsync( - 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 BookkeepingEntrySetListPageAsync && - 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() = - "BookkeepingEntrySetListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt deleted file mode 100644 index 68583b991..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponse.kt +++ /dev/null @@ -1,247 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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 Bookkeeping Entry Set objects. */ -class BookkeepingEntrySetListPageResponse -@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. Pass this as the `cursor` parameter to retrieve the next - * page of results. If there are no more results, the value will be `null`. - * - * @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 - * [BookkeepingEntrySetListPageResponse]. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySetListPageResponse]. */ - class Builder internal constructor() { - - private var data: JsonField>? = null - private var nextCursor: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - bookkeepingEntrySetListPageResponse: BookkeepingEntrySetListPageResponse - ) = apply { - data = bookkeepingEntrySetListPageResponse.data.map { it.toMutableList() } - nextCursor = bookkeepingEntrySetListPageResponse.nextCursor - additionalProperties = - bookkeepingEntrySetListPageResponse.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 [BookkeepingEntrySet] to [Builder.data]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addData(data: BookkeepingEntrySet) = apply { - this.data = - (this.data ?: JsonField.of(mutableListOf())).also { - checkKnown("data", it).add(data) - } - } - - /** - * A pointer to a place in the list. Pass this as the `cursor` parameter to retrieve the - * next page of results. If there are no more results, the value will be `null`. - */ - 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 [BookkeepingEntrySetListPageResponse]. - * - * 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(): BookkeepingEntrySetListPageResponse = - BookkeepingEntrySetListPageResponse( - checkRequired("data", data).map { it.toImmutable() }, - checkRequired("nextCursor", nextCursor), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookkeepingEntrySetListPageResponse = 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 BookkeepingEntrySetListPageResponse && - 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() = - "BookkeepingEntrySetListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParams.kt deleted file mode 100644 index 343722496..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParams.kt +++ /dev/null @@ -1,271 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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 - -/** List Bookkeeping Entry Sets */ -class BookkeepingEntrySetListParams -private constructor( - private val cursor: String?, - private val idempotencyKey: String?, - private val limit: Long?, - private val transactionId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Return the page of entries after this one. */ - fun cursor(): Optional = Optional.ofNullable(cursor) - - /** - * 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) - - /** Filter to the Bookkeeping Entry Set that maps to this Transaction. */ - fun transactionId(): Optional = Optional.ofNullable(transactionId) - - /** 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(): BookkeepingEntrySetListParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingEntrySetListParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySetListParams]. */ - class Builder internal constructor() { - - private var cursor: String? = null - private var idempotencyKey: String? = null - private var limit: Long? = null - private var transactionId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(bookkeepingEntrySetListParams: BookkeepingEntrySetListParams) = apply { - cursor = bookkeepingEntrySetListParams.cursor - idempotencyKey = bookkeepingEntrySetListParams.idempotencyKey - limit = bookkeepingEntrySetListParams.limit - transactionId = bookkeepingEntrySetListParams.transactionId - additionalHeaders = bookkeepingEntrySetListParams.additionalHeaders.toBuilder() - additionalQueryParams = bookkeepingEntrySetListParams.additionalQueryParams.toBuilder() - } - - /** 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 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()) - - /** Filter to the Bookkeeping Entry Set that maps to this Transaction. */ - fun transactionId(transactionId: String?) = apply { this.transactionId = transactionId } - - /** Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.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 [BookkeepingEntrySetListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): BookkeepingEntrySetListParams = - BookkeepingEntrySetListParams( - cursor, - idempotencyKey, - limit, - transactionId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - cursor?.let { put("cursor", it) } - idempotencyKey?.let { put("idempotency_key", it) } - limit?.let { put("limit", it.toString()) } - transactionId?.let { put("transaction_id", it) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookkeepingEntrySetListParams && - cursor == other.cursor && - idempotencyKey == other.idempotencyKey && - limit == other.limit && - transactionId == other.transactionId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - cursor, - idempotencyKey, - limit, - transactionId, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "BookkeepingEntrySetListParams{cursor=$cursor, idempotencyKey=$idempotencyKey, limit=$limit, transactionId=$transactionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParams.kt deleted file mode 100644 index aac1bbbb7..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParams.kt +++ /dev/null @@ -1,207 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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 Bookkeeping Entry Set */ -class BookkeepingEntrySetRetrieveParams -private constructor( - private val bookkeepingEntrySetId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier of the Bookkeeping Entry Set. */ - fun bookkeepingEntrySetId(): Optional = Optional.ofNullable(bookkeepingEntrySetId) - - /** 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(): BookkeepingEntrySetRetrieveParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [BookkeepingEntrySetRetrieveParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookkeepingEntrySetRetrieveParams]. */ - class Builder internal constructor() { - - private var bookkeepingEntrySetId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(bookkeepingEntrySetRetrieveParams: BookkeepingEntrySetRetrieveParams) = - apply { - bookkeepingEntrySetId = bookkeepingEntrySetRetrieveParams.bookkeepingEntrySetId - additionalHeaders = bookkeepingEntrySetRetrieveParams.additionalHeaders.toBuilder() - additionalQueryParams = - bookkeepingEntrySetRetrieveParams.additionalQueryParams.toBuilder() - } - - /** The identifier of the Bookkeeping Entry Set. */ - fun bookkeepingEntrySetId(bookkeepingEntrySetId: String?) = apply { - this.bookkeepingEntrySetId = bookkeepingEntrySetId - } - - /** - * Alias for calling [Builder.bookkeepingEntrySetId] with - * `bookkeepingEntrySetId.orElse(null)`. - */ - fun bookkeepingEntrySetId(bookkeepingEntrySetId: Optional) = - bookkeepingEntrySetId(bookkeepingEntrySetId.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 [BookkeepingEntrySetRetrieveParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): BookkeepingEntrySetRetrieveParams = - BookkeepingEntrySetRetrieveParams( - bookkeepingEntrySetId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> bookkeepingEntrySetId ?: "" - 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 BookkeepingEntrySetRetrieveParams && - bookkeepingEntrySetId == other.bookkeepingEntrySetId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(bookkeepingEntrySetId, additionalHeaders, additionalQueryParams) - - override fun toString() = - "BookkeepingEntrySetRetrieveParams{bookkeepingEntrySetId=$bookkeepingEntrySetId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsync.kt deleted file mode 100644 index a0a1d3f58..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsync.kt +++ /dev/null @@ -1,264 +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.bookkeepingaccounts.BookkeepingAccount -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountBalanceParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountCreateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListPageAsync -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountUpdateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingBalanceLookup -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface BookkeepingAccountServiceAsync { - - /** - * 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): BookkeepingAccountServiceAsync - - /** Create a Bookkeeping Account */ - fun create(params: BookkeepingAccountCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** Update a Bookkeeping Account */ - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - ): CompletableFuture = - update(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see update */ - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - update( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see update */ - fun update(params: BookkeepingAccountUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) - - /** @see update */ - fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** List Bookkeeping Accounts */ - fun list(): CompletableFuture = - list(BookkeepingAccountListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(BookkeepingAccountListParams.none(), requestOptions) - - /** Retrieve a Bookkeeping Account Balance */ - fun balance(bookkeepingAccountId: String): CompletableFuture = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none()) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - balance( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - ): CompletableFuture = - balance(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see balance */ - fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see balance */ - fun balance( - params: BookkeepingAccountBalanceParams - ): CompletableFuture = balance(params, RequestOptions.none()) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none(), requestOptions) - - /** - * A view of [BookkeepingAccountServiceAsync] 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 - ): BookkeepingAccountServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /bookkeeping_accounts`, but is otherwise the same - * as [BookkeepingAccountServiceAsync.create]. - */ - fun create( - params: BookkeepingAccountCreateParams - ): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `patch /bookkeeping_accounts/{bookkeeping_account_id}`, - * but is otherwise the same as [BookkeepingAccountServiceAsync.update]. - */ - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - ): CompletableFuture> = - update(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see update */ - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - update( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see update */ - fun update( - params: BookkeepingAccountUpdateParams - ): CompletableFuture> = - update(params, RequestOptions.none()) - - /** @see update */ - fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /bookkeeping_accounts`, but is otherwise the same as - * [BookkeepingAccountServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(BookkeepingAccountListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(BookkeepingAccountListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get - * /bookkeeping_accounts/{bookkeeping_account_id}/balance`, but is otherwise the same as - * [BookkeepingAccountServiceAsync.balance]. - */ - fun balance( - bookkeepingAccountId: String - ): CompletableFuture> = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none()) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - balance( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - ): CompletableFuture> = - balance(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see balance */ - fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see balance */ - fun balance( - params: BookkeepingAccountBalanceParams - ): CompletableFuture> = - balance(params, RequestOptions.none()) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncImpl.kt deleted file mode 100644 index 821815ac7..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncImpl.kt +++ /dev/null @@ -1,224 +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.bookkeepingaccounts.BookkeepingAccount -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountBalanceParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountCreateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListPageAsync -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListPageResponse -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountUpdateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingBalanceLookup -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class BookkeepingAccountServiceAsyncImpl -internal constructor(private val clientOptions: ClientOptions) : BookkeepingAccountServiceAsync { - - private val withRawResponse: BookkeepingAccountServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): BookkeepingAccountServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions( - modifier: Consumer - ): BookkeepingAccountServiceAsync = - BookkeepingAccountServiceAsyncImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - override fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /bookkeeping_accounts - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // patch /bookkeeping_accounts/{bookkeeping_account_id} - withRawResponse().update(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: BookkeepingAccountListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /bookkeeping_accounts - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - override fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /bookkeeping_accounts/{bookkeeping_account_id}/balance - withRawResponse().balance(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingAccountServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): BookkeepingAccountServiceAsync.WithRawResponse = - BookkeepingAccountServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts") - .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 updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingAccountId", params.bookkeepingAccountId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.PATCH) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts", params._pathParam(0)) - .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 { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: BookkeepingAccountListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts") - .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 { - BookkeepingAccountListPageAsync.builder() - .service(BookkeepingAccountServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - - private val balanceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingAccountId", params.bookkeepingAccountId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts", params._pathParam(0), "balance") - .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 { balanceHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsync.kt deleted file mode 100644 index 1320c427f..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsync.kt +++ /dev/null @@ -1,170 +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.bookkeepingentries.BookkeepingEntry -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListPageAsync -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListParams -import com.increase.api.models.bookkeepingentries.BookkeepingEntryRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface BookkeepingEntryServiceAsync { - - /** - * 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): BookkeepingEntryServiceAsync - - /** Retrieve a Bookkeeping Entry */ - fun retrieve(bookkeepingEntryId: String): CompletableFuture = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - retrieve(params.toBuilder().bookkeepingEntryId(bookkeepingEntryId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - ): CompletableFuture = - retrieve(bookkeepingEntryId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see retrieve */ - fun retrieve(params: BookkeepingEntryRetrieveParams): CompletableFuture = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none(), requestOptions) - - /** List Bookkeeping Entries */ - fun list(): CompletableFuture = - list(BookkeepingEntryListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(BookkeepingEntryListParams.none(), requestOptions) - - /** - * A view of [BookkeepingEntryServiceAsync] 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 - ): BookkeepingEntryServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `get /bookkeeping_entries/{bookkeeping_entry_id}`, but is - * otherwise the same as [BookkeepingEntryServiceAsync.retrieve]. - */ - fun retrieve( - bookkeepingEntryId: String - ): CompletableFuture> = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - retrieve( - params.toBuilder().bookkeepingEntryId(bookkeepingEntryId).build(), - requestOptions, - ) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - ): CompletableFuture> = - retrieve(bookkeepingEntryId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntryRetrieveParams - ): CompletableFuture> = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /bookkeeping_entries`, but is otherwise the same as - * [BookkeepingEntryServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(BookkeepingEntryListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(BookkeepingEntryListParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncImpl.kt deleted file mode 100644 index b4577b894..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncImpl.kt +++ /dev/null @@ -1,139 +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.parseable -import com.increase.api.core.prepareAsync -import com.increase.api.models.bookkeepingentries.BookkeepingEntry -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListPageAsync -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListPageResponse -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListParams -import com.increase.api.models.bookkeepingentries.BookkeepingEntryRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class BookkeepingEntryServiceAsyncImpl -internal constructor(private val clientOptions: ClientOptions) : BookkeepingEntryServiceAsync { - - private val withRawResponse: BookkeepingEntryServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): BookkeepingEntryServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntryServiceAsync = - BookkeepingEntryServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /bookkeeping_entries/{bookkeeping_entry_id} - withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: BookkeepingEntryListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /bookkeeping_entries - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingEntryServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntryServiceAsync.WithRawResponse = - BookkeepingEntryServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingEntryId", params.bookkeepingEntryId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entries", 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: BookkeepingEntryListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entries") - .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 { - BookkeepingEntryListPageAsync.builder() - .service(BookkeepingEntryServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsync.kt deleted file mode 100644 index 166d683a0..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsync.kt +++ /dev/null @@ -1,204 +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.bookkeepingentrysets.BookkeepingEntrySet -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetCreateParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListPageAsync -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface BookkeepingEntrySetServiceAsync { - - /** - * 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): BookkeepingEntrySetServiceAsync - - /** Create a Bookkeeping Entry Set */ - fun create(params: BookkeepingEntrySetCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** Retrieve a Bookkeeping Entry Set */ - fun retrieve(bookkeepingEntrySetId: String): CompletableFuture = - retrieve(bookkeepingEntrySetId, BookkeepingEntrySetRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - retrieve( - params.toBuilder().bookkeepingEntrySetId(bookkeepingEntrySetId).build(), - requestOptions, - ) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - ): CompletableFuture = - retrieve(bookkeepingEntrySetId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntrySetRetrieveParams - ): CompletableFuture = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - retrieve(bookkeepingEntrySetId, BookkeepingEntrySetRetrieveParams.none(), requestOptions) - - /** List Bookkeeping Entry Sets */ - fun list(): CompletableFuture = - list(BookkeepingEntrySetListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(BookkeepingEntrySetListParams.none(), requestOptions) - - /** - * A view of [BookkeepingEntrySetServiceAsync] 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 - ): BookkeepingEntrySetServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /bookkeeping_entry_sets`, but is otherwise the same - * as [BookkeepingEntrySetServiceAsync.create]. - */ - fun create( - params: BookkeepingEntrySetCreateParams - ): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /bookkeeping_entry_sets/{bookkeeping_entry_set_id}`, - * but is otherwise the same as [BookkeepingEntrySetServiceAsync.retrieve]. - */ - fun retrieve( - bookkeepingEntrySetId: String - ): CompletableFuture> = - retrieve(bookkeepingEntrySetId, BookkeepingEntrySetRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - retrieve( - params.toBuilder().bookkeepingEntrySetId(bookkeepingEntrySetId).build(), - requestOptions, - ) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - ): CompletableFuture> = - retrieve(bookkeepingEntrySetId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntrySetRetrieveParams - ): CompletableFuture> = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - retrieve( - bookkeepingEntrySetId, - BookkeepingEntrySetRetrieveParams.none(), - requestOptions, - ) - - /** - * Returns a raw HTTP response for `get /bookkeeping_entry_sets`, but is otherwise the same - * as [BookkeepingEntrySetServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(BookkeepingEntrySetListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(BookkeepingEntrySetListParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncImpl.kt deleted file mode 100644 index 9531c2895..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncImpl.kt +++ /dev/null @@ -1,182 +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.bookkeepingentrysets.BookkeepingEntrySet -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetCreateParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListPageAsync -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListPageResponse -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class BookkeepingEntrySetServiceAsyncImpl -internal constructor(private val clientOptions: ClientOptions) : BookkeepingEntrySetServiceAsync { - - private val withRawResponse: BookkeepingEntrySetServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): BookkeepingEntrySetServiceAsync.WithRawResponse = - withRawResponse - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntrySetServiceAsync = - BookkeepingEntrySetServiceAsyncImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - override fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /bookkeeping_entry_sets - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun retrieve( - params: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /bookkeeping_entry_sets/{bookkeeping_entry_set_id} - withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: BookkeepingEntrySetListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /bookkeeping_entry_sets - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingEntrySetServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntrySetServiceAsync.WithRawResponse = - BookkeepingEntrySetServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entry_sets") - .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: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingEntrySetId", params.bookkeepingEntrySetId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entry_sets", 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: BookkeepingEntrySetListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entry_sets") - .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 { - BookkeepingEntrySetListPageAsync.builder() - .service(BookkeepingEntrySetServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountService.kt deleted file mode 100644 index 4a579385e..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountService.kt +++ /dev/null @@ -1,266 +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.bookkeepingaccounts.BookkeepingAccount -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountBalanceParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountCreateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListPage -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountUpdateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingBalanceLookup -import java.util.function.Consumer - -interface BookkeepingAccountService { - - /** - * 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): BookkeepingAccountService - - /** Create a Bookkeeping Account */ - fun create(params: BookkeepingAccountCreateParams): BookkeepingAccount = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingAccount - - /** Update a Bookkeeping Account */ - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - ): BookkeepingAccount = update(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see update */ - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingAccount = - update( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see update */ - fun update(params: BookkeepingAccountUpdateParams): BookkeepingAccount = - update(params, RequestOptions.none()) - - /** @see update */ - fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingAccount - - /** List Bookkeeping Accounts */ - fun list(): BookkeepingAccountListPage = list(BookkeepingAccountListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingAccountListPage - - /** @see list */ - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none() - ): BookkeepingAccountListPage = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): BookkeepingAccountListPage = - list(BookkeepingAccountListParams.none(), requestOptions) - - /** Retrieve a Bookkeeping Account Balance */ - fun balance(bookkeepingAccountId: String): BookkeepingBalanceLookup = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none()) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingBalanceLookup = - balance( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - ): BookkeepingBalanceLookup = balance(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see balance */ - fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingBalanceLookup - - /** @see balance */ - fun balance(params: BookkeepingAccountBalanceParams): BookkeepingBalanceLookup = - balance(params, RequestOptions.none()) - - /** @see balance */ - fun balance( - bookkeepingAccountId: String, - requestOptions: RequestOptions, - ): BookkeepingBalanceLookup = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none(), requestOptions) - - /** - * A view of [BookkeepingAccountService] 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 - ): BookkeepingAccountService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /bookkeeping_accounts`, but is otherwise the same - * as [BookkeepingAccountService.create]. - */ - @MustBeClosed - fun create(params: BookkeepingAccountCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `patch /bookkeeping_accounts/{bookkeeping_account_id}`, - * but is otherwise the same as [BookkeepingAccountService.update]. - */ - @MustBeClosed - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - ): HttpResponseFor = - update(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see update */ - @MustBeClosed - fun update( - bookkeepingAccountId: String, - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - update( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see update */ - @MustBeClosed - fun update(params: BookkeepingAccountUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) - - /** @see update */ - @MustBeClosed - fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /bookkeeping_accounts`, but is otherwise the same as - * [BookkeepingAccountService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = - list(BookkeepingAccountListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: BookkeepingAccountListParams = BookkeepingAccountListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(BookkeepingAccountListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get - * /bookkeeping_accounts/{bookkeeping_account_id}/balance`, but is otherwise the same as - * [BookkeepingAccountService.balance]. - */ - @MustBeClosed - fun balance(bookkeepingAccountId: String): HttpResponseFor = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none()) - - /** @see balance */ - @MustBeClosed - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - balance( - params.toBuilder().bookkeepingAccountId(bookkeepingAccountId).build(), - requestOptions, - ) - - /** @see balance */ - @MustBeClosed - fun balance( - bookkeepingAccountId: String, - params: BookkeepingAccountBalanceParams = BookkeepingAccountBalanceParams.none(), - ): HttpResponseFor = - balance(bookkeepingAccountId, params, RequestOptions.none()) - - /** @see balance */ - @MustBeClosed - fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see balance */ - @MustBeClosed - fun balance( - params: BookkeepingAccountBalanceParams - ): HttpResponseFor = balance(params, RequestOptions.none()) - - /** @see balance */ - @MustBeClosed - fun balance( - bookkeepingAccountId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - balance(bookkeepingAccountId, BookkeepingAccountBalanceParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceImpl.kt deleted file mode 100644 index 6517520a9..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceImpl.kt +++ /dev/null @@ -1,206 +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.bookkeepingaccounts.BookkeepingAccount -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountBalanceParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountCreateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListPage -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListPageResponse -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountListParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountUpdateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingBalanceLookup -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class BookkeepingAccountServiceImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingAccountService { - - private val withRawResponse: BookkeepingAccountService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): BookkeepingAccountService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): BookkeepingAccountService = - BookkeepingAccountServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions, - ): BookkeepingAccount = - // post /bookkeeping_accounts - withRawResponse().create(params, requestOptions).parse() - - override fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions, - ): BookkeepingAccount = - // patch /bookkeeping_accounts/{bookkeeping_account_id} - withRawResponse().update(params, requestOptions).parse() - - override fun list( - params: BookkeepingAccountListParams, - requestOptions: RequestOptions, - ): BookkeepingAccountListPage = - // get /bookkeeping_accounts - withRawResponse().list(params, requestOptions).parse() - - override fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions, - ): BookkeepingBalanceLookup = - // get /bookkeeping_accounts/{bookkeeping_account_id}/balance - withRawResponse().balance(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingAccountService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): BookkeepingAccountService.WithRawResponse = - BookkeepingAccountServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: BookkeepingAccountCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts") - .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 updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun update( - params: BookkeepingAccountUpdateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingAccountId", params.bookkeepingAccountId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.PATCH) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts", params._pathParam(0)) - .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 { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: BookkeepingAccountListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts") - .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 { - BookkeepingAccountListPage.builder() - .service(BookkeepingAccountServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - - private val balanceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun balance( - params: BookkeepingAccountBalanceParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingAccountId", params.bookkeepingAccountId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_accounts", params._pathParam(0), "balance") - .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 { balanceHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryService.kt deleted file mode 100644 index c4503f12b..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryService.kt +++ /dev/null @@ -1,168 +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.bookkeepingentries.BookkeepingEntry -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListPage -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListParams -import com.increase.api.models.bookkeepingentries.BookkeepingEntryRetrieveParams -import java.util.function.Consumer - -interface BookkeepingEntryService { - - /** - * 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): BookkeepingEntryService - - /** Retrieve a Bookkeeping Entry */ - fun retrieve(bookkeepingEntryId: String): BookkeepingEntry = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntry = - retrieve(params.toBuilder().bookkeepingEntryId(bookkeepingEntryId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - ): BookkeepingEntry = retrieve(bookkeepingEntryId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntry - - /** @see retrieve */ - fun retrieve(params: BookkeepingEntryRetrieveParams): BookkeepingEntry = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(bookkeepingEntryId: String, requestOptions: RequestOptions): BookkeepingEntry = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none(), requestOptions) - - /** List Bookkeeping Entries */ - fun list(): BookkeepingEntryListPage = list(BookkeepingEntryListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntryListPage - - /** @see list */ - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none() - ): BookkeepingEntryListPage = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): BookkeepingEntryListPage = - list(BookkeepingEntryListParams.none(), requestOptions) - - /** - * A view of [BookkeepingEntryService] 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 - ): BookkeepingEntryService.WithRawResponse - - /** - * Returns a raw HTTP response for `get /bookkeeping_entries/{bookkeeping_entry_id}`, but is - * otherwise the same as [BookkeepingEntryService.retrieve]. - */ - @MustBeClosed - fun retrieve(bookkeepingEntryId: String): HttpResponseFor = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - retrieve( - params.toBuilder().bookkeepingEntryId(bookkeepingEntryId).build(), - requestOptions, - ) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - bookkeepingEntryId: String, - params: BookkeepingEntryRetrieveParams = BookkeepingEntryRetrieveParams.none(), - ): HttpResponseFor = - retrieve(bookkeepingEntryId, params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see retrieve */ - @MustBeClosed - fun retrieve(params: BookkeepingEntryRetrieveParams): HttpResponseFor = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - bookkeepingEntryId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - retrieve(bookkeepingEntryId, BookkeepingEntryRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /bookkeeping_entries`, but is otherwise the same as - * [BookkeepingEntryService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = - list(BookkeepingEntryListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: BookkeepingEntryListParams = BookkeepingEntryListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(BookkeepingEntryListParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceImpl.kt deleted file mode 100644 index 7cfee297e..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceImpl.kt +++ /dev/null @@ -1,129 +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.parseable -import com.increase.api.core.prepare -import com.increase.api.models.bookkeepingentries.BookkeepingEntry -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListPage -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListPageResponse -import com.increase.api.models.bookkeepingentries.BookkeepingEntryListParams -import com.increase.api.models.bookkeepingentries.BookkeepingEntryRetrieveParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class BookkeepingEntryServiceImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingEntryService { - - private val withRawResponse: BookkeepingEntryService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): BookkeepingEntryService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): BookkeepingEntryService = - BookkeepingEntryServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions, - ): BookkeepingEntry = - // get /bookkeeping_entries/{bookkeeping_entry_id} - withRawResponse().retrieve(params, requestOptions).parse() - - override fun list( - params: BookkeepingEntryListParams, - requestOptions: RequestOptions, - ): BookkeepingEntryListPage = - // get /bookkeeping_entries - withRawResponse().list(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingEntryService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntryService.WithRawResponse = - BookkeepingEntryServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: BookkeepingEntryRetrieveParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingEntryId", params.bookkeepingEntryId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entries", 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: BookkeepingEntryListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entries") - .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 { - BookkeepingEntryListPage.builder() - .service(BookkeepingEntryServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetService.kt deleted file mode 100644 index 04ffd9016..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetService.kt +++ /dev/null @@ -1,205 +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.bookkeepingentrysets.BookkeepingEntrySet -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetCreateParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListPage -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetRetrieveParams -import java.util.function.Consumer - -interface BookkeepingEntrySetService { - - /** - * 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): BookkeepingEntrySetService - - /** Create a Bookkeeping Entry Set */ - fun create(params: BookkeepingEntrySetCreateParams): BookkeepingEntrySet = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntrySet - - /** Retrieve a Bookkeeping Entry Set */ - fun retrieve(bookkeepingEntrySetId: String): BookkeepingEntrySet = - retrieve(bookkeepingEntrySetId, BookkeepingEntrySetRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntrySet = - retrieve( - params.toBuilder().bookkeepingEntrySetId(bookkeepingEntrySetId).build(), - requestOptions, - ) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - ): BookkeepingEntrySet = retrieve(bookkeepingEntrySetId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntrySet - - /** @see retrieve */ - fun retrieve(params: BookkeepingEntrySetRetrieveParams): BookkeepingEntrySet = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - bookkeepingEntrySetId: String, - requestOptions: RequestOptions, - ): BookkeepingEntrySet = - retrieve(bookkeepingEntrySetId, BookkeepingEntrySetRetrieveParams.none(), requestOptions) - - /** List Bookkeeping Entry Sets */ - fun list(): BookkeepingEntrySetListPage = list(BookkeepingEntrySetListParams.none()) - - /** @see list */ - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): BookkeepingEntrySetListPage - - /** @see list */ - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none() - ): BookkeepingEntrySetListPage = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): BookkeepingEntrySetListPage = - list(BookkeepingEntrySetListParams.none(), requestOptions) - - /** - * A view of [BookkeepingEntrySetService] 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 - ): BookkeepingEntrySetService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /bookkeeping_entry_sets`, but is otherwise the same - * as [BookkeepingEntrySetService.create]. - */ - @MustBeClosed - fun create(params: BookkeepingEntrySetCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /bookkeeping_entry_sets/{bookkeeping_entry_set_id}`, - * but is otherwise the same as [BookkeepingEntrySetService.retrieve]. - */ - @MustBeClosed - fun retrieve(bookkeepingEntrySetId: String): HttpResponseFor = - retrieve(bookkeepingEntrySetId, BookkeepingEntrySetRetrieveParams.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - retrieve( - params.toBuilder().bookkeepingEntrySetId(bookkeepingEntrySetId).build(), - requestOptions, - ) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - bookkeepingEntrySetId: String, - params: BookkeepingEntrySetRetrieveParams = BookkeepingEntrySetRetrieveParams.none(), - ): HttpResponseFor = - retrieve(bookkeepingEntrySetId, params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: BookkeepingEntrySetRetrieveParams - ): HttpResponseFor = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - bookkeepingEntrySetId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - retrieve( - bookkeepingEntrySetId, - BookkeepingEntrySetRetrieveParams.none(), - requestOptions, - ) - - /** - * Returns a raw HTTP response for `get /bookkeeping_entry_sets`, but is otherwise the same - * as [BookkeepingEntrySetService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = - list(BookkeepingEntrySetListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: BookkeepingEntrySetListParams = BookkeepingEntrySetListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(BookkeepingEntrySetListParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceImpl.kt deleted file mode 100644 index 27ba27ccf..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceImpl.kt +++ /dev/null @@ -1,168 +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.bookkeepingentrysets.BookkeepingEntrySet -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetCreateParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListPage -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListPageResponse -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetListParams -import com.increase.api.models.bookkeepingentrysets.BookkeepingEntrySetRetrieveParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class BookkeepingEntrySetServiceImpl -internal constructor(private val clientOptions: ClientOptions) : BookkeepingEntrySetService { - - private val withRawResponse: BookkeepingEntrySetService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): BookkeepingEntrySetService.WithRawResponse = withRawResponse - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntrySetService = - BookkeepingEntrySetServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions, - ): BookkeepingEntrySet = - // post /bookkeeping_entry_sets - withRawResponse().create(params, requestOptions).parse() - - override fun retrieve( - params: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions, - ): BookkeepingEntrySet = - // get /bookkeeping_entry_sets/{bookkeeping_entry_set_id} - withRawResponse().retrieve(params, requestOptions).parse() - - override fun list( - params: BookkeepingEntrySetListParams, - requestOptions: RequestOptions, - ): BookkeepingEntrySetListPage = - // get /bookkeeping_entry_sets - withRawResponse().list(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BookkeepingEntrySetService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): BookkeepingEntrySetService.WithRawResponse = - BookkeepingEntrySetServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: BookkeepingEntrySetCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entry_sets") - .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: BookkeepingEntrySetRetrieveParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("bookkeepingEntrySetId", params.bookkeepingEntrySetId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entry_sets", 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: BookkeepingEntrySetListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("bookkeeping_entry_sets") - .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 { - BookkeepingEntrySetListPage.builder() - .service(BookkeepingEntrySetServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParamsTest.kt deleted file mode 100644 index ae4af2d3d..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountBalanceParamsTest.kt +++ /dev/null @@ -1,57 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -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 BookkeepingAccountBalanceParamsTest { - - @Test - fun create() { - BookkeepingAccountBalanceParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .atTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - } - - @Test - fun pathParams() { - val params = - BookkeepingAccountBalanceParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .build() - - assertThat(params._pathParam(0)).isEqualTo("bookkeeping_account_e37p1f1iuocw5intf35v") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - BookkeepingAccountBalanceParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .atTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo(QueryParams.builder().put("at_time", "2019-12-27T18:11:19.117Z").build()) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = - BookkeepingAccountBalanceParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParamsTest.kt deleted file mode 100644 index 6921a9ebf..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountCreateParamsTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingAccountCreateParamsTest { - - @Test - fun create() { - BookkeepingAccountCreateParams.builder() - .name("New Account!") - .accountId("account_id") - .complianceCategory(BookkeepingAccountCreateParams.ComplianceCategory.COMMINGLED_CASH) - .entityId("entity_id") - .build() - } - - @Test - fun body() { - val params = - BookkeepingAccountCreateParams.builder() - .name("New Account!") - .accountId("account_id") - .complianceCategory( - BookkeepingAccountCreateParams.ComplianceCategory.COMMINGLED_CASH - ) - .entityId("entity_id") - .build() - - val body = params._body() - - assertThat(body.name()).isEqualTo("New Account!") - assertThat(body.accountId()).contains("account_id") - assertThat(body.complianceCategory()) - .contains(BookkeepingAccountCreateParams.ComplianceCategory.COMMINGLED_CASH) - assertThat(body.entityId()).contains("entity_id") - } - - @Test - fun bodyWithoutOptionalFields() { - val params = BookkeepingAccountCreateParams.builder().name("New Account!").build() - - val body = params._body() - - assertThat(body.name()).isEqualTo("New Account!") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponseTest.kt deleted file mode 100644 index c9a4ec90a..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListPageResponseTest.kt +++ /dev/null @@ -1,73 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingAccountListPageResponseTest { - - @Test - fun create() { - val bookkeepingAccountListPageResponse = - BookkeepingAccountListPageResponse.builder() - .addData( - BookkeepingAccount.builder() - .id("bookkeeping_account_e37p1f1iuocw5intf35v") - .accountId(null) - .complianceCategory(BookkeepingAccount.ComplianceCategory.CUSTOMER_BALANCE) - .entityId("entity_n8y8tnk2p9339ti393yi") - .idempotencyKey(null) - .name("John Doe Balance") - .type(BookkeepingAccount.Type.BOOKKEEPING_ACCOUNT) - .build() - ) - .nextCursor("v57w5d") - .build() - - assertThat(bookkeepingAccountListPageResponse.data()) - .containsExactly( - BookkeepingAccount.builder() - .id("bookkeeping_account_e37p1f1iuocw5intf35v") - .accountId(null) - .complianceCategory(BookkeepingAccount.ComplianceCategory.CUSTOMER_BALANCE) - .entityId("entity_n8y8tnk2p9339ti393yi") - .idempotencyKey(null) - .name("John Doe Balance") - .type(BookkeepingAccount.Type.BOOKKEEPING_ACCOUNT) - .build() - ) - assertThat(bookkeepingAccountListPageResponse.nextCursor()).contains("v57w5d") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingAccountListPageResponse = - BookkeepingAccountListPageResponse.builder() - .addData( - BookkeepingAccount.builder() - .id("bookkeeping_account_e37p1f1iuocw5intf35v") - .accountId(null) - .complianceCategory(BookkeepingAccount.ComplianceCategory.CUSTOMER_BALANCE) - .entityId("entity_n8y8tnk2p9339ti393yi") - .idempotencyKey(null) - .name("John Doe Balance") - .type(BookkeepingAccount.Type.BOOKKEEPING_ACCOUNT) - .build() - ) - .nextCursor("v57w5d") - .build() - - val roundtrippedBookkeepingAccountListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingAccountListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingAccountListPageResponse) - .isEqualTo(bookkeepingAccountListPageResponse) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParamsTest.kt deleted file mode 100644 index cf45c2029..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountListParamsTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.increase.api.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingAccountListParamsTest { - - @Test - fun create() { - BookkeepingAccountListParams.builder() - .cursor("cursor") - .idempotencyKey("x") - .limit(1L) - .build() - } - - @Test - fun queryParams() { - val params = - BookkeepingAccountListParams.builder() - .cursor("cursor") - .idempotencyKey("x") - .limit(1L) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("cursor", "cursor") - .put("idempotency_key", "x") - .put("limit", "1") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = BookkeepingAccountListParams.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/bookkeepingaccounts/BookkeepingAccountTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountTest.kt deleted file mode 100644 index 280e0b9bb..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountTest.kt +++ /dev/null @@ -1,57 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingAccountTest { - - @Test - fun create() { - val bookkeepingAccount = - BookkeepingAccount.builder() - .id("bookkeeping_account_e37p1f1iuocw5intf35v") - .accountId(null) - .complianceCategory(BookkeepingAccount.ComplianceCategory.CUSTOMER_BALANCE) - .entityId("entity_n8y8tnk2p9339ti393yi") - .idempotencyKey(null) - .name("John Doe Balance") - .type(BookkeepingAccount.Type.BOOKKEEPING_ACCOUNT) - .build() - - assertThat(bookkeepingAccount.id()).isEqualTo("bookkeeping_account_e37p1f1iuocw5intf35v") - assertThat(bookkeepingAccount.accountId()).isEmpty - assertThat(bookkeepingAccount.complianceCategory()) - .contains(BookkeepingAccount.ComplianceCategory.CUSTOMER_BALANCE) - assertThat(bookkeepingAccount.entityId()).contains("entity_n8y8tnk2p9339ti393yi") - assertThat(bookkeepingAccount.idempotencyKey()).isEmpty - assertThat(bookkeepingAccount.name()).isEqualTo("John Doe Balance") - assertThat(bookkeepingAccount.type()).isEqualTo(BookkeepingAccount.Type.BOOKKEEPING_ACCOUNT) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingAccount = - BookkeepingAccount.builder() - .id("bookkeeping_account_e37p1f1iuocw5intf35v") - .accountId(null) - .complianceCategory(BookkeepingAccount.ComplianceCategory.CUSTOMER_BALANCE) - .entityId("entity_n8y8tnk2p9339ti393yi") - .idempotencyKey(null) - .name("John Doe Balance") - .type(BookkeepingAccount.Type.BOOKKEEPING_ACCOUNT) - .build() - - val roundtrippedBookkeepingAccount = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingAccount), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingAccount).isEqualTo(bookkeepingAccount) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParamsTest.kt deleted file mode 100644 index 9a39e4dc2..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingAccountUpdateParamsTest.kt +++ /dev/null @@ -1,43 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingAccountUpdateParamsTest { - - @Test - fun create() { - BookkeepingAccountUpdateParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .name("Deprecated Account") - .build() - } - - @Test - fun pathParams() { - val params = - BookkeepingAccountUpdateParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .name("Deprecated Account") - .build() - - assertThat(params._pathParam(0)).isEqualTo("bookkeeping_account_e37p1f1iuocw5intf35v") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun body() { - val params = - BookkeepingAccountUpdateParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .name("Deprecated Account") - .build() - - val body = params._body() - - assertThat(body.name()).isEqualTo("Deprecated Account") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookupTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookupTest.kt deleted file mode 100644 index d79f1c6b9..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingaccounts/BookkeepingBalanceLookupTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingaccounts - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingBalanceLookupTest { - - @Test - fun create() { - val bookkeepingBalanceLookup = - BookkeepingBalanceLookup.builder() - .balance(100L) - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .type(BookkeepingBalanceLookup.Type.BOOKKEEPING_BALANCE_LOOKUP) - .build() - - assertThat(bookkeepingBalanceLookup.balance()).isEqualTo(100L) - assertThat(bookkeepingBalanceLookup.bookkeepingAccountId()) - .isEqualTo("bookkeeping_account_e37p1f1iuocw5intf35v") - assertThat(bookkeepingBalanceLookup.type()) - .isEqualTo(BookkeepingBalanceLookup.Type.BOOKKEEPING_BALANCE_LOOKUP) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingBalanceLookup = - BookkeepingBalanceLookup.builder() - .balance(100L) - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .type(BookkeepingBalanceLookup.Type.BOOKKEEPING_BALANCE_LOOKUP) - .build() - - val roundtrippedBookkeepingBalanceLookup = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingBalanceLookup), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingBalanceLookup).isEqualTo(bookkeepingBalanceLookup) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponseTest.kt deleted file mode 100644 index 78015ad43..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListPageResponseTest.kt +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -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 BookkeepingEntryListPageResponseTest { - - @Test - fun create() { - val bookkeepingEntryListPageResponse = - BookkeepingEntryListPageResponse.builder() - .addData( - BookkeepingEntry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .type(BookkeepingEntry.Type.BOOKKEEPING_ENTRY) - .build() - ) - .nextCursor("v57w5d") - .build() - - assertThat(bookkeepingEntryListPageResponse.data()) - .containsExactly( - BookkeepingEntry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .type(BookkeepingEntry.Type.BOOKKEEPING_ENTRY) - .build() - ) - assertThat(bookkeepingEntryListPageResponse.nextCursor()).contains("v57w5d") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingEntryListPageResponse = - BookkeepingEntryListPageResponse.builder() - .addData( - BookkeepingEntry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .type(BookkeepingEntry.Type.BOOKKEEPING_ENTRY) - .build() - ) - .nextCursor("v57w5d") - .build() - - val roundtrippedBookkeepingEntryListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingEntryListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingEntryListPageResponse) - .isEqualTo(bookkeepingEntryListPageResponse) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParamsTest.kt deleted file mode 100644 index be985ca3f..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryListParamsTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -import com.increase.api.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingEntryListParamsTest { - - @Test - fun create() { - BookkeepingEntryListParams.builder() - .accountId("account_id") - .cursor("cursor") - .limit(1L) - .build() - } - - @Test - fun queryParams() { - val params = - BookkeepingEntryListParams.builder() - .accountId("account_id") - .cursor("cursor") - .limit(1L) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("account_id", "account_id") - .put("cursor", "cursor") - .put("limit", "1") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = BookkeepingEntryListParams.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/bookkeepingentries/BookkeepingEntryRetrieveParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParamsTest.kt deleted file mode 100644 index 233672f0d..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryRetrieveParamsTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingEntryRetrieveParamsTest { - - @Test - fun create() { - BookkeepingEntryRetrieveParams.builder() - .bookkeepingEntryId("bookkeeping_entry_ctjpajsj3ks2blx10375") - .build() - } - - @Test - fun pathParams() { - val params = - BookkeepingEntryRetrieveParams.builder() - .bookkeepingEntryId("bookkeeping_entry_ctjpajsj3ks2blx10375") - .build() - - assertThat(params._pathParam(0)).isEqualTo("bookkeeping_entry_ctjpajsj3ks2blx10375") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryTest.kt deleted file mode 100644 index 62b314e26..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentries/BookkeepingEntryTest.kt +++ /dev/null @@ -1,57 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentries - -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 BookkeepingEntryTest { - - @Test - fun create() { - val bookkeepingEntry = - BookkeepingEntry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .type(BookkeepingEntry.Type.BOOKKEEPING_ENTRY) - .build() - - assertThat(bookkeepingEntry.id()).isEqualTo("bookkeeping_entry_ctjpajsj3ks2blx10375") - assertThat(bookkeepingEntry.accountId()) - .isEqualTo("bookkeeping_account_e37p1f1iuocw5intf35v") - assertThat(bookkeepingEntry.amount()).isEqualTo(1750L) - assertThat(bookkeepingEntry.createdAt()) - .isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - assertThat(bookkeepingEntry.entrySetId()) - .isEqualTo("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - assertThat(bookkeepingEntry.type()).isEqualTo(BookkeepingEntry.Type.BOOKKEEPING_ENTRY) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingEntry = - BookkeepingEntry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .entrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .type(BookkeepingEntry.Type.BOOKKEEPING_ENTRY) - .build() - - val roundtrippedBookkeepingEntry = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingEntry), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingEntry).isEqualTo(bookkeepingEntry) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParamsTest.kt deleted file mode 100644 index bc2a597ab..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetCreateParamsTest.kt +++ /dev/null @@ -1,100 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingEntrySetCreateParamsTest { - - @Test - fun create() { - BookkeepingEntrySetCreateParams.builder() - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build() - ) - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build() - ) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .transactionId("transaction_uyrp7fld2ium70oa7oi") - .build() - } - - @Test - fun body() { - val params = - BookkeepingEntrySetCreateParams.builder() - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build() - ) - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build() - ) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .transactionId("transaction_uyrp7fld2ium70oa7oi") - .build() - - val body = params._body() - - assertThat(body.entries()) - .containsExactly( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build(), - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build(), - ) - assertThat(body.date()).contains(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - assertThat(body.transactionId()).contains("transaction_uyrp7fld2ium70oa7oi") - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - BookkeepingEntrySetCreateParams.builder() - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build() - ) - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build() - ) - .build() - - val body = params._body() - - assertThat(body.entries()) - .containsExactly( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build(), - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build(), - ) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponseTest.kt deleted file mode 100644 index 2aab9fd20..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListPageResponseTest.kt +++ /dev/null @@ -1,113 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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 BookkeepingEntrySetListPageResponseTest { - - @Test - fun create() { - val bookkeepingEntrySetListPageResponse = - BookkeepingEntrySetListPageResponse.builder() - .addData( - BookkeepingEntrySet.builder() - .id("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .createdAt(OffsetDateTime.parse("2023-02-11T02:11:59Z")) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .build() - ) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(-1750L) - .build() - ) - .idempotencyKey(null) - .transactionId(null) - .type(BookkeepingEntrySet.Type.BOOKKEEPING_ENTRY_SET) - .build() - ) - .nextCursor("v57w5d") - .build() - - assertThat(bookkeepingEntrySetListPageResponse.data()) - .containsExactly( - BookkeepingEntrySet.builder() - .id("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .createdAt(OffsetDateTime.parse("2023-02-11T02:11:59Z")) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .build() - ) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(-1750L) - .build() - ) - .idempotencyKey(null) - .transactionId(null) - .type(BookkeepingEntrySet.Type.BOOKKEEPING_ENTRY_SET) - .build() - ) - assertThat(bookkeepingEntrySetListPageResponse.nextCursor()).contains("v57w5d") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingEntrySetListPageResponse = - BookkeepingEntrySetListPageResponse.builder() - .addData( - BookkeepingEntrySet.builder() - .id("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .createdAt(OffsetDateTime.parse("2023-02-11T02:11:59Z")) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .build() - ) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(-1750L) - .build() - ) - .idempotencyKey(null) - .transactionId(null) - .type(BookkeepingEntrySet.Type.BOOKKEEPING_ENTRY_SET) - .build() - ) - .nextCursor("v57w5d") - .build() - - val roundtrippedBookkeepingEntrySetListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingEntrySetListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingEntrySetListPageResponse) - .isEqualTo(bookkeepingEntrySetListPageResponse) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParamsTest.kt deleted file mode 100644 index 969392e20..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetListParamsTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -import com.increase.api.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingEntrySetListParamsTest { - - @Test - fun create() { - BookkeepingEntrySetListParams.builder() - .cursor("cursor") - .idempotencyKey("x") - .limit(1L) - .transactionId("transaction_id") - .build() - } - - @Test - fun queryParams() { - val params = - BookkeepingEntrySetListParams.builder() - .cursor("cursor") - .idempotencyKey("x") - .limit(1L) - .transactionId("transaction_id") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("cursor", "cursor") - .put("idempotency_key", "x") - .put("limit", "1") - .put("transaction_id", "transaction_id") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = BookkeepingEntrySetListParams.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/bookkeepingentrysets/BookkeepingEntrySetRetrieveParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParamsTest.kt deleted file mode 100644 index deed56022..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetRetrieveParamsTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class BookkeepingEntrySetRetrieveParamsTest { - - @Test - fun create() { - BookkeepingEntrySetRetrieveParams.builder() - .bookkeepingEntrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .build() - } - - @Test - fun pathParams() { - val params = - BookkeepingEntrySetRetrieveParams.builder() - .bookkeepingEntrySetId("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .build() - - assertThat(params._pathParam(0)).isEqualTo("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetTest.kt deleted file mode 100644 index 00b9327c6..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/bookkeepingentrysets/BookkeepingEntrySetTest.kt +++ /dev/null @@ -1,98 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.bookkeepingentrysets - -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 BookkeepingEntrySetTest { - - @Test - fun create() { - val bookkeepingEntrySet = - BookkeepingEntrySet.builder() - .id("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .createdAt(OffsetDateTime.parse("2023-02-11T02:11:59Z")) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .build() - ) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(-1750L) - .build() - ) - .idempotencyKey(null) - .transactionId(null) - .type(BookkeepingEntrySet.Type.BOOKKEEPING_ENTRY_SET) - .build() - - assertThat(bookkeepingEntrySet.id()).isEqualTo("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - assertThat(bookkeepingEntrySet.createdAt()) - .isEqualTo(OffsetDateTime.parse("2023-02-11T02:11:59Z")) - assertThat(bookkeepingEntrySet.date()) - .isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - assertThat(bookkeepingEntrySet.entries()) - .containsExactly( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .build(), - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(-1750L) - .build(), - ) - assertThat(bookkeepingEntrySet.idempotencyKey()).isEmpty - assertThat(bookkeepingEntrySet.transactionId()).isEmpty - assertThat(bookkeepingEntrySet.type()) - .isEqualTo(BookkeepingEntrySet.Type.BOOKKEEPING_ENTRY_SET) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val bookkeepingEntrySet = - BookkeepingEntrySet.builder() - .id("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - .createdAt(OffsetDateTime.parse("2023-02-11T02:11:59Z")) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(1750L) - .build() - ) - .addEntry( - BookkeepingEntrySet.Entry.builder() - .id("bookkeeping_entry_ctjpajsj3ks2blx10375") - .accountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .amount(-1750L) - .build() - ) - .idempotencyKey(null) - .transactionId(null) - .type(BookkeepingEntrySet.Type.BOOKKEEPING_ENTRY_SET) - .build() - - val roundtrippedBookkeepingEntrySet = - jsonMapper.readValue( - jsonMapper.writeValueAsString(bookkeepingEntrySet), - jacksonTypeRef(), - ) - - assertThat(roundtrippedBookkeepingEntrySet).isEqualTo(bookkeepingEntrySet) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncTest.kt deleted file mode 100644 index e3a495c5e..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingAccountServiceAsyncTest.kt +++ /dev/null @@ -1,98 +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.bookkeepingaccounts.BookkeepingAccountBalanceParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountCreateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountUpdateParams -import java.time.OffsetDateTime -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class BookkeepingAccountServiceAsyncTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountServiceAsync = client.bookkeepingAccounts() - - val bookkeepingAccountFuture = - bookkeepingAccountServiceAsync.create( - BookkeepingAccountCreateParams.builder() - .name("New Account!") - .accountId("account_id") - .complianceCategory( - BookkeepingAccountCreateParams.ComplianceCategory.COMMINGLED_CASH - ) - .entityId("entity_id") - .build() - ) - - val bookkeepingAccount = bookkeepingAccountFuture.get() - bookkeepingAccount.validate() - } - - @Test - fun update() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountServiceAsync = client.bookkeepingAccounts() - - val bookkeepingAccountFuture = - bookkeepingAccountServiceAsync.update( - BookkeepingAccountUpdateParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .name("Deprecated Account") - .build() - ) - - val bookkeepingAccount = bookkeepingAccountFuture.get() - bookkeepingAccount.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountServiceAsync = client.bookkeepingAccounts() - - val pageFuture = bookkeepingAccountServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } - - @Test - fun balance() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountServiceAsync = client.bookkeepingAccounts() - - val bookkeepingBalanceLookupFuture = - bookkeepingAccountServiceAsync.balance( - BookkeepingAccountBalanceParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .atTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - - val bookkeepingBalanceLookup = bookkeepingBalanceLookupFuture.get() - bookkeepingBalanceLookup.validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncTest.kt deleted file mode 100644 index c87285aa0..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntryServiceAsyncTest.kt +++ /dev/null @@ -1,43 +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 org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class BookkeepingEntryServiceAsyncTest { - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntryServiceAsync = client.bookkeepingEntries() - - val bookkeepingEntryFuture = - bookkeepingEntryServiceAsync.retrieve("bookkeeping_entry_ctjpajsj3ks2blx10375") - - val bookkeepingEntry = bookkeepingEntryFuture.get() - bookkeepingEntry.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntryServiceAsync = client.bookkeepingEntries() - - val pageFuture = bookkeepingEntryServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncTest.kt deleted file mode 100644 index 488598ab1..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BookkeepingEntrySetServiceAsyncTest.kt +++ /dev/null @@ -1,78 +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.bookkeepingentrysets.BookkeepingEntrySetCreateParams -import java.time.OffsetDateTime -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class BookkeepingEntrySetServiceAsyncTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntrySetServiceAsync = client.bookkeepingEntrySets() - - val bookkeepingEntrySetFuture = - bookkeepingEntrySetServiceAsync.create( - BookkeepingEntrySetCreateParams.builder() - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build() - ) - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build() - ) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .transactionId("transaction_uyrp7fld2ium70oa7oi") - .build() - ) - - val bookkeepingEntrySet = bookkeepingEntrySetFuture.get() - bookkeepingEntrySet.validate() - } - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntrySetServiceAsync = client.bookkeepingEntrySets() - - val bookkeepingEntrySetFuture = - bookkeepingEntrySetServiceAsync.retrieve("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - - val bookkeepingEntrySet = bookkeepingEntrySetFuture.get() - bookkeepingEntrySet.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntrySetServiceAsync = client.bookkeepingEntrySets() - - val pageFuture = bookkeepingEntrySetServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceTest.kt deleted file mode 100644 index aa25ea295..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingAccountServiceTest.kt +++ /dev/null @@ -1,94 +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.bookkeepingaccounts.BookkeepingAccountBalanceParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountCreateParams -import com.increase.api.models.bookkeepingaccounts.BookkeepingAccountUpdateParams -import java.time.OffsetDateTime -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class BookkeepingAccountServiceTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountService = client.bookkeepingAccounts() - - val bookkeepingAccount = - bookkeepingAccountService.create( - BookkeepingAccountCreateParams.builder() - .name("New Account!") - .accountId("account_id") - .complianceCategory( - BookkeepingAccountCreateParams.ComplianceCategory.COMMINGLED_CASH - ) - .entityId("entity_id") - .build() - ) - - bookkeepingAccount.validate() - } - - @Test - fun update() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountService = client.bookkeepingAccounts() - - val bookkeepingAccount = - bookkeepingAccountService.update( - BookkeepingAccountUpdateParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .name("Deprecated Account") - .build() - ) - - bookkeepingAccount.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountService = client.bookkeepingAccounts() - - val page = bookkeepingAccountService.list() - - page.response().validate() - } - - @Test - fun balance() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingAccountService = client.bookkeepingAccounts() - - val bookkeepingBalanceLookup = - bookkeepingAccountService.balance( - BookkeepingAccountBalanceParams.builder() - .bookkeepingAccountId("bookkeeping_account_e37p1f1iuocw5intf35v") - .atTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - - bookkeepingBalanceLookup.validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceTest.kt deleted file mode 100644 index 04a415582..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntryServiceTest.kt +++ /dev/null @@ -1,41 +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 org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class BookkeepingEntryServiceTest { - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntryService = client.bookkeepingEntries() - - val bookkeepingEntry = - bookkeepingEntryService.retrieve("bookkeeping_entry_ctjpajsj3ks2blx10375") - - bookkeepingEntry.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntryService = client.bookkeepingEntries() - - val page = bookkeepingEntryService.list() - - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceTest.kt deleted file mode 100644 index 4e5db7b7e..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BookkeepingEntrySetServiceTest.kt +++ /dev/null @@ -1,75 +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.bookkeepingentrysets.BookkeepingEntrySetCreateParams -import java.time.OffsetDateTime -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class BookkeepingEntrySetServiceTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntrySetService = client.bookkeepingEntrySets() - - val bookkeepingEntrySet = - bookkeepingEntrySetService.create( - BookkeepingEntrySetCreateParams.builder() - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_9husfpw68pzmve9dvvc7") - .amount(100L) - .build() - ) - .addEntry( - BookkeepingEntrySetCreateParams.Entry.builder() - .accountId("bookkeeping_account_t2obldz1rcu15zr54umg") - .amount(-100L) - .build() - ) - .date(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .transactionId("transaction_uyrp7fld2ium70oa7oi") - .build() - ) - - bookkeepingEntrySet.validate() - } - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntrySetService = client.bookkeepingEntrySets() - - val bookkeepingEntrySet = - bookkeepingEntrySetService.retrieve("bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf") - - bookkeepingEntrySet.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val bookkeepingEntrySetService = client.bookkeepingEntrySets() - - val page = bookkeepingEntrySetService.list() - - page.response().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 7045d5b42..927dc50f8 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 @@ -94,9 +94,6 @@ internal class ProGuardCompatibilityTest { assertThat(client.events()).isNotNull() assertThat(client.eventSubscriptions()).isNotNull() assertThat(client.realTimeDecisions()).isNotNull() - assertThat(client.bookkeepingAccounts()).isNotNull() - assertThat(client.bookkeepingEntrySets()).isNotNull() - assertThat(client.bookkeepingEntries()).isNotNull() assertThat(client.groups()).isNotNull() assertThat(client.oauthApplications()).isNotNull() assertThat(client.oauthConnections()).isNotNull() From ab361a679aa01ef3c8c02a8159cfd1a5689553f8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:43:26 +0000 Subject: [PATCH 3/3] release: 0.525.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5d20cc498..2607471c1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.524.0" + ".": "0.525.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 31ebb62e7..8e346bdb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.525.0 (2026-04-22) + +Full Changelog: [v0.524.0...v0.525.0](https://github.com/Increase/increase-java/compare/v0.524.0...v0.525.0) + +### Features + +* **api:** api update ([988c18c](https://github.com/Increase/increase-java/commit/988c18c167cd5c84b0a16fb106e85ca4b1f8c77f)) + ## 0.524.0 (2026-04-20) Full Changelog: [v0.523.0...v0.524.0](https://github.com/Increase/increase-java/compare/v0.523.0...v0.524.0) diff --git a/README.md b/README.md index 028d571c1..9f2c1fb9e 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.524.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.524.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.524.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.525.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.525.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.525.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.524.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.525.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.524.0") +implementation("com.increase.api:increase-java:0.525.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.524.0") com.increase.api increase-java - 0.524.0 + 0.525.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 03076e758..7db5af3e2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.524.0" // x-release-please-version + version = "0.525.0" // x-release-please-version } subprojects {