diff --git a/sync-for-expenses/.speakeasy/gen.lock b/sync-for-expenses/.speakeasy/gen.lock index 4bd551eb..55907c3c 100755 --- a/sync-for-expenses/.speakeasy/gen.lock +++ b/sync-for-expenses/.speakeasy/gen.lock @@ -1,26 +1,26 @@ lockVersion: 2.0.0 id: 37c7760d-adec-45ec-9000-ca662e9c0068 management: - docChecksum: f7909a451d1597b90dec569f16a52c39 + docChecksum: b84c137b488c9aa6b56fa6e53acdf2cc docVersion: prealpha - speakeasyVersion: 1.214.0 - generationVersion: 2.286.2 - releaseVersion: 0.2.0 - configChecksum: bfb50fdae0098fd5dc78aad0d938b5c9 + speakeasyVersion: 1.244.1 + generationVersion: 2.301.2 + releaseVersion: 0.2.1 + configChecksum: 69aeaade36fb303243ae972577df696e repoURL: https://github.com/codatio/client-sdk-java.git repoSubDirectory: sync-for-expenses published: true features: java: constsAndDefaults: 0.1.1 - core: 3.16.0 + core: 3.16.4 decimal: 0.0.1 deprecations: 2.81.1 examples: 2.81.3 globalSecurity: 2.82.5 globalServerURLs: 2.82.1 inputOutputModels: 2.83.0 - nameOverrides: 2.81.2 + nameOverrides: 2.81.3 retries: 0.1.1 webhooks: 1.0.0 generatedFiles: @@ -35,8 +35,11 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/PushOperations.java - src/main/java/io/codat/sync/expenses/Configuration.java - src/main/java/io/codat/sync/expenses/Expenses.java + - src/main/java/io/codat/sync/expenses/Reimbursements.java - src/main/java/io/codat/sync/expenses/Sync.java - src/main/java/io/codat/sync/expenses/TransactionStatus.java + - src/main/java/io/codat/sync/expenses/Attachments.java + - src/main/java/io/codat/sync/expenses/Transfers.java - src/main/java/io/codat/sync/expenses/models/operations/CreateCompanyRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/DeleteCompanyRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/GetCompanyRequestBuilder.java @@ -70,7 +73,8 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/operations/SetCompanyConfigurationRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/CreateExpenseTransactionRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/UpdateExpenseTransactionRequestBuilder.java - - src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequestBuilder.java + - src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequestBuilder.java + - src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/GetSyncByIdRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/GetLastSuccessfulSyncRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/GetLatestSyncRequestBuilder.java @@ -78,6 +82,8 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/operations/ListSyncsRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/GetSyncTransactionRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/ListSyncTransactionsRequestBuilder.java + - src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequestBuilder.java + - src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequestBuilder.java - src/main/java/io/codat/sync/expenses/models/operations/SDKMethodInterfaces.java - src/main/java/io/codat/sync/expenses/CodatSyncExpenses.java - .gitattributes @@ -186,8 +192,10 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/operations/CreateExpenseTransactionResponse.java - src/main/java/io/codat/sync/expenses/models/operations/UpdateExpenseTransactionRequest.java - src/main/java/io/codat/sync/expenses/models/operations/UpdateExpenseTransactionResponse.java - - src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequest.java - - src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentResponse.java + - src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequest.java + - src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionResponse.java + - src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequest.java + - src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionResponse.java - src/main/java/io/codat/sync/expenses/models/operations/GetSyncByIdRequest.java - src/main/java/io/codat/sync/expenses/models/operations/GetSyncByIdResponse.java - src/main/java/io/codat/sync/expenses/models/operations/GetLastSuccessfulSyncRequest.java @@ -202,6 +210,10 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/operations/GetSyncTransactionResponse.java - src/main/java/io/codat/sync/expenses/models/operations/ListSyncTransactionsRequest.java - src/main/java/io/codat/sync/expenses/models/operations/ListSyncTransactionsResponse.java + - src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequest.java + - src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentResponse.java + - src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequest.java + - src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionResponse.java - src/main/java/io/codat/sync/expenses/models/components/ErrorMessage.java - src/main/java/io/codat/sync/expenses/models/components/ErrorValidation.java - src/main/java/io/codat/sync/expenses/models/components/ErrorValidationItem.java @@ -283,7 +295,7 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/components/AccountMappingInfo.java - src/main/java/io/codat/sync/expenses/models/components/CreateExpenseResponse.java - src/main/java/io/codat/sync/expenses/models/components/CreateExpenseRequest.java - - src/main/java/io/codat/sync/expenses/models/components/BankAccountReference.java + - src/main/java/io/codat/sync/expenses/models/components/ExpenseTransactionBankAccountReference.java - src/main/java/io/codat/sync/expenses/models/components/ExpenseTransactionType.java - src/main/java/io/codat/sync/expenses/models/components/ExpenseTransaction.java - src/main/java/io/codat/sync/expenses/models/components/ExpenseTransactionLine.java @@ -297,9 +309,11 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/components/UpdateExpenseResponse.java - src/main/java/io/codat/sync/expenses/models/components/UpdateExpenseRequestBankAccountReference.java - src/main/java/io/codat/sync/expenses/models/components/UpdateExpenseRequest.java - - src/main/java/io/codat/sync/expenses/models/components/Attachment.java - - src/main/java/io/codat/sync/expenses/models/components/AttachmentUpload.java - - src/main/java/io/codat/sync/expenses/models/components/CodatFile.java + - src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseResponse.java + - src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseRequest.java + - src/main/java/io/codat/sync/expenses/models/components/BankAccountReference.java + - src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransaction.java + - src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransactionLine.java - src/main/java/io/codat/sync/expenses/models/components/CompanySyncStatus.java - src/main/java/io/codat/sync/expenses/models/components/SyncInitiated.java - src/main/java/io/codat/sync/expenses/models/components/InitiateSync.java @@ -307,6 +321,13 @@ generatedFiles: - src/main/java/io/codat/sync/expenses/models/components/TransactionStatus.java - src/main/java/io/codat/sync/expenses/models/components/IntegrationType.java - src/main/java/io/codat/sync/expenses/models/components/Transactions.java + - src/main/java/io/codat/sync/expenses/models/components/Attachment.java + - src/main/java/io/codat/sync/expenses/models/components/AttachmentUpload.java + - src/main/java/io/codat/sync/expenses/models/components/CodatFile.java + - src/main/java/io/codat/sync/expenses/models/components/CreateTransferResponse.java + - src/main/java/io/codat/sync/expenses/models/components/CreateTransferRequest.java + - src/main/java/io/codat/sync/expenses/models/components/TransferDetails.java + - src/main/java/io/codat/sync/expenses/models/components/AccountRef.java - src/main/java/io/codat/sync/expenses/models/components/Security.java - src/main/java/io/codat/sync/expenses/models/components/ClientRateLimitReachedWebhook.java - src/main/java/io/codat/sync/expenses/models/components/ClientRateLimitReachedWebhookData.java @@ -390,8 +411,10 @@ generatedFiles: - docs/models/operations/CreateExpenseTransactionResponse.md - docs/models/operations/UpdateExpenseTransactionRequest.md - docs/models/operations/UpdateExpenseTransactionResponse.md - - docs/models/operations/UploadExpenseAttachmentRequest.md - - docs/models/operations/UploadExpenseAttachmentResponse.md + - docs/models/operations/CreateReimbursableExpenseTransactionRequest.md + - docs/models/operations/CreateReimbursableExpenseTransactionResponse.md + - docs/models/operations/UpdateReimbursableExpenseTransactionRequest.md + - docs/models/operations/UpdateReimbursableExpenseTransactionResponse.md - docs/models/operations/GetSyncByIdRequest.md - docs/models/operations/GetSyncByIdResponse.md - docs/models/operations/GetLastSuccessfulSyncRequest.md @@ -406,6 +429,10 @@ generatedFiles: - docs/models/operations/GetSyncTransactionResponse.md - docs/models/operations/ListSyncTransactionsRequest.md - docs/models/operations/ListSyncTransactionsResponse.md + - docs/models/operations/UploadExpenseAttachmentRequest.md + - docs/models/operations/UploadExpenseAttachmentResponse.md + - docs/models/operations/CreateTransferTransactionRequest.md + - docs/models/operations/CreateTransferTransactionResponse.md - docs/models/components/ErrorMessage.md - docs/models/components/ErrorValidation.md - docs/models/components/ErrorValidationItem.md @@ -487,7 +514,7 @@ generatedFiles: - docs/models/components/AccountMappingInfo.md - docs/models/components/CreateExpenseResponse.md - docs/models/components/CreateExpenseRequest.md - - docs/models/components/BankAccountReference.md + - docs/models/components/ExpenseTransactionBankAccountReference.md - docs/models/components/ExpenseTransactionType.md - docs/models/components/ExpenseTransaction.md - docs/models/components/ExpenseTransactionLine.md @@ -501,9 +528,11 @@ generatedFiles: - docs/models/components/UpdateExpenseResponse.md - docs/models/components/UpdateExpenseRequestBankAccountReference.md - docs/models/components/UpdateExpenseRequest.md - - docs/models/components/Attachment.md - - docs/models/components/AttachmentUpload.md - - docs/models/components/CodatFile.md + - docs/models/components/CreateReimbursableExpenseResponse.md + - docs/models/components/CreateReimbursableExpenseRequest.md + - docs/models/components/BankAccountReference.md + - docs/models/components/ReimbursableExpenseTransaction.md + - docs/models/components/ReimbursableExpenseTransactionLine.md - docs/models/components/CompanySyncStatus.md - docs/models/components/SyncInitiated.md - docs/models/components/InitiateSync.md @@ -511,6 +540,13 @@ generatedFiles: - docs/models/components/TransactionStatus.md - docs/models/components/IntegrationType.md - docs/models/components/Transactions.md + - docs/models/components/Attachment.md + - docs/models/components/AttachmentUpload.md + - docs/models/components/CodatFile.md + - docs/models/components/CreateTransferResponse.md + - docs/models/components/CreateTransferRequest.md + - docs/models/components/TransferDetails.md + - docs/models/components/AccountRef.md - docs/models/components/Security.md - docs/models/components/ClientRateLimitReachedWebhook.md - docs/models/components/ClientRateLimitReachedWebhookData.md @@ -537,6 +573,9 @@ generatedFiles: - docs/sdks/pushoperations/README.md - docs/sdks/configuration/README.md - docs/sdks/expenses/README.md + - docs/sdks/reimbursements/README.md - docs/sdks/sync/README.md - docs/sdks/transactionstatus/README.md + - docs/sdks/attachments/README.md + - docs/sdks/transfers/README.md - USAGE.md diff --git a/sync-for-expenses/README.md b/sync-for-expenses/README.md index 120223b4..5805e4a9 100644 --- a/sync-for-expenses/README.md +++ b/sync-for-expenses/README.md @@ -9,13 +9,11 @@ ### Getting started -Speakeasy offers [automatic publishing](https://www.speakeasyapi.dev/docs/advanced-setup/publish-sdks) of SDK artifacts via GitHub Actions. - -Once published to a repository (local or otherwise), the SDK artifact is used as below: +The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'io.codat.sync.expenses:openapi:0.2.0' +implementation 'io.codat.sync.expenses:openapi:0.2.1' ``` Maven: @@ -23,7 +21,7 @@ Maven: io.codat.sync.expenses openapi - 0.2.0 + 0.2.1 ``` @@ -161,7 +159,11 @@ public class Application { * [create](docs/sdks/expenses/README.md#create) - Create expense transaction * [update](docs/sdks/expenses/README.md#update) - Update expense transactions -* [uploadAttachment](docs/sdks/expenses/README.md#uploadattachment) - Upload attachment + +### [reimbursements()](docs/sdks/reimbursements/README.md) + +* [create](docs/sdks/reimbursements/README.md#create) - Create reimbursable expense transaction +* [update](docs/sdks/reimbursements/README.md#update) - Update reimbursable expense transaction ### [sync()](docs/sdks/sync/README.md) @@ -175,6 +177,14 @@ public class Application { * [get](docs/sdks/transactionstatus/README.md#get) - Get sync transaction * [list](docs/sdks/transactionstatus/README.md#list) - List sync transactions + +### [attachments()](docs/sdks/attachments/README.md) + +* [upload](docs/sdks/attachments/README.md#upload) - Upload attachment + +### [transfers()](docs/sdks/transfers/README.md) + +* [create](docs/sdks/transfers/README.md#create) - Create transfer transaction diff --git a/sync-for-expenses/RELEASES.md b/sync-for-expenses/RELEASES.md index 2e41b29d..49e9f32a 100644 --- a/sync-for-expenses/RELEASES.md +++ b/sync-for-expenses/RELEASES.md @@ -18,4 +18,14 @@ Based on: ### Generated - [java v0.2.0] sync-for-expenses ### Releases -- [Maven Central v0.2.0] https://central.sonatype.com/artifact/io.codat.sync/expenses/0.2.0 - sync-for-expenses \ No newline at end of file +- [Maven Central v0.2.0] https://central.sonatype.com/artifact/io.codat.sync/expenses/0.2.0 - sync-for-expenses + +## 2024-04-09 15:58:44 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses.yaml +- Speakeasy CLI 1.244.1 (2.301.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v0.2.1] sync-for-expenses +### Releases +- [Maven Central v0.2.1] https://central.sonatype.com/artifact/io.codat.sync/expenses/0.2.1 - sync-for-expenses \ No newline at end of file diff --git a/sync-for-expenses/build.gradle b/sync-for-expenses/build.gradle index 7c06cb4f..1e857b5a 100644 --- a/sync-for-expenses/build.gradle +++ b/sync-for-expenses/build.gradle @@ -51,7 +51,7 @@ tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') } group = "io.codat" -version = "0.2.0" +version = "0.2.1" sourcesJar { archiveBaseName = "sync.expenses" @@ -88,7 +88,7 @@ publishing { maven(MavenPublication) { groupId = 'io.codat' artifactId = 'sync.expenses' - version = '0.2.0' + version = '0.2.1' from components.java diff --git a/sync-for-expenses/docs/models/components/AccountRef.md b/sync-for-expenses/docs/models/components/AccountRef.md new file mode 100644 index 00000000..882bb515 --- /dev/null +++ b/sync-for-expenses/docs/models/components/AccountRef.md @@ -0,0 +1,11 @@ +# AccountRef + +Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `id` | *Optional* | :heavy_minus_sign: | 'id' from the Accounts data type. | +| `name` | *Optional* | :heavy_minus_sign: | 'name' from the Accounts data type. | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/CreateReimbursableExpenseRequest.md b/sync-for-expenses/docs/models/components/CreateReimbursableExpenseRequest.md new file mode 100644 index 00000000..4f2eb67c --- /dev/null +++ b/sync-for-expenses/docs/models/components/CreateReimbursableExpenseRequest.md @@ -0,0 +1,8 @@ +# CreateReimbursableExpenseRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `items` | List> | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/CreateReimbursableExpenseResponse.md b/sync-for-expenses/docs/models/components/CreateReimbursableExpenseResponse.md new file mode 100644 index 00000000..87174bbb --- /dev/null +++ b/sync-for-expenses/docs/models/components/CreateReimbursableExpenseResponse.md @@ -0,0 +1,8 @@ +# CreateReimbursableExpenseResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `syncId` | *Optional* | :heavy_minus_sign: | Unique id of sync created | cd937d46-8e41-43a9-9477-a79158ffd98a | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/CreateTransferRequest.md b/sync-for-expenses/docs/models/components/CreateTransferRequest.md new file mode 100644 index 00000000..2349f53d --- /dev/null +++ b/sync-for-expenses/docs/models/components/CreateTransferRequest.md @@ -0,0 +1,11 @@ +# CreateTransferRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `date` | *Optional* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `description` | *Optional* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `from` | [Optional](../../models/components/TransferDetails.md) | :heavy_minus_sign: | N/A | | +| `to` | [Optional](../../models/components/TransferDetails.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/CreateTransferResponse.md b/sync-for-expenses/docs/models/components/CreateTransferResponse.md new file mode 100644 index 00000000..2a5afe77 --- /dev/null +++ b/sync-for-expenses/docs/models/components/CreateTransferResponse.md @@ -0,0 +1,8 @@ +# CreateTransferResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `syncId` | *Optional* | :heavy_minus_sign: | Unique id of sync created | cd937d46-8e41-43a9-9477-a79158ffd98a | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/ExpenseTransaction.md b/sync-for-expenses/docs/models/components/ExpenseTransaction.md index cf937849..da4cbc69 100644 --- a/sync-for-expenses/docs/models/components/ExpenseTransaction.md +++ b/sync-for-expenses/docs/models/components/ExpenseTransaction.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bankAccountRef` | [Optional](../../models/components/BankAccountReference.md) | :heavy_minus_sign: | N/A | | +| `bankAccountRef` | [Optional](../../models/components/ExpenseTransactionBankAccountReference.md) | :heavy_minus_sign: | N/A | | | `contactRef` | [Optional](../../models/components/ContactRef.md) | :heavy_minus_sign: | N/A | | | `currency` | *String* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | | `currencyRate` | *JsonNullable* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

## Examples with base currency of GBP

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **USD** \| $20 \| 0.781 \| £15.62 \|
\| **EUR** \| €20 \| 0.885 \| £17.70 \|
\| **RUB** \| ₽20 \| 0.011 \| £0.22 \|

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \|


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. \| | | diff --git a/sync-for-expenses/docs/models/components/ExpenseTransactionBankAccountReference.md b/sync-for-expenses/docs/models/components/ExpenseTransactionBankAccountReference.md new file mode 100644 index 00000000..028283bb --- /dev/null +++ b/sync-for-expenses/docs/models/components/ExpenseTransactionBankAccountReference.md @@ -0,0 +1,8 @@ +# ExpenseTransactionBankAccountReference + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `id` | *Optional* | :heavy_minus_sign: | Identifier of the bank account. | 787dfb37-5707-4dc0-8a86-8d74e4cc78ea | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/RecordRef.md b/sync-for-expenses/docs/models/components/RecordRef.md index 1b98e80c..74f4c3ba 100644 --- a/sync-for-expenses/docs/models/components/RecordRef.md +++ b/sync-for-expenses/docs/models/components/RecordRef.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | identifier of linked reference from mapping options. | 40e3e57c-2322-4898-966c-ca41adfd23fd | \ No newline at end of file +| `id` | *Optional* | :heavy_minus_sign: | Identifier of linked reference from mapping options. | 40e3e57c-2322-4898-966c-ca41adfd23fd | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/ReimbursableExpenseTransaction.md b/sync-for-expenses/docs/models/components/ReimbursableExpenseTransaction.md new file mode 100644 index 00000000..b3bec738 --- /dev/null +++ b/sync-for-expenses/docs/models/components/ReimbursableExpenseTransaction.md @@ -0,0 +1,18 @@ +# ReimbursableExpenseTransaction + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allOf` | *Optional* | :heavy_minus_sign: | N/A | | +| `bankAccountRef` | [Optional](../../models/components/BankAccountReference.md) | :heavy_minus_sign: | N/A | | +| `currency` | *String* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | +| `currencyRate` | *JsonNullable* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

## Examples with base currency of GBP

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **USD** \| $20 \| 0.781 \| £15.62 \|
\| **EUR** \| €20 \| 0.885 \| £17.70 \|
\| **RUB** \| ₽20 \| 0.011 \| £0.22 \|

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \|


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. \| | | +| `dueDate` | *java.lang.Object* | :heavy_check_mark: | N/A | | +| `id` | *String* | :heavy_check_mark: | Your unique identifier for the transaction. | 4d7c6929-7770-412b-91bb-44d3bc71d111 | +| `issueDate` | *String* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `lines` | List<[io.codat.sync.expenses.models.components.ReimbursableExpenseTransactionLine](../../models/components/ReimbursableExpenseTransactionLine.md)> | :heavy_minus_sign: | Array of transaction lines. | | +| `notes` | *Optional* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `recordRef` | [Optional](../../models/components/ContactRef.md) | :heavy_minus_sign: | N/A | | +| `reference` | *JsonNullable* | :heavy_minus_sign: | User-friendly reference for the reimbursable expense. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/ReimbursableExpenseTransactionLine.md b/sync-for-expenses/docs/models/components/ReimbursableExpenseTransactionLine.md new file mode 100644 index 00000000..e0909f97 --- /dev/null +++ b/sync-for-expenses/docs/models/components/ReimbursableExpenseTransactionLine.md @@ -0,0 +1,13 @@ +# ReimbursableExpenseTransactionLine + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `accountRef` | [io.codat.sync.expenses.models.components.RecordRef](../../models/components/RecordRef.md) | :heavy_check_mark: | N/A | | +| `invoiceTo` | [JsonNullable](../../models/components/InvoiceTo.md) | :heavy_minus_sign: | Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. | | +| `netAmount` | *BigDecimal* | :heavy_check_mark: | Amount of the line, exclusive of tax. | 110.42 | +| `taxAmount` | *Optional* | :heavy_minus_sign: | Amount of tax for the line. | 14.43 | +| `taxRateRef` | [Optional](../../models/components/RecordRef.md) | :heavy_minus_sign: | N/A | | +| `trackingRefs` | List<[io.codat.sync.expenses.models.components.TrackingRef](../../models/components/TrackingRef.md)> | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/components/TransferDetails.md b/sync-for-expenses/docs/models/components/TransferDetails.md new file mode 100644 index 00000000..105c46a2 --- /dev/null +++ b/sync-for-expenses/docs/models/components/TransferDetails.md @@ -0,0 +1,9 @@ +# TransferDetails + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accountRef` | [Optional](../../models/components/AccountRef.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | +| `amount` | *Optional* | :heavy_minus_sign: | Amount of the transfer. | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/CreateReimbursableExpenseTransactionRequest.md b/sync-for-expenses/docs/models/operations/CreateReimbursableExpenseTransactionRequest.md new file mode 100644 index 00000000..ce6d668d --- /dev/null +++ b/sync-for-expenses/docs/models/operations/CreateReimbursableExpenseTransactionRequest.md @@ -0,0 +1,9 @@ +# CreateReimbursableExpenseTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `createReimbursableExpenseRequest` | [Optional](../../models/components/CreateReimbursableExpenseRequest.md) | :heavy_minus_sign: | N/A | | +| `companyId` | *String* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/CreateReimbursableExpenseTransactionResponse.md b/sync-for-expenses/docs/models/operations/CreateReimbursableExpenseTransactionResponse.md new file mode 100644 index 00000000..ea583c86 --- /dev/null +++ b/sync-for-expenses/docs/models/operations/CreateReimbursableExpenseTransactionResponse.md @@ -0,0 +1,12 @@ +# CreateReimbursableExpenseTransactionResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `createReimbursableExpenseResponse` | [Optional](../../models/components/CreateReimbursableExpenseResponse.md) | :heavy_minus_sign: | OK | +| `errorMessage` | [Optional](../../models/components/ErrorMessage.md) | :heavy_minus_sign: | The request made is not valid. | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/CreateTransferTransactionRequest.md b/sync-for-expenses/docs/models/operations/CreateTransferTransactionRequest.md new file mode 100644 index 00000000..e24ffa9c --- /dev/null +++ b/sync-for-expenses/docs/models/operations/CreateTransferTransactionRequest.md @@ -0,0 +1,10 @@ +# CreateTransferTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `createTransferRequest` | [Optional](../../models/components/CreateTransferRequest.md) | :heavy_minus_sign: | N/A | | +| `companyId` | *String* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `transactionId` | *String* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/CreateTransferTransactionResponse.md b/sync-for-expenses/docs/models/operations/CreateTransferTransactionResponse.md new file mode 100644 index 00000000..8f295ab1 --- /dev/null +++ b/sync-for-expenses/docs/models/operations/CreateTransferTransactionResponse.md @@ -0,0 +1,12 @@ +# CreateTransferTransactionResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `createTransferResponse` | [Optional](../../models/components/CreateTransferResponse.md) | :heavy_minus_sign: | OK | +| `errorMessage` | [Optional](../../models/components/ErrorMessage.md) | :heavy_minus_sign: | The request made is not valid. | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/InitiateSyncResponse.md b/sync-for-expenses/docs/models/operations/InitiateSyncResponse.md index 06abd0c6..e8f66358 100644 --- a/sync-for-expenses/docs/models/operations/InitiateSyncResponse.md +++ b/sync-for-expenses/docs/models/operations/InitiateSyncResponse.md @@ -9,4 +9,4 @@ | `errorMessage` | [Optional](../../models/components/ErrorMessage.md) | :heavy_minus_sign: | The request made is not valid. | | `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `syncInitiated` | [Optional](../../models/components/SyncInitiated.md) | :heavy_minus_sign: | Returns the newly created SyncId | \ No newline at end of file +| `syncInitiated` | [Optional](../../models/components/SyncInitiated.md) | :heavy_minus_sign: | Returns the newly created syncId | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/UpdateReimbursableExpenseTransactionRequest.md b/sync-for-expenses/docs/models/operations/UpdateReimbursableExpenseTransactionRequest.md new file mode 100644 index 00000000..87079d23 --- /dev/null +++ b/sync-for-expenses/docs/models/operations/UpdateReimbursableExpenseTransactionRequest.md @@ -0,0 +1,10 @@ +# UpdateReimbursableExpenseTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `createReimbursableExpenseRequest` | [Optional](../../models/components/CreateReimbursableExpenseRequest.md) | :heavy_minus_sign: | N/A | | +| `companyId` | *String* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `transactionId` | *String* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file diff --git a/sync-for-expenses/docs/models/operations/UpdateReimbursableExpenseTransactionResponse.md b/sync-for-expenses/docs/models/operations/UpdateReimbursableExpenseTransactionResponse.md new file mode 100644 index 00000000..ab6ab83f --- /dev/null +++ b/sync-for-expenses/docs/models/operations/UpdateReimbursableExpenseTransactionResponse.md @@ -0,0 +1,12 @@ +# UpdateReimbursableExpenseTransactionResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `createReimbursableExpenseResponse` | [Optional](../../models/components/CreateReimbursableExpenseResponse.md) | :heavy_minus_sign: | OK | +| `errorMessage` | [Optional](../../models/components/ErrorMessage.md) | :heavy_minus_sign: | The request made is not valid. | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/sdks/attachments/README.md b/sync-for-expenses/docs/sdks/attachments/README.md new file mode 100644 index 00000000..2d22c863 --- /dev/null +++ b/sync-for-expenses/docs/sdks/attachments/README.md @@ -0,0 +1,99 @@ +# Attachments +(*attachments()*) + +## Overview + +Upload attachmens to expenses, transfers and reimbursable expense transactions. + +### Available Operations + +* [upload](#upload) - Upload attachment + +## upload + +The *Upload attachment* endpoint uploads an attachment in the accounting software against the given transactionId. + +[Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. + +**Integration-specific behaviour** + +Each accounting software supports different file formats and sizes. + +| Integration | File Size | File Extension | +|-------------|-------------|--------------------------------------------------------------------------------------------------------------| +| Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | +| QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | +| NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | +| Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | + +### Example Usage + +```java +package hello.world; + +import io.codat.sync.expenses.CodatSyncExpenses; +import io.codat.sync.expenses.models.components.*; +import io.codat.sync.expenses.models.components.AttachmentUpload; +import io.codat.sync.expenses.models.components.CodatFile; +import io.codat.sync.expenses.models.components.Security; +import io.codat.sync.expenses.models.operations.*; +import io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest; +import io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Optional; +import static java.util.Map.entry; + +public class Application { + + public static void main(String[] args) { + try { + CodatSyncExpenses sdk = CodatSyncExpenses.builder() + .authHeader("Basic BASE_64_ENCODED(API_KEY)") + .build(); + + UploadExpenseAttachmentRequest req = UploadExpenseAttachmentRequest.builder() + .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") + .syncId("6fb40d5e-b13e-11ed-afa1-0242ac120002") + .transactionId("336694d8-2dca-4cb5-a28d-3ccb83e55eee") + .attachmentUpload(AttachmentUpload.builder() + .file(CodatFile.builder() + .content("0x87cbca97eC".getBytes()) + .fileName("") + .build()) + .build()) + .build(); + + UploadExpenseAttachmentResponse res = sdk.attachments().upload() + .request(req) + .call(); + + if (res.attachment().isPresent()) { + // handle response + } + } catch (io.codat.sync.expenses.models.errors.SDKError e) { + // handle exception + } catch (Exception e) { + // handle exception + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest](../../models/operations/UploadExpenseAttachmentRequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[Optional](../../models/operations/UploadExpenseAttachmentResponse.md)** +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------- | ---------------------- | ---------------------- | +| models/errors/SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/docs/sdks/expenses/README.md b/sync-for-expenses/docs/sdks/expenses/README.md index 8258fe20..10e47331 100644 --- a/sync-for-expenses/docs/sdks/expenses/README.md +++ b/sync-for-expenses/docs/sdks/expenses/README.md @@ -3,13 +3,12 @@ ## Overview -Create expense datasets and upload receipts. +Create expense transactions. ### Available Operations * [create](#create) - Create expense transaction * [update](#update) - Update expense transactions -* [uploadAttachment](#uploadattachment) - Upload attachment ## create @@ -36,10 +35,10 @@ package hello.world; import io.codat.sync.expenses.CodatSyncExpenses; import io.codat.sync.expenses.models.components.*; -import io.codat.sync.expenses.models.components.BankAccountReference; import io.codat.sync.expenses.models.components.ContactRef; import io.codat.sync.expenses.models.components.CreateExpenseRequest; import io.codat.sync.expenses.models.components.ExpenseTransaction; +import io.codat.sync.expenses.models.components.ExpenseTransactionBankAccountReference; import io.codat.sync.expenses.models.components.ExpenseTransactionLine; import io.codat.sync.expenses.models.components.ExpenseTransactionType; import io.codat.sync.expenses.models.components.InvoiceTo; @@ -220,92 +219,3 @@ public class Application { | Error Object | Status Code | Content Type | | ---------------------- | ---------------------- | ---------------------- | | models/errors/SDKError | 4xx-5xx | */* | - -## uploadAttachment - -The *Upload attachment* endpoint uploads an attachment in the accounting software against the given transactionId. - -[Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. - -**Integration-specific behaviour** - -Each accounting software supports different file formats and sizes. - -| Integration | File Size | File Extension | -|-------------|-------------|--------------------------------------------------------------------------------------------------------------| -| Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | -| QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | -| NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | -| Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | - -### Example Usage - -```java -package hello.world; - -import io.codat.sync.expenses.CodatSyncExpenses; -import io.codat.sync.expenses.models.components.*; -import io.codat.sync.expenses.models.components.AttachmentUpload; -import io.codat.sync.expenses.models.components.CodatFile; -import io.codat.sync.expenses.models.components.Security; -import io.codat.sync.expenses.models.operations.*; -import io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest; -import io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.util.Optional; -import static java.util.Map.entry; - -public class Application { - - public static void main(String[] args) { - try { - CodatSyncExpenses sdk = CodatSyncExpenses.builder() - .authHeader("Basic BASE_64_ENCODED(API_KEY)") - .build(); - - UploadExpenseAttachmentRequest req = UploadExpenseAttachmentRequest.builder() - .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") - .syncId("6fb40d5e-b13e-11ed-afa1-0242ac120002") - .transactionId("336694d8-2dca-4cb5-a28d-3ccb83e55eee") - .attachmentUpload(AttachmentUpload.builder() - .file(CodatFile.builder() - .content("0xE3ABc1980E".getBytes()) - .fileName("") - .build()) - .build()) - .build(); - - UploadExpenseAttachmentResponse res = sdk.expenses().uploadAttachment() - .request(req) - .call(); - - if (res.attachment().isPresent()) { - // handle response - } - } catch (io.codat.sync.expenses.models.errors.SDKError e) { - // handle exception - } catch (Exception e) { - // handle exception - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest](../../models/operations/UploadExpenseAttachmentRequest.md) | :heavy_check_mark: | The request object to use for the request. | - - -### Response - -**[Optional](../../models/operations/UploadExpenseAttachmentResponse.md)** -### Errors - -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/docs/sdks/reimbursements/README.md b/sync-for-expenses/docs/sdks/reimbursements/README.md new file mode 100644 index 00000000..82bd74fe --- /dev/null +++ b/sync-for-expenses/docs/sdks/reimbursements/README.md @@ -0,0 +1,192 @@ +# Reimbursements +(*reimbursements()*) + +## Overview + +Create reimbursable expense transactions. + +### Available Operations + +* [create](#create) - Create reimbursable expense transaction +* [update](#update) - Update reimbursable expense transaction + +## create + +Use the *Create reimbursable expense* endpoint to create a [reimbursement request](https://docs.codat.io/sync-for-expenses-api#/schemas/Reimburseable-Expense-Transactions) in the accounting platform for a given company's connection. + +Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. + +### Example Usage + +```java +package hello.world; + +import io.codat.sync.expenses.CodatSyncExpenses; +import io.codat.sync.expenses.models.components.*; +import io.codat.sync.expenses.models.components.BankAccountReference; +import io.codat.sync.expenses.models.components.ContactRef; +import io.codat.sync.expenses.models.components.CreateReimbursableExpenseRequest; +import io.codat.sync.expenses.models.components.InvoiceTo; +import io.codat.sync.expenses.models.components.InvoiceToDataType; +import io.codat.sync.expenses.models.components.RecordRef; +import io.codat.sync.expenses.models.components.ReimbursableExpenseTransaction; +import io.codat.sync.expenses.models.components.ReimbursableExpenseTransactionLine; +import io.codat.sync.expenses.models.components.Security; +import io.codat.sync.expenses.models.components.TrackingRef; +import io.codat.sync.expenses.models.components.TrackingRefDataType; +import io.codat.sync.expenses.models.components.Type; +import io.codat.sync.expenses.models.operations.*; +import io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequest; +import io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionResponse; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Optional; +import static java.util.Map.entry; + +public class Application { + + public static void main(String[] args) { + try { + CodatSyncExpenses sdk = CodatSyncExpenses.builder() + .authHeader("Basic BASE_64_ENCODED(API_KEY)") + .build(); + + CreateReimbursableExpenseTransactionRequest req = CreateReimbursableExpenseTransactionRequest.builder() + .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") + .createReimbursableExpenseRequest(CreateReimbursableExpenseRequest.builder() + .items(java.util.List.of( + java.util.List.of( + ReimbursableExpenseTransaction.builder() + .currency("GBP") + .dueDate("") + .id("4d7c6929-7770-412b-91bb-44d3bc71d111") + .issueDate("2022-10-23T00:00:00Z") + .notes("APPLE.COM/BILL - 09001077498 - Card Ending: 4590") + .build()))) + .build()) + .build(); + + CreateReimbursableExpenseTransactionResponse res = sdk.reimbursements().create() + .request(req) + .call(); + + if (res.createReimbursableExpenseResponse().isPresent()) { + // handle response + } + } catch (io.codat.sync.expenses.models.errors.SDKError e) { + // handle exception + } catch (Exception e) { + // handle exception + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `request` | [io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequest](../../models/operations/CreateReimbursableExpenseTransactionRequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[Optional](../../models/operations/CreateReimbursableExpenseTransactionResponse.md)** +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------- | ---------------------- | ---------------------- | +| models/errors/SDKError | 4xx-5xx | */* | + +## update + +The *Update reimbursable expense* endpoint updates an existing [reimbursable expense transaction](https://docs.codat.io/sync-for-expenses-api#/operations/create-reimbursable-expense-transaction) in the accounting platform for a given company's connection. + +Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. + +### Example Usage + +```java +package hello.world; + +import io.codat.sync.expenses.CodatSyncExpenses; +import io.codat.sync.expenses.models.components.*; +import io.codat.sync.expenses.models.components.BankAccountReference; +import io.codat.sync.expenses.models.components.ContactRef; +import io.codat.sync.expenses.models.components.CreateReimbursableExpenseRequest; +import io.codat.sync.expenses.models.components.InvoiceTo; +import io.codat.sync.expenses.models.components.InvoiceToDataType; +import io.codat.sync.expenses.models.components.RecordRef; +import io.codat.sync.expenses.models.components.ReimbursableExpenseTransaction; +import io.codat.sync.expenses.models.components.ReimbursableExpenseTransactionLine; +import io.codat.sync.expenses.models.components.Security; +import io.codat.sync.expenses.models.components.TrackingRef; +import io.codat.sync.expenses.models.components.TrackingRefDataType; +import io.codat.sync.expenses.models.components.Type; +import io.codat.sync.expenses.models.operations.*; +import io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequest; +import io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionResponse; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Optional; +import static java.util.Map.entry; + +public class Application { + + public static void main(String[] args) { + try { + CodatSyncExpenses sdk = CodatSyncExpenses.builder() + .authHeader("Basic BASE_64_ENCODED(API_KEY)") + .build(); + + UpdateReimbursableExpenseTransactionRequest req = UpdateReimbursableExpenseTransactionRequest.builder() + .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") + .transactionId("336694d8-2dca-4cb5-a28d-3ccb83e55eee") + .createReimbursableExpenseRequest(CreateReimbursableExpenseRequest.builder() + .items(java.util.List.of( + java.util.List.of( + ReimbursableExpenseTransaction.builder() + .currency("GBP") + .dueDate("") + .id("4d7c6929-7770-412b-91bb-44d3bc71d111") + .issueDate("2022-10-23T00:00:00Z") + .notes("APPLE.COM/BILL - 09001077498 - Card Ending: 4590") + .build()))) + .build()) + .build(); + + UpdateReimbursableExpenseTransactionResponse res = sdk.reimbursements().update() + .request(req) + .call(); + + if (res.createReimbursableExpenseResponse().isPresent()) { + // handle response + } + } catch (io.codat.sync.expenses.models.errors.SDKError e) { + // handle exception + } catch (Exception e) { + // handle exception + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `request` | [io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequest](../../models/operations/UpdateReimbursableExpenseTransactionRequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[Optional](../../models/operations/UpdateReimbursableExpenseTransactionResponse.md)** +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------- | ---------------------- | ---------------------- | +| models/errors/SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/docs/sdks/transfers/README.md b/sync-for-expenses/docs/sdks/transfers/README.md new file mode 100644 index 00000000..204120cd --- /dev/null +++ b/sync-for-expenses/docs/sdks/transfers/README.md @@ -0,0 +1,103 @@ +# Transfers +(*transfers()*) + +## Overview + +Create transfer transactions. + +### Available Operations + +* [create](#create) - Create transfer transaction + +## create + +Use the *Create transfer* endpoint to create or update a [transfer transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/TransferTransaction) in the accounting platform for a given company's connection. + +Transfers record the movement of money between two bank accounts, or between a bank account and a nominal account. Use them to represent actions such as topping up a debit card account or a balance transfer to another credit card. + +The `from.amount` and `to.amount` fields are in the native currency of the account. + + +### Example Usage + +```java +package hello.world; + +import io.codat.sync.expenses.CodatSyncExpenses; +import io.codat.sync.expenses.models.components.*; +import io.codat.sync.expenses.models.components.AccountRef; +import io.codat.sync.expenses.models.components.CreateTransferRequest; +import io.codat.sync.expenses.models.components.Security; +import io.codat.sync.expenses.models.components.TransferDetails; +import io.codat.sync.expenses.models.operations.*; +import io.codat.sync.expenses.models.operations.CreateTransferTransactionRequest; +import io.codat.sync.expenses.models.operations.CreateTransferTransactionResponse; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Optional; +import static java.util.Map.entry; + +public class Application { + + public static void main(String[] args) { + try { + CodatSyncExpenses sdk = CodatSyncExpenses.builder() + .authHeader("Basic BASE_64_ENCODED(API_KEY)") + .build(); + + CreateTransferTransactionRequest req = CreateTransferTransactionRequest.builder() + .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") + .transactionId("336694d8-2dca-4cb5-a28d-3ccb83e55eee") + .createTransferRequest(CreateTransferRequest.builder() + .date("2022-10-23T00:00:00Z") + .description("APPLE.COM/BILL - 09001077498 - Card Ending: 4590") + .from(TransferDetails.builder() + .accountRef(AccountRef.builder() + .id("") + .name("") + .build()) + .amount(new BigDecimal("4893.82")) + .build()) + .to(TransferDetails.builder() + .accountRef(AccountRef.builder() + .id("") + .name("") + .build()) + .amount(new BigDecimal("6384.24")) + .build()) + .build()) + .build(); + + CreateTransferTransactionResponse res = sdk.transfers().create() + .request(req) + .call(); + + if (res.createTransferResponse().isPresent()) { + // handle response + } + } catch (io.codat.sync.expenses.models.errors.SDKError e) { + // handle exception + } catch (Exception e) { + // handle exception + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `request` | [io.codat.sync.expenses.models.operations.CreateTransferTransactionRequest](../../models/operations/CreateTransferTransactionRequest.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[Optional](../../models/operations/CreateTransferTransactionResponse.md)** +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------- | ---------------------- | ---------------------- | +| models/errors/SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/gen.yaml b/sync-for-expenses/gen.yaml index b6d29e0d..5bd7a468 100644 --- a/sync-for-expenses/gen.yaml +++ b/sync-for-expenses/gen.yaml @@ -11,7 +11,7 @@ generation: oAuth2ClientCredentialsEnabled: false telemetryEnabled: true java: - version: 0.2.0 + version: 0.2.1 additionalDependencies: [] artifactID: sync.expenses author: Codat diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/Attachments.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Attachments.java new file mode 100644 index 00000000..ac5bec13 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Attachments.java @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.codat.sync.expenses.models.errors.SDKError; +import io.codat.sync.expenses.models.operations.SDKMethodInterfaces.*; +import io.codat.sync.expenses.utils.HTTPClient; +import io.codat.sync.expenses.utils.HTTPRequest; +import io.codat.sync.expenses.utils.JSON; +import io.codat.sync.expenses.utils.Options; +import io.codat.sync.expenses.utils.SerializedBody; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Upload attachmens to expenses, transfers and reimbursable expense transactions. + */ +public class Attachments implements + MethodCallUploadExpenseAttachment { + + private final SDKConfiguration sdkConfiguration; + + Attachments(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequestBuilder upload() { + return new io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequestBuilder(this); + } + + /** + * Upload attachment + * The *Upload attachment* endpoint uploads an attachment in the accounting software against the given transactionId. + * + * [Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. + * + * **Integration-specific behaviour** + * + * Each accounting software supports different file formats and sizes. + * + * | Integration | File Size | File Extension | + * |-------------|-------------|--------------------------------------------------------------------------------------------------------------| + * | Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | + * | QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | + * | NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | + * | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state <a className="external" href="https://learn.microsoft.com/en-gb/dynamics365/business-central/ui-how-add-link-to-record#to-attach-a-file-to-a-purchase-invoice" target="_blank">here</a> that "You can attach any type of file, such as text, image, or video files". | + * @param request The request object containing all of the parameters for the API call. + * @param options additional options + * @return The response from the API call. + * @throws Exception if the API call fails. + */ + public io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse upload( + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest request, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + + + String baseUrl = this.sdkConfiguration.serverUrl; + + String url = io.codat.sync.expenses.utils.Utils.generateURL( + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest.class, + baseUrl, + "/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}/attachments", + request, null); + + HTTPRequest req = new HTTPRequest(); + req.setMethod("POST"); + req.setURL(url); + Object _convertedRequest = Utils.convertToShape(request, Utils.JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody serializedRequestBody = io.codat.sync.expenses.utils.Utils.serializeRequestBody( + _convertedRequest, "attachmentUpload", "multipart", false); + req.setBody(serializedRequestBody); + + req.addHeader("Accept", "application/json"); + req.addHeader("user-agent", this.sdkConfiguration.userAgent); + + HTTPClient client = io.codat.sync.expenses.utils.Utils.configureSecurityClient( + this.sdkConfiguration.defaultClient, this.sdkConfiguration.securitySource.getSecurity()); + + io.codat.sync.expenses.utils.RetryConfig retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig.isPresent()) { + retryConfig = this.sdkConfiguration.retryConfig.get(); + } else { + retryConfig = io.codat.sync.expenses.utils.RetryConfig.builder() + .backoff(io.codat.sync.expenses.utils.BackoffStrategy.builder() + .initialInterval(500L, java.util.concurrent.TimeUnit.MILLISECONDS) + .maxInterval(60000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .baseFactor((double)(1.5)) + .maxElapsedTime(3600000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + + List statusCodes = new java.util.ArrayList(); + statusCodes.add("408"); + statusCodes.add("429"); + statusCodes.add("5XX"); + io.codat.sync.expenses.utils.Retries retries = io.codat.sync.expenses.utils.Retries.builder() + .action(() -> client.send(req)) + .retryConfig(retryConfig) + .statusCodes(statusCodes) + .build(); + + HttpResponse httpRes = retries.run(); + + String contentType = httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse.Builder resBuilder = + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse + .builder() + .contentType(contentType) + .statusCode(httpRes.statusCode()) + .rawResponse(httpRes); + + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse res = resBuilder.build(); + + res.withRawResponse(httpRes); + + if (httpRes.statusCode() == 200) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.Attachment out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withAttachment(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } else if (httpRes.statusCode() == 400 || httpRes.statusCode() == 401 || httpRes.statusCode() == 402 || httpRes.statusCode() == 403 || httpRes.statusCode() == 404 || httpRes.statusCode() == 429 || httpRes.statusCode() == 500 || httpRes.statusCode() == 503) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.ErrorMessage out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withErrorMessage(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } + + return res; + } + +} diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/CodatSyncExpenses.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/CodatSyncExpenses.java index 5c0f6487..7eaba24e 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/CodatSyncExpenses.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/CodatSyncExpenses.java @@ -80,10 +80,15 @@ public class CodatSyncExpenses { private final Configuration configuration; /** - * Create expense datasets and upload receipts. + * Create expense transactions. */ private final Expenses expenses; + /** + * Create reimbursable expense transactions. + */ + private final Reimbursements reimbursements; + /** * Trigger and monitor expense syncs to accounting software. */ @@ -94,6 +99,16 @@ public class CodatSyncExpenses { */ private final TransactionStatus transactionStatus; + /** + * Upload attachmens to expenses, transfers and reimbursable expense transactions. + */ + private final Attachments attachments; + + /** + * Create transfer transactions. + */ + private final Transfers transfers; + /** * Create and manage your Codat companies. */ @@ -151,12 +166,19 @@ public Configuration configuration() { } /** - * Create expense datasets and upload receipts. + * Create expense transactions. */ public Expenses expenses() { return expenses; } + /** + * Create reimbursable expense transactions. + */ + public Reimbursements reimbursements() { + return reimbursements; + } + /** * Trigger and monitor expense syncs to accounting software. */ @@ -171,6 +193,20 @@ public TransactionStatus transactionStatus() { return transactionStatus; } + /** + * Upload attachmens to expenses, transfers and reimbursable expense transactions. + */ + public Attachments attachments() { + return attachments; + } + + /** + * Create transfer transactions. + */ + public Transfers transfers() { + return transfers; + } + private final SDKConfiguration sdkConfiguration; /** @@ -302,8 +338,11 @@ private CodatSyncExpenses(SDKConfiguration sdkConfiguration) { this.pushOperations = new PushOperations(sdkConfiguration); this.configuration = new Configuration(sdkConfiguration); this.expenses = new Expenses(sdkConfiguration); + this.reimbursements = new Reimbursements(sdkConfiguration); this.sync = new Sync(sdkConfiguration); this.transactionStatus = new TransactionStatus(sdkConfiguration); + this.attachments = new Attachments(sdkConfiguration); + this.transfers = new Transfers(sdkConfiguration); } @@ -341,6 +380,9 @@ private CodatSyncExpenses(SDKConfiguration sdkConfiguration) { + + + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/Expenses.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Expenses.java index ace100fe..f63a7841 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/Expenses.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Expenses.java @@ -26,12 +26,11 @@ import org.openapitools.jackson.nullable.JsonNullable; /** - * Create expense datasets and upload receipts. + * Create expense transactions. */ public class Expenses implements MethodCallCreateExpenseTransaction, - MethodCallUpdateExpenseTransaction, - MethodCallUploadExpenseAttachment { + MethodCallUpdateExpenseTransaction { private final SDKConfiguration sdkConfiguration; @@ -287,131 +286,4 @@ public io.codat.sync.expenses.models.operations.UpdateExpenseTransactionResponse return res; } - - public io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequestBuilder uploadAttachment() { - return new io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequestBuilder(this); - } - - /** - * Upload attachment - * The *Upload attachment* endpoint uploads an attachment in the accounting software against the given transactionId. - * - * [Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. - * - * **Integration-specific behaviour** - * - * Each accounting software supports different file formats and sizes. - * - * | Integration | File Size | File Extension | - * |-------------|-------------|--------------------------------------------------------------------------------------------------------------| - * | Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | - * | QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | - * | NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | - * | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state <a className="external" href="https://learn.microsoft.com/en-gb/dynamics365/business-central/ui-how-add-link-to-record#to-attach-a-file-to-a-purchase-invoice" target="_blank">here</a> that "You can attach any type of file, such as text, image, or video files". | - * @param request The request object containing all of the parameters for the API call. - * @param options additional options - * @return The response from the API call. - * @throws Exception if the API call fails. - */ - public io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse uploadAttachment( - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest request, - Optional options) throws Exception { - - if (options.isPresent()) { - options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); - } - - - String baseUrl = this.sdkConfiguration.serverUrl; - - String url = io.codat.sync.expenses.utils.Utils.generateURL( - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest.class, - baseUrl, - "/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}/attachments", - request, null); - - HTTPRequest req = new HTTPRequest(); - req.setMethod("POST"); - req.setURL(url); - Object _convertedRequest = Utils.convertToShape(request, Utils.JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody serializedRequestBody = io.codat.sync.expenses.utils.Utils.serializeRequestBody( - _convertedRequest, "attachmentUpload", "multipart", false); - req.setBody(serializedRequestBody); - - req.addHeader("Accept", "application/json"); - req.addHeader("user-agent", this.sdkConfiguration.userAgent); - - HTTPClient client = io.codat.sync.expenses.utils.Utils.configureSecurityClient( - this.sdkConfiguration.defaultClient, this.sdkConfiguration.securitySource.getSecurity()); - - io.codat.sync.expenses.utils.RetryConfig retryConfig; - if (options.isPresent() && options.get().retryConfig().isPresent()) { - retryConfig = options.get().retryConfig().get(); - } else if (this.sdkConfiguration.retryConfig.isPresent()) { - retryConfig = this.sdkConfiguration.retryConfig.get(); - } else { - retryConfig = io.codat.sync.expenses.utils.RetryConfig.builder() - .backoff(io.codat.sync.expenses.utils.BackoffStrategy.builder() - .initialInterval(500L, java.util.concurrent.TimeUnit.MILLISECONDS) - .maxInterval(60000L, java.util.concurrent.TimeUnit.MILLISECONDS) - .baseFactor((double)(1.5)) - .maxElapsedTime(3600000L, java.util.concurrent.TimeUnit.MILLISECONDS) - .retryConnectError(true) - .build()) - .build(); - } - - List statusCodes = new java.util.ArrayList(); - statusCodes.add("408"); - statusCodes.add("429"); - statusCodes.add("5XX"); - io.codat.sync.expenses.utils.Retries retries = io.codat.sync.expenses.utils.Retries.builder() - .action(() -> client.send(req)) - .retryConfig(retryConfig) - .statusCodes(statusCodes) - .build(); - - HttpResponse httpRes = retries.run(); - - String contentType = httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse.Builder resBuilder = - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse - .builder() - .contentType(contentType) - .statusCode(httpRes.statusCode()) - .rawResponse(httpRes); - - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse res = resBuilder.build(); - - res.withRawResponse(httpRes); - - if (httpRes.statusCode() == 200) { - if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { - ObjectMapper mapper = JSON.getMapper(); - io.codat.sync.expenses.models.components.Attachment out = mapper.readValue( - Utils.toUtf8AndClose(httpRes.body()), - new TypeReference() {}); - res.withAttachment(java.util.Optional.ofNullable(out)); - } else { - throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); - } - } else if (httpRes.statusCode() == 400 || httpRes.statusCode() == 401 || httpRes.statusCode() == 402 || httpRes.statusCode() == 403 || httpRes.statusCode() == 404 || httpRes.statusCode() == 429 || httpRes.statusCode() == 500 || httpRes.statusCode() == 503) { - if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { - ObjectMapper mapper = JSON.getMapper(); - io.codat.sync.expenses.models.components.ErrorMessage out = mapper.readValue( - Utils.toUtf8AndClose(httpRes.body()), - new TypeReference() {}); - res.withErrorMessage(java.util.Optional.ofNullable(out)); - } else { - throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); - } - } - - return res; - } - } diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/Reimbursements.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Reimbursements.java new file mode 100644 index 00000000..148d2791 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Reimbursements.java @@ -0,0 +1,272 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.codat.sync.expenses.models.errors.SDKError; +import io.codat.sync.expenses.models.operations.SDKMethodInterfaces.*; +import io.codat.sync.expenses.utils.HTTPClient; +import io.codat.sync.expenses.utils.HTTPRequest; +import io.codat.sync.expenses.utils.JSON; +import io.codat.sync.expenses.utils.Options; +import io.codat.sync.expenses.utils.SerializedBody; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Create reimbursable expense transactions. + */ +public class Reimbursements implements + MethodCallCreateReimbursableExpenseTransaction, + MethodCallUpdateReimbursableExpenseTransaction { + + private final SDKConfiguration sdkConfiguration; + + Reimbursements(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequestBuilder create() { + return new io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequestBuilder(this); + } + + /** + * Create reimbursable expense transaction + * Use the *Create reimbursable expense* endpoint to create a [reimbursement request](https://docs.codat.io/sync-for-expenses-api#/schemas/Reimburseable-Expense-Transactions) in the accounting platform for a given company's connection. + * + * Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. + * @param request The request object containing all of the parameters for the API call. + * @param options additional options + * @return The response from the API call. + * @throws Exception if the API call fails. + */ + public io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionResponse create( + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequest request, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + + + String baseUrl = this.sdkConfiguration.serverUrl; + + String url = io.codat.sync.expenses.utils.Utils.generateURL( + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequest.class, + baseUrl, + "/companies/{companyId}/sync/expenses/reimbursable-expense-transactions", + request, null); + + HTTPRequest req = new HTTPRequest(); + req.setMethod("POST"); + req.setURL(url); + Object _convertedRequest = Utils.convertToShape(request, Utils.JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody serializedRequestBody = io.codat.sync.expenses.utils.Utils.serializeRequestBody( + _convertedRequest, "createReimbursableExpenseRequest", "json", false); + req.setBody(serializedRequestBody); + + req.addHeader("Accept", "application/json"); + req.addHeader("user-agent", this.sdkConfiguration.userAgent); + + HTTPClient client = io.codat.sync.expenses.utils.Utils.configureSecurityClient( + this.sdkConfiguration.defaultClient, this.sdkConfiguration.securitySource.getSecurity()); + + io.codat.sync.expenses.utils.RetryConfig retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig.isPresent()) { + retryConfig = this.sdkConfiguration.retryConfig.get(); + } else { + retryConfig = io.codat.sync.expenses.utils.RetryConfig.builder() + .backoff(io.codat.sync.expenses.utils.BackoffStrategy.builder() + .initialInterval(500L, java.util.concurrent.TimeUnit.MILLISECONDS) + .maxInterval(60000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .baseFactor((double)(1.5)) + .maxElapsedTime(3600000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + + List statusCodes = new java.util.ArrayList(); + statusCodes.add("408"); + statusCodes.add("429"); + statusCodes.add("5XX"); + io.codat.sync.expenses.utils.Retries retries = io.codat.sync.expenses.utils.Retries.builder() + .action(() -> client.send(req)) + .retryConfig(retryConfig) + .statusCodes(statusCodes) + .build(); + + HttpResponse httpRes = retries.run(); + + String contentType = httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionResponse.Builder resBuilder = + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionResponse + .builder() + .contentType(contentType) + .statusCode(httpRes.statusCode()) + .rawResponse(httpRes); + + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionResponse res = resBuilder.build(); + + res.withRawResponse(httpRes); + + if (httpRes.statusCode() == 200) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.CreateReimbursableExpenseResponse out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withCreateReimbursableExpenseResponse(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } else if (httpRes.statusCode() == 400 || httpRes.statusCode() == 401 || httpRes.statusCode() == 402 || httpRes.statusCode() == 403 || httpRes.statusCode() == 404 || httpRes.statusCode() == 429 || httpRes.statusCode() == 500 || httpRes.statusCode() == 503) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.ErrorMessage out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withErrorMessage(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } + + return res; + } + + + public io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequestBuilder update() { + return new io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequestBuilder(this); + } + + /** + * Update reimbursable expense transaction + * The *Update reimbursable expense* endpoint updates an existing [reimbursable expense transaction](https://docs.codat.io/sync-for-expenses-api#/operations/create-reimbursable-expense-transaction) in the accounting platform for a given company's connection. + * + * Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. + * @param request The request object containing all of the parameters for the API call. + * @param options additional options + * @return The response from the API call. + * @throws Exception if the API call fails. + */ + public io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionResponse update( + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequest request, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + + + String baseUrl = this.sdkConfiguration.serverUrl; + + String url = io.codat.sync.expenses.utils.Utils.generateURL( + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequest.class, + baseUrl, + "/companies/{companyId}/sync/expenses/reimbursable-expense-transactions/{transactionId}", + request, null); + + HTTPRequest req = new HTTPRequest(); + req.setMethod("PUT"); + req.setURL(url); + Object _convertedRequest = Utils.convertToShape(request, Utils.JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody serializedRequestBody = io.codat.sync.expenses.utils.Utils.serializeRequestBody( + _convertedRequest, "createReimbursableExpenseRequest", "json", false); + req.setBody(serializedRequestBody); + + req.addHeader("Accept", "application/json"); + req.addHeader("user-agent", this.sdkConfiguration.userAgent); + + HTTPClient client = io.codat.sync.expenses.utils.Utils.configureSecurityClient( + this.sdkConfiguration.defaultClient, this.sdkConfiguration.securitySource.getSecurity()); + + io.codat.sync.expenses.utils.RetryConfig retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig.isPresent()) { + retryConfig = this.sdkConfiguration.retryConfig.get(); + } else { + retryConfig = io.codat.sync.expenses.utils.RetryConfig.builder() + .backoff(io.codat.sync.expenses.utils.BackoffStrategy.builder() + .initialInterval(500L, java.util.concurrent.TimeUnit.MILLISECONDS) + .maxInterval(60000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .baseFactor((double)(1.5)) + .maxElapsedTime(3600000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + + List statusCodes = new java.util.ArrayList(); + statusCodes.add("408"); + statusCodes.add("429"); + statusCodes.add("5XX"); + io.codat.sync.expenses.utils.Retries retries = io.codat.sync.expenses.utils.Retries.builder() + .action(() -> client.send(req)) + .retryConfig(retryConfig) + .statusCodes(statusCodes) + .build(); + + HttpResponse httpRes = retries.run(); + + String contentType = httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionResponse.Builder resBuilder = + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionResponse + .builder() + .contentType(contentType) + .statusCode(httpRes.statusCode()) + .rawResponse(httpRes); + + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionResponse res = resBuilder.build(); + + res.withRawResponse(httpRes); + + if (httpRes.statusCode() == 200) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.CreateReimbursableExpenseResponse out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withCreateReimbursableExpenseResponse(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } else if (httpRes.statusCode() == 400 || httpRes.statusCode() == 401 || httpRes.statusCode() == 402 || httpRes.statusCode() == 403 || httpRes.statusCode() == 404 || httpRes.statusCode() == 429 || httpRes.statusCode() == 500 || httpRes.statusCode() == 503) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.ErrorMessage out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withErrorMessage(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } + + return res; + } + +} diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/SDKConfiguration.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/SDKConfiguration.java index a9fd6afa..0ca58f81 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/SDKConfiguration.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/SDKConfiguration.java @@ -16,9 +16,9 @@ class SDKConfiguration { public int serverIdx = 0; public String language = "java"; public String openapiDocVersion = "prealpha"; - public String sdkVersion = "0.2.0"; - public String genVersion = "2.286.2"; - public String userAgent = "speakeasy-sdk/java 0.2.0 2.286.2 prealpha io.codat.sync.expenses"; + public String sdkVersion = "0.2.1"; + public String genVersion = "2.301.2"; + public String userAgent = "speakeasy-sdk/java 0.2.1 2.301.2 prealpha io.codat.sync.expenses"; public Optional retryConfig = Optional.empty(); diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/Transfers.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Transfers.java new file mode 100644 index 00000000..815b91e8 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/Transfers.java @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.codat.sync.expenses.models.errors.SDKError; +import io.codat.sync.expenses.models.operations.SDKMethodInterfaces.*; +import io.codat.sync.expenses.utils.HTTPClient; +import io.codat.sync.expenses.utils.HTTPRequest; +import io.codat.sync.expenses.utils.JSON; +import io.codat.sync.expenses.utils.Options; +import io.codat.sync.expenses.utils.SerializedBody; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Create transfer transactions. + */ +public class Transfers implements + MethodCallCreateTransferTransaction { + + private final SDKConfiguration sdkConfiguration; + + Transfers(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public io.codat.sync.expenses.models.operations.CreateTransferTransactionRequestBuilder create() { + return new io.codat.sync.expenses.models.operations.CreateTransferTransactionRequestBuilder(this); + } + + /** + * Create transfer transaction + * Use the *Create transfer* endpoint to create or update a [transfer transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/TransferTransaction) in the accounting platform for a given company's connection. + * + * Transfers record the movement of money between two bank accounts, or between a bank account and a nominal account. Use them to represent actions such as topping up a debit card account or a balance transfer to another credit card. + * + * The `from.amount` and `to.amount` fields are in the native currency of the account. + * + * @param request The request object containing all of the parameters for the API call. + * @param options additional options + * @return The response from the API call. + * @throws Exception if the API call fails. + */ + public io.codat.sync.expenses.models.operations.CreateTransferTransactionResponse create( + io.codat.sync.expenses.models.operations.CreateTransferTransactionRequest request, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + + + String baseUrl = this.sdkConfiguration.serverUrl; + + String url = io.codat.sync.expenses.utils.Utils.generateURL( + io.codat.sync.expenses.models.operations.CreateTransferTransactionRequest.class, + baseUrl, + "/companies/{companyId}/sync/expenses/transfer-transactions/{transactionId}", + request, null); + + HTTPRequest req = new HTTPRequest(); + req.setMethod("PUT"); + req.setURL(url); + Object _convertedRequest = Utils.convertToShape(request, Utils.JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody serializedRequestBody = io.codat.sync.expenses.utils.Utils.serializeRequestBody( + _convertedRequest, "createTransferRequest", "json", false); + req.setBody(serializedRequestBody); + + req.addHeader("Accept", "application/json"); + req.addHeader("user-agent", this.sdkConfiguration.userAgent); + + HTTPClient client = io.codat.sync.expenses.utils.Utils.configureSecurityClient( + this.sdkConfiguration.defaultClient, this.sdkConfiguration.securitySource.getSecurity()); + + io.codat.sync.expenses.utils.RetryConfig retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig.isPresent()) { + retryConfig = this.sdkConfiguration.retryConfig.get(); + } else { + retryConfig = io.codat.sync.expenses.utils.RetryConfig.builder() + .backoff(io.codat.sync.expenses.utils.BackoffStrategy.builder() + .initialInterval(500L, java.util.concurrent.TimeUnit.MILLISECONDS) + .maxInterval(60000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .baseFactor((double)(1.5)) + .maxElapsedTime(3600000L, java.util.concurrent.TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + + List statusCodes = new java.util.ArrayList(); + statusCodes.add("408"); + statusCodes.add("429"); + statusCodes.add("5XX"); + io.codat.sync.expenses.utils.Retries retries = io.codat.sync.expenses.utils.Retries.builder() + .action(() -> client.send(req)) + .retryConfig(retryConfig) + .statusCodes(statusCodes) + .build(); + + HttpResponse httpRes = retries.run(); + + String contentType = httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + io.codat.sync.expenses.models.operations.CreateTransferTransactionResponse.Builder resBuilder = + io.codat.sync.expenses.models.operations.CreateTransferTransactionResponse + .builder() + .contentType(contentType) + .statusCode(httpRes.statusCode()) + .rawResponse(httpRes); + + io.codat.sync.expenses.models.operations.CreateTransferTransactionResponse res = resBuilder.build(); + + res.withRawResponse(httpRes); + + if (httpRes.statusCode() == 200) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.CreateTransferResponse out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withCreateTransferResponse(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } else if (httpRes.statusCode() == 400 || httpRes.statusCode() == 401 || httpRes.statusCode() == 402 || httpRes.statusCode() == 403 || httpRes.statusCode() == 404 || httpRes.statusCode() == 429 || httpRes.statusCode() == 500 || httpRes.statusCode() == 503) { + if (io.codat.sync.expenses.utils.Utils.matchContentType(contentType, "application/json")) { + ObjectMapper mapper = JSON.getMapper(); + io.codat.sync.expenses.models.components.ErrorMessage out = mapper.readValue( + Utils.toUtf8AndClose(httpRes.body()), + new TypeReference() {}); + res.withErrorMessage(java.util.Optional.ofNullable(out)); + } else { + throw new SDKError(httpRes, httpRes.statusCode(), "Unknown content-type received: " + contentType, Utils.toByteArrayAndClose(httpRes.body())); + } + } + + return res; + } + +} diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/AccountRef.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/AccountRef.java new file mode 100644 index 00000000..276eaf63 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/AccountRef.java @@ -0,0 +1,183 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + +/** + * AccountRef - Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + +public class AccountRef { + + /** + * 'id' from the Accounts data type. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("id") + private Optional id; + + /** + * 'name' from the Accounts data type. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private Optional name; + + public AccountRef( + @JsonProperty("id") Optional id, + @JsonProperty("name") Optional name) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(name, "name"); + this.id = id; + this.name = name; + } + + /** + * 'id' from the Accounts data type. + */ + public Optional id() { + return id; + } + + /** + * 'name' from the Accounts data type. + */ + public Optional name() { + return name; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * 'id' from the Accounts data type. + */ + public AccountRef withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * 'id' from the Accounts data type. + */ + public AccountRef withId(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * 'name' from the Accounts data type. + */ + public AccountRef withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + /** + * 'name' from the Accounts data type. + */ + public AccountRef withName(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRef other = (AccountRef) o; + return + java.util.Objects.deepEquals(this.id, other.id) && + java.util.Objects.deepEquals(this.name, other.name); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + id, + name); + } + + @Override + public String toString() { + return Utils.toString(AccountRef.class, + "id", id, + "name", name); + } + + public final static class Builder { + + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * 'id' from the Accounts data type. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * 'id' from the Accounts data type. + */ + public Builder id(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * 'name' from the Accounts data type. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + /** + * 'name' from the Accounts data type. + */ + public Builder name(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + public AccountRef build() { + return new AccountRef( + id, + name); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseRequest.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseRequest.java new file mode 100644 index 00000000..5799dcfc --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseRequest.java @@ -0,0 +1,103 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class CreateReimbursableExpenseRequest { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("items") + private Optional>> items; + + public CreateReimbursableExpenseRequest( + @JsonProperty("items") Optional>> items) { + Utils.checkNotNull(items, "items"); + this.items = items; + } + + public Optional>> items() { + return items; + } + + public final static Builder builder() { + return new Builder(); + } + + public CreateReimbursableExpenseRequest withItems(java.util.List> items) { + Utils.checkNotNull(items, "items"); + this.items = Optional.ofNullable(items); + return this; + } + + public CreateReimbursableExpenseRequest withItems(Optional>> items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReimbursableExpenseRequest other = (CreateReimbursableExpenseRequest) o; + return + java.util.Objects.deepEquals(this.items, other.items); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + items); + } + + @Override + public String toString() { + return Utils.toString(CreateReimbursableExpenseRequest.class, + "items", items); + } + + public final static class Builder { + + private Optional>> items = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + public Builder items(java.util.List> items) { + Utils.checkNotNull(items, "items"); + this.items = Optional.ofNullable(items); + return this; + } + + public Builder items(Optional>> items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + public CreateReimbursableExpenseRequest build() { + return new CreateReimbursableExpenseRequest( + items); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseResponse.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseResponse.java new file mode 100644 index 00000000..614049d6 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateReimbursableExpenseResponse.java @@ -0,0 +1,121 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class CreateReimbursableExpenseResponse { + + /** + * Unique id of sync created + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("syncId") + private Optional syncId; + + public CreateReimbursableExpenseResponse( + @JsonProperty("syncId") Optional syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = syncId; + } + + /** + * Unique id of sync created + */ + public Optional syncId() { + return syncId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Unique id of sync created + */ + public CreateReimbursableExpenseResponse withSyncId(String syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = Optional.ofNullable(syncId); + return this; + } + + /** + * Unique id of sync created + */ + public CreateReimbursableExpenseResponse withSyncId(Optional syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = syncId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReimbursableExpenseResponse other = (CreateReimbursableExpenseResponse) o; + return + java.util.Objects.deepEquals(this.syncId, other.syncId); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + syncId); + } + + @Override + public String toString() { + return Utils.toString(CreateReimbursableExpenseResponse.class, + "syncId", syncId); + } + + public final static class Builder { + + private Optional syncId = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Unique id of sync created + */ + public Builder syncId(String syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = Optional.ofNullable(syncId); + return this; + } + + /** + * Unique id of sync created + */ + public Builder syncId(Optional syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = syncId; + return this; + } + + public CreateReimbursableExpenseResponse build() { + return new CreateReimbursableExpenseResponse( + syncId); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateTransferRequest.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateTransferRequest.java new file mode 100644 index 00000000..c94d0a27 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateTransferRequest.java @@ -0,0 +1,244 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class CreateTransferRequest { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("date") + private Optional date; + + /** + * Any private, company notes about the transaction. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("description") + private Optional description; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("from") + private Optional from; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("to") + private Optional to; + + public CreateTransferRequest( + @JsonProperty("date") Optional date, + @JsonProperty("description") Optional description, + @JsonProperty("from") Optional from, + @JsonProperty("to") Optional to) { + Utils.checkNotNull(date, "date"); + Utils.checkNotNull(description, "description"); + Utils.checkNotNull(from, "from"); + Utils.checkNotNull(to, "to"); + this.date = date; + this.description = description; + this.from = from; + this.to = to; + } + + public Optional date() { + return date; + } + + /** + * Any private, company notes about the transaction. + */ + public Optional description() { + return description; + } + + public Optional from() { + return from; + } + + public Optional to() { + return to; + } + + public final static Builder builder() { + return new Builder(); + } + + public CreateTransferRequest withDate(String date) { + Utils.checkNotNull(date, "date"); + this.date = Optional.ofNullable(date); + return this; + } + + public CreateTransferRequest withDate(Optional date) { + Utils.checkNotNull(date, "date"); + this.date = date; + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public CreateTransferRequest withDescription(String description) { + Utils.checkNotNull(description, "description"); + this.description = Optional.ofNullable(description); + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public CreateTransferRequest withDescription(Optional description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + public CreateTransferRequest withFrom(TransferDetails from) { + Utils.checkNotNull(from, "from"); + this.from = Optional.ofNullable(from); + return this; + } + + public CreateTransferRequest withFrom(Optional from) { + Utils.checkNotNull(from, "from"); + this.from = from; + return this; + } + + public CreateTransferRequest withTo(TransferDetails to) { + Utils.checkNotNull(to, "to"); + this.to = Optional.ofNullable(to); + return this; + } + + public CreateTransferRequest withTo(Optional to) { + Utils.checkNotNull(to, "to"); + this.to = to; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransferRequest other = (CreateTransferRequest) o; + return + java.util.Objects.deepEquals(this.date, other.date) && + java.util.Objects.deepEquals(this.description, other.description) && + java.util.Objects.deepEquals(this.from, other.from) && + java.util.Objects.deepEquals(this.to, other.to); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + date, + description, + from, + to); + } + + @Override + public String toString() { + return Utils.toString(CreateTransferRequest.class, + "date", date, + "description", description, + "from", from, + "to", to); + } + + public final static class Builder { + + private Optional date = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional from = Optional.empty(); + + private Optional to = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + public Builder date(String date) { + Utils.checkNotNull(date, "date"); + this.date = Optional.ofNullable(date); + return this; + } + + public Builder date(Optional date) { + Utils.checkNotNull(date, "date"); + this.date = date; + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public Builder description(String description) { + Utils.checkNotNull(description, "description"); + this.description = Optional.ofNullable(description); + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public Builder description(Optional description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + public Builder from(TransferDetails from) { + Utils.checkNotNull(from, "from"); + this.from = Optional.ofNullable(from); + return this; + } + + public Builder from(Optional from) { + Utils.checkNotNull(from, "from"); + this.from = from; + return this; + } + + public Builder to(TransferDetails to) { + Utils.checkNotNull(to, "to"); + this.to = Optional.ofNullable(to); + return this; + } + + public Builder to(Optional to) { + Utils.checkNotNull(to, "to"); + this.to = to; + return this; + } + + public CreateTransferRequest build() { + return new CreateTransferRequest( + date, + description, + from, + to); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateTransferResponse.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateTransferResponse.java new file mode 100644 index 00000000..5695cd2d --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/CreateTransferResponse.java @@ -0,0 +1,121 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class CreateTransferResponse { + + /** + * Unique id of sync created + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("syncId") + private Optional syncId; + + public CreateTransferResponse( + @JsonProperty("syncId") Optional syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = syncId; + } + + /** + * Unique id of sync created + */ + public Optional syncId() { + return syncId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Unique id of sync created + */ + public CreateTransferResponse withSyncId(String syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = Optional.ofNullable(syncId); + return this; + } + + /** + * Unique id of sync created + */ + public CreateTransferResponse withSyncId(Optional syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = syncId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransferResponse other = (CreateTransferResponse) o; + return + java.util.Objects.deepEquals(this.syncId, other.syncId); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + syncId); + } + + @Override + public String toString() { + return Utils.toString(CreateTransferResponse.class, + "syncId", syncId); + } + + public final static class Builder { + + private Optional syncId = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Unique id of sync created + */ + public Builder syncId(String syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = Optional.ofNullable(syncId); + return this; + } + + /** + * Unique id of sync created + */ + public Builder syncId(Optional syncId) { + Utils.checkNotNull(syncId, "syncId"); + this.syncId = syncId; + return this; + } + + public CreateTransferResponse build() { + return new CreateTransferResponse( + syncId); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransaction.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransaction.java index 20821e85..7bbfc71e 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransaction.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransaction.java @@ -22,7 +22,7 @@ public class ExpenseTransaction { @JsonInclude(Include.NON_ABSENT) @JsonProperty("bankAccountRef") - private Optional bankAccountRef; + private Optional bankAccountRef; @JsonInclude(Include.NON_ABSENT) @JsonProperty("contactRef") @@ -137,7 +137,7 @@ public class ExpenseTransaction { private ExpenseTransactionType type; public ExpenseTransaction( - @JsonProperty("bankAccountRef") Optional bankAccountRef, + @JsonProperty("bankAccountRef") Optional bankAccountRef, @JsonProperty("contactRef") Optional contactRef, @JsonProperty("currency") String currency, @JsonProperty("currencyRate") JsonNullable currencyRate, @@ -172,7 +172,7 @@ public ExpenseTransaction( this.type = type; } - public Optional bankAccountRef() { + public Optional bankAccountRef() { return bankAccountRef; } @@ -296,13 +296,13 @@ public final static Builder builder() { return new Builder(); } - public ExpenseTransaction withBankAccountRef(BankAccountReference bankAccountRef) { + public ExpenseTransaction withBankAccountRef(ExpenseTransactionBankAccountReference bankAccountRef) { Utils.checkNotNull(bankAccountRef, "bankAccountRef"); this.bankAccountRef = Optional.ofNullable(bankAccountRef); return this; } - public ExpenseTransaction withBankAccountRef(Optional bankAccountRef) { + public ExpenseTransaction withBankAccountRef(Optional bankAccountRef) { Utils.checkNotNull(bankAccountRef, "bankAccountRef"); this.bankAccountRef = bankAccountRef; return this; @@ -622,7 +622,7 @@ public String toString() { public final static class Builder { - private Optional bankAccountRef = Optional.empty(); + private Optional bankAccountRef = Optional.empty(); private Optional contactRef = Optional.empty(); @@ -648,13 +648,13 @@ private Builder() { // force use of static builder() method } - public Builder bankAccountRef(BankAccountReference bankAccountRef) { + public Builder bankAccountRef(ExpenseTransactionBankAccountReference bankAccountRef) { Utils.checkNotNull(bankAccountRef, "bankAccountRef"); this.bankAccountRef = Optional.ofNullable(bankAccountRef); return this; } - public Builder bankAccountRef(Optional bankAccountRef) { + public Builder bankAccountRef(Optional bankAccountRef) { Utils.checkNotNull(bankAccountRef, "bankAccountRef"); this.bankAccountRef = bankAccountRef; return this; diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransactionBankAccountReference.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransactionBankAccountReference.java new file mode 100644 index 00000000..e8f19b14 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ExpenseTransactionBankAccountReference.java @@ -0,0 +1,121 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class ExpenseTransactionBankAccountReference { + + /** + * Identifier of the bank account. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("id") + private Optional id; + + public ExpenseTransactionBankAccountReference( + @JsonProperty("id") Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + } + + /** + * Identifier of the bank account. + */ + public Optional id() { + return id; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Identifier of the bank account. + */ + public ExpenseTransactionBankAccountReference withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Identifier of the bank account. + */ + public ExpenseTransactionBankAccountReference withId(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExpenseTransactionBankAccountReference other = (ExpenseTransactionBankAccountReference) o; + return + java.util.Objects.deepEquals(this.id, other.id); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + id); + } + + @Override + public String toString() { + return Utils.toString(ExpenseTransactionBankAccountReference.class, + "id", id); + } + + public final static class Builder { + + private Optional id = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Identifier of the bank account. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Identifier of the bank account. + */ + public Builder id(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public ExpenseTransactionBankAccountReference build() { + return new ExpenseTransactionBankAccountReference( + id); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/RecordRef.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/RecordRef.java index 941edd14..6428ed35 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/RecordRef.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/RecordRef.java @@ -20,7 +20,7 @@ public class RecordRef { /** - * identifier of linked reference from mapping options. + * Identifier of linked reference from mapping options. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("id") @@ -33,7 +33,7 @@ public RecordRef( } /** - * identifier of linked reference from mapping options. + * Identifier of linked reference from mapping options. */ public Optional id() { return id; @@ -44,7 +44,7 @@ public final static Builder builder() { } /** - * identifier of linked reference from mapping options. + * Identifier of linked reference from mapping options. */ public RecordRef withId(String id) { Utils.checkNotNull(id, "id"); @@ -53,7 +53,7 @@ public RecordRef withId(String id) { } /** - * identifier of linked reference from mapping options. + * Identifier of linked reference from mapping options. */ public RecordRef withId(Optional id) { Utils.checkNotNull(id, "id"); @@ -95,7 +95,7 @@ private Builder() { } /** - * identifier of linked reference from mapping options. + * Identifier of linked reference from mapping options. */ public Builder id(String id) { Utils.checkNotNull(id, "id"); @@ -104,7 +104,7 @@ public Builder id(String id) { } /** - * identifier of linked reference from mapping options. + * Identifier of linked reference from mapping options. */ public Builder id(Optional id) { Utils.checkNotNull(id, "id"); diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransaction.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransaction.java new file mode 100644 index 00000000..7b0ee73d --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransaction.java @@ -0,0 +1,906 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class ReimbursableExpenseTransaction { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("allOf") + private Optional allOf; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("bankAccountRef") + private Optional bankAccountRef; + + /** + * Currency the transaction was recorded in. + */ + @JsonProperty("currency") + private String currency; + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("currencyRate") + private JsonNullable currencyRate; + + @JsonProperty("dueDate") + private java.lang.Object dueDate; + + /** + * Your unique identifier for the transaction. + */ + @JsonProperty("id") + private String id; + + /** + * In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: + * + * ``` + * 2020-10-08T22:40:50Z + * 2021-01-01T00:00:00 + * ``` + * + * + * + * When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + * + * - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + * - Unqualified local time: `2021-11-15T01:00:00` + * - UTC time offsets: `2021-11-15T01:00:00-05:00` + * + * > Time zones + * > + * > Not all dates from Codat will contain information about time zones. + * > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + */ + @JsonProperty("issueDate") + private String issueDate; + + /** + * Array of transaction lines. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("lines") + private Optional> lines; + + /** + * Any private, company notes about the transaction. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("notes") + private Optional notes; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("recordRef") + private Optional recordRef; + + /** + * User-friendly reference for the reimbursable expense. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("reference") + private JsonNullable reference; + + public ReimbursableExpenseTransaction( + @JsonProperty("allOf") Optional allOf, + @JsonProperty("bankAccountRef") Optional bankAccountRef, + @JsonProperty("currency") String currency, + @JsonProperty("currencyRate") JsonNullable currencyRate, + @JsonProperty("dueDate") java.lang.Object dueDate, + @JsonProperty("id") String id, + @JsonProperty("issueDate") String issueDate, + @JsonProperty("lines") Optional> lines, + @JsonProperty("notes") Optional notes, + @JsonProperty("recordRef") Optional recordRef, + @JsonProperty("reference") JsonNullable reference) { + Utils.checkNotNull(allOf, "allOf"); + Utils.checkNotNull(bankAccountRef, "bankAccountRef"); + Utils.checkNotNull(currency, "currency"); + Utils.checkNotNull(currencyRate, "currencyRate"); + Utils.checkNotNull(dueDate, "dueDate"); + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(issueDate, "issueDate"); + Utils.checkNotNull(lines, "lines"); + Utils.checkNotNull(notes, "notes"); + Utils.checkNotNull(recordRef, "recordRef"); + Utils.checkNotNull(reference, "reference"); + this.allOf = allOf; + this.bankAccountRef = bankAccountRef; + this.currency = currency; + this.currencyRate = currencyRate; + this.dueDate = dueDate; + this.id = id; + this.issueDate = issueDate; + this.lines = lines; + this.notes = notes; + this.recordRef = recordRef; + this.reference = reference; + } + + public Optional allOf() { + return allOf; + } + + public Optional bankAccountRef() { + return bankAccountRef; + } + + /** + * Currency the transaction was recorded in. + */ + public String currency() { + return currency; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public JsonNullable currencyRate() { + return currencyRate; + } + + public java.lang.Object dueDate() { + return dueDate; + } + + /** + * Your unique identifier for the transaction. + */ + public String id() { + return id; + } + + /** + * In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: + * + * ``` + * 2020-10-08T22:40:50Z + * 2021-01-01T00:00:00 + * ``` + * + * + * + * When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + * + * - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + * - Unqualified local time: `2021-11-15T01:00:00` + * - UTC time offsets: `2021-11-15T01:00:00-05:00` + * + * > Time zones + * > + * > Not all dates from Codat will contain information about time zones. + * > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + */ + public String issueDate() { + return issueDate; + } + + /** + * Array of transaction lines. + */ + public Optional> lines() { + return lines; + } + + /** + * Any private, company notes about the transaction. + */ + public Optional notes() { + return notes; + } + + public Optional recordRef() { + return recordRef; + } + + /** + * User-friendly reference for the reimbursable expense. + */ + public JsonNullable reference() { + return reference; + } + + public final static Builder builder() { + return new Builder(); + } + + public ReimbursableExpenseTransaction withAllOf(java.lang.Object allOf) { + Utils.checkNotNull(allOf, "allOf"); + this.allOf = Optional.ofNullable(allOf); + return this; + } + + public ReimbursableExpenseTransaction withAllOf(Optional allOf) { + Utils.checkNotNull(allOf, "allOf"); + this.allOf = allOf; + return this; + } + + public ReimbursableExpenseTransaction withBankAccountRef(BankAccountReference bankAccountRef) { + Utils.checkNotNull(bankAccountRef, "bankAccountRef"); + this.bankAccountRef = Optional.ofNullable(bankAccountRef); + return this; + } + + public ReimbursableExpenseTransaction withBankAccountRef(Optional bankAccountRef) { + Utils.checkNotNull(bankAccountRef, "bankAccountRef"); + this.bankAccountRef = bankAccountRef; + return this; + } + + /** + * Currency the transaction was recorded in. + */ + public ReimbursableExpenseTransaction withCurrency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public ReimbursableExpenseTransaction withCurrencyRate(BigDecimal currencyRate) { + Utils.checkNotNull(currencyRate, "currencyRate"); + this.currencyRate = JsonNullable.of(currencyRate); + return this; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public ReimbursableExpenseTransaction withCurrencyRate(double currencyRate) { + this.currencyRate = JsonNullable.of(BigDecimal.valueOf(currencyRate)); + return this; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public ReimbursableExpenseTransaction withCurrencyRate(JsonNullable currencyRate) { + Utils.checkNotNull(currencyRate, "currencyRate"); + this.currencyRate = currencyRate; + return this; + } + + public ReimbursableExpenseTransaction withDueDate(java.lang.Object dueDate) { + Utils.checkNotNull(dueDate, "dueDate"); + this.dueDate = dueDate; + return this; + } + + /** + * Your unique identifier for the transaction. + */ + public ReimbursableExpenseTransaction withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: + * + * ``` + * 2020-10-08T22:40:50Z + * 2021-01-01T00:00:00 + * ``` + * + * + * + * When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + * + * - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + * - Unqualified local time: `2021-11-15T01:00:00` + * - UTC time offsets: `2021-11-15T01:00:00-05:00` + * + * > Time zones + * > + * > Not all dates from Codat will contain information about time zones. + * > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + */ + public ReimbursableExpenseTransaction withIssueDate(String issueDate) { + Utils.checkNotNull(issueDate, "issueDate"); + this.issueDate = issueDate; + return this; + } + + /** + * Array of transaction lines. + */ + public ReimbursableExpenseTransaction withLines(java.util.List lines) { + Utils.checkNotNull(lines, "lines"); + this.lines = Optional.ofNullable(lines); + return this; + } + + /** + * Array of transaction lines. + */ + public ReimbursableExpenseTransaction withLines(Optional> lines) { + Utils.checkNotNull(lines, "lines"); + this.lines = lines; + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public ReimbursableExpenseTransaction withNotes(String notes) { + Utils.checkNotNull(notes, "notes"); + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public ReimbursableExpenseTransaction withNotes(Optional notes) { + Utils.checkNotNull(notes, "notes"); + this.notes = notes; + return this; + } + + public ReimbursableExpenseTransaction withRecordRef(ContactRef recordRef) { + Utils.checkNotNull(recordRef, "recordRef"); + this.recordRef = Optional.ofNullable(recordRef); + return this; + } + + public ReimbursableExpenseTransaction withRecordRef(Optional recordRef) { + Utils.checkNotNull(recordRef, "recordRef"); + this.recordRef = recordRef; + return this; + } + + /** + * User-friendly reference for the reimbursable expense. + */ + public ReimbursableExpenseTransaction withReference(String reference) { + Utils.checkNotNull(reference, "reference"); + this.reference = JsonNullable.of(reference); + return this; + } + + /** + * User-friendly reference for the reimbursable expense. + */ + public ReimbursableExpenseTransaction withReference(JsonNullable reference) { + Utils.checkNotNull(reference, "reference"); + this.reference = reference; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReimbursableExpenseTransaction other = (ReimbursableExpenseTransaction) o; + return + java.util.Objects.deepEquals(this.allOf, other.allOf) && + java.util.Objects.deepEquals(this.bankAccountRef, other.bankAccountRef) && + java.util.Objects.deepEquals(this.currency, other.currency) && + java.util.Objects.deepEquals(this.currencyRate, other.currencyRate) && + java.util.Objects.deepEquals(this.dueDate, other.dueDate) && + java.util.Objects.deepEquals(this.id, other.id) && + java.util.Objects.deepEquals(this.issueDate, other.issueDate) && + java.util.Objects.deepEquals(this.lines, other.lines) && + java.util.Objects.deepEquals(this.notes, other.notes) && + java.util.Objects.deepEquals(this.recordRef, other.recordRef) && + java.util.Objects.deepEquals(this.reference, other.reference); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + allOf, + bankAccountRef, + currency, + currencyRate, + dueDate, + id, + issueDate, + lines, + notes, + recordRef, + reference); + } + + @Override + public String toString() { + return Utils.toString(ReimbursableExpenseTransaction.class, + "allOf", allOf, + "bankAccountRef", bankAccountRef, + "currency", currency, + "currencyRate", currencyRate, + "dueDate", dueDate, + "id", id, + "issueDate", issueDate, + "lines", lines, + "notes", notes, + "recordRef", recordRef, + "reference", reference); + } + + public final static class Builder { + + private Optional allOf = Optional.empty(); + + private Optional bankAccountRef = Optional.empty(); + + private String currency; + + private JsonNullable currencyRate = JsonNullable.undefined(); + + private java.lang.Object dueDate; + + private String id; + + private String issueDate; + + private Optional> lines = Optional.empty(); + + private Optional notes = Optional.empty(); + + private Optional recordRef = Optional.empty(); + + private JsonNullable reference = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + public Builder allOf(java.lang.Object allOf) { + Utils.checkNotNull(allOf, "allOf"); + this.allOf = Optional.ofNullable(allOf); + return this; + } + + public Builder allOf(Optional allOf) { + Utils.checkNotNull(allOf, "allOf"); + this.allOf = allOf; + return this; + } + + public Builder bankAccountRef(BankAccountReference bankAccountRef) { + Utils.checkNotNull(bankAccountRef, "bankAccountRef"); + this.bankAccountRef = Optional.ofNullable(bankAccountRef); + return this; + } + + public Builder bankAccountRef(Optional bankAccountRef) { + Utils.checkNotNull(bankAccountRef, "bankAccountRef"); + this.bankAccountRef = bankAccountRef; + return this; + } + + /** + * Currency the transaction was recorded in. + */ + public Builder currency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public Builder currencyRate(BigDecimal currencyRate) { + Utils.checkNotNull(currencyRate, "currencyRate"); + this.currencyRate = JsonNullable.of(currencyRate); + return this; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public Builder currencyRate(double currencyRate) { + this.currencyRate = JsonNullable.of(BigDecimal.valueOf(currencyRate)); + return this; + } + + /** + * Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + * + * Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + * + * It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + * + * Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + * + * For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + * + * ## Examples with base currency of GBP + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **USD** | $20 | 0.781 | £15.62 | + * | **EUR** | €20 | 0.885 | £17.70 | + * | **RUB** | ₽20 | 0.011 | £0.22 | + * + * ## Examples with base currency of USD + * + * | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + * | :--------------- | :------------- | :------------ | :------------------------- | + * | **GBP** | £20 | 1.277 | $25.54 | + * | **EUR** | €20 | 1.134 | $22.68 | + * | **RUB** | ₽20 | 0.015 | $0.30 | + * + * + * ### Integration-specific details + * + * | Integration | Scenario | System behavior | + * |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + */ + public Builder currencyRate(JsonNullable currencyRate) { + Utils.checkNotNull(currencyRate, "currencyRate"); + this.currencyRate = currencyRate; + return this; + } + + public Builder dueDate(java.lang.Object dueDate) { + Utils.checkNotNull(dueDate, "dueDate"); + this.dueDate = dueDate; + return this; + } + + /** + * Your unique identifier for the transaction. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: + * + * ``` + * 2020-10-08T22:40:50Z + * 2021-01-01T00:00:00 + * ``` + * + * + * + * When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + * + * - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + * - Unqualified local time: `2021-11-15T01:00:00` + * - UTC time offsets: `2021-11-15T01:00:00-05:00` + * + * > Time zones + * > + * > Not all dates from Codat will contain information about time zones. + * > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + */ + public Builder issueDate(String issueDate) { + Utils.checkNotNull(issueDate, "issueDate"); + this.issueDate = issueDate; + return this; + } + + /** + * Array of transaction lines. + */ + public Builder lines(java.util.List lines) { + Utils.checkNotNull(lines, "lines"); + this.lines = Optional.ofNullable(lines); + return this; + } + + /** + * Array of transaction lines. + */ + public Builder lines(Optional> lines) { + Utils.checkNotNull(lines, "lines"); + this.lines = lines; + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public Builder notes(String notes) { + Utils.checkNotNull(notes, "notes"); + this.notes = Optional.ofNullable(notes); + return this; + } + + /** + * Any private, company notes about the transaction. + */ + public Builder notes(Optional notes) { + Utils.checkNotNull(notes, "notes"); + this.notes = notes; + return this; + } + + public Builder recordRef(ContactRef recordRef) { + Utils.checkNotNull(recordRef, "recordRef"); + this.recordRef = Optional.ofNullable(recordRef); + return this; + } + + public Builder recordRef(Optional recordRef) { + Utils.checkNotNull(recordRef, "recordRef"); + this.recordRef = recordRef; + return this; + } + + /** + * User-friendly reference for the reimbursable expense. + */ + public Builder reference(String reference) { + Utils.checkNotNull(reference, "reference"); + this.reference = JsonNullable.of(reference); + return this; + } + + /** + * User-friendly reference for the reimbursable expense. + */ + public Builder reference(JsonNullable reference) { + Utils.checkNotNull(reference, "reference"); + this.reference = reference; + return this; + } + + public ReimbursableExpenseTransaction build() { + return new ReimbursableExpenseTransaction( + allOf, + bankAccountRef, + currency, + currencyRate, + dueDate, + id, + issueDate, + lines, + notes, + recordRef, + reference); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransactionLine.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransactionLine.java new file mode 100644 index 00000000..fb5f69a1 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/ReimbursableExpenseTransactionLine.java @@ -0,0 +1,363 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class ReimbursableExpenseTransactionLine { + + @JsonProperty("accountRef") + private RecordRef accountRef; + + /** + * Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("invoiceTo") + private JsonNullable invoiceTo; + + /** + * Amount of the line, exclusive of tax. + */ + @JsonProperty("netAmount") + private BigDecimal netAmount; + + /** + * Amount of tax for the line. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("taxAmount") + private Optional taxAmount; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("taxRateRef") + private Optional taxRateRef; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("trackingRefs") + private JsonNullable> trackingRefs; + + public ReimbursableExpenseTransactionLine( + @JsonProperty("accountRef") RecordRef accountRef, + @JsonProperty("invoiceTo") JsonNullable invoiceTo, + @JsonProperty("netAmount") BigDecimal netAmount, + @JsonProperty("taxAmount") Optional taxAmount, + @JsonProperty("taxRateRef") Optional taxRateRef, + @JsonProperty("trackingRefs") JsonNullable> trackingRefs) { + Utils.checkNotNull(accountRef, "accountRef"); + Utils.checkNotNull(invoiceTo, "invoiceTo"); + Utils.checkNotNull(netAmount, "netAmount"); + Utils.checkNotNull(taxAmount, "taxAmount"); + Utils.checkNotNull(taxRateRef, "taxRateRef"); + Utils.checkNotNull(trackingRefs, "trackingRefs"); + this.accountRef = accountRef; + this.invoiceTo = invoiceTo; + this.netAmount = netAmount; + this.taxAmount = taxAmount; + this.taxRateRef = taxRateRef; + this.trackingRefs = trackingRefs; + } + + public RecordRef accountRef() { + return accountRef; + } + + /** + * Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + */ + public JsonNullable invoiceTo() { + return invoiceTo; + } + + /** + * Amount of the line, exclusive of tax. + */ + public BigDecimal netAmount() { + return netAmount; + } + + /** + * Amount of tax for the line. + */ + public Optional taxAmount() { + return taxAmount; + } + + public Optional taxRateRef() { + return taxRateRef; + } + + public JsonNullable> trackingRefs() { + return trackingRefs; + } + + public final static Builder builder() { + return new Builder(); + } + + public ReimbursableExpenseTransactionLine withAccountRef(RecordRef accountRef) { + Utils.checkNotNull(accountRef, "accountRef"); + this.accountRef = accountRef; + return this; + } + + /** + * Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + */ + public ReimbursableExpenseTransactionLine withInvoiceTo(InvoiceTo invoiceTo) { + Utils.checkNotNull(invoiceTo, "invoiceTo"); + this.invoiceTo = JsonNullable.of(invoiceTo); + return this; + } + + /** + * Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + */ + public ReimbursableExpenseTransactionLine withInvoiceTo(JsonNullable invoiceTo) { + Utils.checkNotNull(invoiceTo, "invoiceTo"); + this.invoiceTo = invoiceTo; + return this; + } + + /** + * Amount of the line, exclusive of tax. + */ + public ReimbursableExpenseTransactionLine withNetAmount(double netAmount) { + this.netAmount = BigDecimal.valueOf(netAmount); + return this; + } + + /** + * Amount of the line, exclusive of tax. + */ + public ReimbursableExpenseTransactionLine withNetAmount(BigDecimal netAmount) { + Utils.checkNotNull(netAmount, "netAmount"); + this.netAmount = netAmount; + return this; + } + + /** + * Amount of tax for the line. + */ + public ReimbursableExpenseTransactionLine withTaxAmount(BigDecimal taxAmount) { + Utils.checkNotNull(taxAmount, "taxAmount"); + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + * Amount of tax for the line. + */ + public ReimbursableExpenseTransactionLine withTaxAmount(double taxAmount) { + this.taxAmount = Optional.of(BigDecimal.valueOf(taxAmount)); + return this; + } + + /** + * Amount of tax for the line. + */ + public ReimbursableExpenseTransactionLine withTaxAmount(Optional taxAmount) { + Utils.checkNotNull(taxAmount, "taxAmount"); + this.taxAmount = taxAmount; + return this; + } + + public ReimbursableExpenseTransactionLine withTaxRateRef(RecordRef taxRateRef) { + Utils.checkNotNull(taxRateRef, "taxRateRef"); + this.taxRateRef = Optional.ofNullable(taxRateRef); + return this; + } + + public ReimbursableExpenseTransactionLine withTaxRateRef(Optional taxRateRef) { + Utils.checkNotNull(taxRateRef, "taxRateRef"); + this.taxRateRef = taxRateRef; + return this; + } + + public ReimbursableExpenseTransactionLine withTrackingRefs(java.util.List trackingRefs) { + Utils.checkNotNull(trackingRefs, "trackingRefs"); + this.trackingRefs = JsonNullable.of(trackingRefs); + return this; + } + + public ReimbursableExpenseTransactionLine withTrackingRefs(JsonNullable> trackingRefs) { + Utils.checkNotNull(trackingRefs, "trackingRefs"); + this.trackingRefs = trackingRefs; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReimbursableExpenseTransactionLine other = (ReimbursableExpenseTransactionLine) o; + return + java.util.Objects.deepEquals(this.accountRef, other.accountRef) && + java.util.Objects.deepEquals(this.invoiceTo, other.invoiceTo) && + java.util.Objects.deepEquals(this.netAmount, other.netAmount) && + java.util.Objects.deepEquals(this.taxAmount, other.taxAmount) && + java.util.Objects.deepEquals(this.taxRateRef, other.taxRateRef) && + java.util.Objects.deepEquals(this.trackingRefs, other.trackingRefs); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + accountRef, + invoiceTo, + netAmount, + taxAmount, + taxRateRef, + trackingRefs); + } + + @Override + public String toString() { + return Utils.toString(ReimbursableExpenseTransactionLine.class, + "accountRef", accountRef, + "invoiceTo", invoiceTo, + "netAmount", netAmount, + "taxAmount", taxAmount, + "taxRateRef", taxRateRef, + "trackingRefs", trackingRefs); + } + + public final static class Builder { + + private RecordRef accountRef; + + private JsonNullable invoiceTo = JsonNullable.undefined(); + + private BigDecimal netAmount; + + private Optional taxAmount = Optional.empty(); + + private Optional taxRateRef = Optional.empty(); + + private JsonNullable> trackingRefs = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + public Builder accountRef(RecordRef accountRef) { + Utils.checkNotNull(accountRef, "accountRef"); + this.accountRef = accountRef; + return this; + } + + /** + * Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + */ + public Builder invoiceTo(InvoiceTo invoiceTo) { + Utils.checkNotNull(invoiceTo, "invoiceTo"); + this.invoiceTo = JsonNullable.of(invoiceTo); + return this; + } + + /** + * Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + */ + public Builder invoiceTo(JsonNullable invoiceTo) { + Utils.checkNotNull(invoiceTo, "invoiceTo"); + this.invoiceTo = invoiceTo; + return this; + } + + /** + * Amount of the line, exclusive of tax. + */ + public Builder netAmount(double netAmount) { + this.netAmount = BigDecimal.valueOf(netAmount); + return this; + } + + /** + * Amount of the line, exclusive of tax. + */ + public Builder netAmount(BigDecimal netAmount) { + Utils.checkNotNull(netAmount, "netAmount"); + this.netAmount = netAmount; + return this; + } + + /** + * Amount of tax for the line. + */ + public Builder taxAmount(BigDecimal taxAmount) { + Utils.checkNotNull(taxAmount, "taxAmount"); + this.taxAmount = Optional.ofNullable(taxAmount); + return this; + } + + /** + * Amount of tax for the line. + */ + public Builder taxAmount(double taxAmount) { + this.taxAmount = Optional.of(BigDecimal.valueOf(taxAmount)); + return this; + } + + /** + * Amount of tax for the line. + */ + public Builder taxAmount(Optional taxAmount) { + Utils.checkNotNull(taxAmount, "taxAmount"); + this.taxAmount = taxAmount; + return this; + } + + public Builder taxRateRef(RecordRef taxRateRef) { + Utils.checkNotNull(taxRateRef, "taxRateRef"); + this.taxRateRef = Optional.ofNullable(taxRateRef); + return this; + } + + public Builder taxRateRef(Optional taxRateRef) { + Utils.checkNotNull(taxRateRef, "taxRateRef"); + this.taxRateRef = taxRateRef; + return this; + } + + public Builder trackingRefs(java.util.List trackingRefs) { + Utils.checkNotNull(trackingRefs, "trackingRefs"); + this.trackingRefs = JsonNullable.of(trackingRefs); + return this; + } + + public Builder trackingRefs(JsonNullable> trackingRefs) { + Utils.checkNotNull(trackingRefs, "trackingRefs"); + this.trackingRefs = trackingRefs; + return this; + } + + public ReimbursableExpenseTransactionLine build() { + return new ReimbursableExpenseTransactionLine( + accountRef, + invoiceTo, + netAmount, + taxAmount, + taxRateRef, + trackingRefs); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/TransferDetails.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/TransferDetails.java new file mode 100644 index 00000000..ae029703 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/components/TransferDetails.java @@ -0,0 +1,196 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.components; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class TransferDetails { + + /** + * Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountRef") + private Optional accountRef; + + /** + * Amount of the transfer. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("amount") + private Optional amount; + + public TransferDetails( + @JsonProperty("accountRef") Optional accountRef, + @JsonProperty("amount") Optional amount) { + Utils.checkNotNull(accountRef, "accountRef"); + Utils.checkNotNull(amount, "amount"); + this.accountRef = accountRef; + this.amount = amount; + } + + /** + * Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + public Optional accountRef() { + return accountRef; + } + + /** + * Amount of the transfer. + */ + public Optional amount() { + return amount; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + public TransferDetails withAccountRef(AccountRef accountRef) { + Utils.checkNotNull(accountRef, "accountRef"); + this.accountRef = Optional.ofNullable(accountRef); + return this; + } + + /** + * Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + public TransferDetails withAccountRef(Optional accountRef) { + Utils.checkNotNull(accountRef, "accountRef"); + this.accountRef = accountRef; + return this; + } + + /** + * Amount of the transfer. + */ + public TransferDetails withAmount(BigDecimal amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + * Amount of the transfer. + */ + public TransferDetails withAmount(double amount) { + this.amount = Optional.of(BigDecimal.valueOf(amount)); + return this; + } + + /** + * Amount of the transfer. + */ + public TransferDetails withAmount(Optional amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransferDetails other = (TransferDetails) o; + return + java.util.Objects.deepEquals(this.accountRef, other.accountRef) && + java.util.Objects.deepEquals(this.amount, other.amount); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + accountRef, + amount); + } + + @Override + public String toString() { + return Utils.toString(TransferDetails.class, + "accountRef", accountRef, + "amount", amount); + } + + public final static class Builder { + + private Optional accountRef = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + public Builder accountRef(AccountRef accountRef) { + Utils.checkNotNull(accountRef, "accountRef"); + this.accountRef = Optional.ofNullable(accountRef); + return this; + } + + /** + * Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + */ + public Builder accountRef(Optional accountRef) { + Utils.checkNotNull(accountRef, "accountRef"); + this.accountRef = accountRef; + return this; + } + + /** + * Amount of the transfer. + */ + public Builder amount(BigDecimal amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + * Amount of the transfer. + */ + public Builder amount(double amount) { + this.amount = Optional.of(BigDecimal.valueOf(amount)); + return this; + } + + /** + * Amount of the transfer. + */ + public Builder amount(Optional amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + public TransferDetails build() { + return new TransferDetails( + accountRef, + amount); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequest.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequest.java new file mode 100644 index 00000000..045253d7 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequest.java @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.SpeakeasyMetadata; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class CreateReimbursableExpenseTransactionRequest { + + @SpeakeasyMetadata("request:mediaType=application/json") + private Optional createReimbursableExpenseRequest; + + /** + * Unique identifier for a company. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=companyId") + private String companyId; + + public CreateReimbursableExpenseTransactionRequest( + Optional createReimbursableExpenseRequest, + String companyId) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + Utils.checkNotNull(companyId, "companyId"); + this.createReimbursableExpenseRequest = createReimbursableExpenseRequest; + this.companyId = companyId; + } + + public Optional createReimbursableExpenseRequest() { + return createReimbursableExpenseRequest; + } + + /** + * Unique identifier for a company. + */ + public String companyId() { + return companyId; + } + + public final static Builder builder() { + return new Builder(); + } + + public CreateReimbursableExpenseTransactionRequest withCreateReimbursableExpenseRequest(io.codat.sync.expenses.models.components.CreateReimbursableExpenseRequest createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = Optional.ofNullable(createReimbursableExpenseRequest); + return this; + } + + public CreateReimbursableExpenseTransactionRequest withCreateReimbursableExpenseRequest(Optional createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = createReimbursableExpenseRequest; + return this; + } + + /** + * Unique identifier for a company. + */ + public CreateReimbursableExpenseTransactionRequest withCompanyId(String companyId) { + Utils.checkNotNull(companyId, "companyId"); + this.companyId = companyId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReimbursableExpenseTransactionRequest other = (CreateReimbursableExpenseTransactionRequest) o; + return + java.util.Objects.deepEquals(this.createReimbursableExpenseRequest, other.createReimbursableExpenseRequest) && + java.util.Objects.deepEquals(this.companyId, other.companyId); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + createReimbursableExpenseRequest, + companyId); + } + + @Override + public String toString() { + return Utils.toString(CreateReimbursableExpenseTransactionRequest.class, + "createReimbursableExpenseRequest", createReimbursableExpenseRequest, + "companyId", companyId); + } + + public final static class Builder { + + private Optional createReimbursableExpenseRequest = Optional.empty(); + + private String companyId; + + private Builder() { + // force use of static builder() method + } + + public Builder createReimbursableExpenseRequest(io.codat.sync.expenses.models.components.CreateReimbursableExpenseRequest createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = Optional.ofNullable(createReimbursableExpenseRequest); + return this; + } + + public Builder createReimbursableExpenseRequest(Optional createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = createReimbursableExpenseRequest; + return this; + } + + /** + * Unique identifier for a company. + */ + public Builder companyId(String companyId) { + Utils.checkNotNull(companyId, "companyId"); + this.companyId = companyId; + return this; + } + + public CreateReimbursableExpenseTransactionRequest build() { + return new CreateReimbursableExpenseTransactionRequest( + createReimbursableExpenseRequest, + companyId); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequestBuilder.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequestBuilder.java new file mode 100644 index 00000000..76ce490d --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionRequestBuilder.java @@ -0,0 +1,59 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.models.errors.SDKError; +import io.codat.sync.expenses.utils.LazySingletonValue; +import io.codat.sync.expenses.utils.Options.Builder; +import io.codat.sync.expenses.utils.Options; +import io.codat.sync.expenses.utils.Utils; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class CreateReimbursableExpenseTransactionRequestBuilder { + + private CreateReimbursableExpenseTransactionRequest request; + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallCreateReimbursableExpenseTransaction sdk; + + public CreateReimbursableExpenseTransactionRequestBuilder(SDKMethodInterfaces.MethodCallCreateReimbursableExpenseTransaction sdk) { + this.sdk = sdk; + } + + public CreateReimbursableExpenseTransactionRequestBuilder request(CreateReimbursableExpenseTransactionRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CreateReimbursableExpenseTransactionRequestBuilder retryConfig(io.codat.sync.expenses.utils.RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public CreateReimbursableExpenseTransactionRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public CreateReimbursableExpenseTransactionResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.create( + request, + options); + } +} diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionResponse.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionResponse.java new file mode 100644 index 00000000..c33c0245 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateReimbursableExpenseTransactionResponse.java @@ -0,0 +1,291 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class CreateReimbursableExpenseTransactionResponse implements io.codat.sync.expenses.utils.Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * OK + */ + private Optional createReimbursableExpenseResponse; + + /** + * The request made is not valid. + */ + private Optional errorMessage; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + public CreateReimbursableExpenseTransactionResponse( + String contentType, + Optional createReimbursableExpenseResponse, + Optional errorMessage, + int statusCode, + HttpResponse rawResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + Utils.checkNotNull(errorMessage, "errorMessage"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.contentType = contentType; + this.createReimbursableExpenseResponse = createReimbursableExpenseResponse; + this.errorMessage = errorMessage; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + } + + /** + * HTTP response content type for this operation + */ + public String contentType() { + return contentType; + } + + /** + * OK + */ + public Optional createReimbursableExpenseResponse() { + return createReimbursableExpenseResponse; + } + + /** + * The request made is not valid. + */ + public Optional errorMessage() { + return errorMessage; + } + + /** + * HTTP response status code for this operation + */ + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public HttpResponse rawResponse() { + return rawResponse; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public CreateReimbursableExpenseTransactionResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * OK + */ + public CreateReimbursableExpenseTransactionResponse withCreateReimbursableExpenseResponse(io.codat.sync.expenses.models.components.CreateReimbursableExpenseResponse createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = Optional.ofNullable(createReimbursableExpenseResponse); + return this; + } + + /** + * OK + */ + public CreateReimbursableExpenseTransactionResponse withCreateReimbursableExpenseResponse(Optional createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = createReimbursableExpenseResponse; + return this; + } + + /** + * The request made is not valid. + */ + public CreateReimbursableExpenseTransactionResponse withErrorMessage(io.codat.sync.expenses.models.components.ErrorMessage errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + * The request made is not valid. + */ + public CreateReimbursableExpenseTransactionResponse withErrorMessage(Optional errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = errorMessage; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateReimbursableExpenseTransactionResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateReimbursableExpenseTransactionResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReimbursableExpenseTransactionResponse other = (CreateReimbursableExpenseTransactionResponse) o; + return + java.util.Objects.deepEquals(this.contentType, other.contentType) && + java.util.Objects.deepEquals(this.createReimbursableExpenseResponse, other.createReimbursableExpenseResponse) && + java.util.Objects.deepEquals(this.errorMessage, other.errorMessage) && + java.util.Objects.deepEquals(this.statusCode, other.statusCode) && + java.util.Objects.deepEquals(this.rawResponse, other.rawResponse); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + contentType, + createReimbursableExpenseResponse, + errorMessage, + statusCode, + rawResponse); + } + + @Override + public String toString() { + return Utils.toString(CreateReimbursableExpenseTransactionResponse.class, + "contentType", contentType, + "createReimbursableExpenseResponse", createReimbursableExpenseResponse, + "errorMessage", errorMessage, + "statusCode", statusCode, + "rawResponse", rawResponse); + } + + public final static class Builder { + + private String contentType; + + private Optional createReimbursableExpenseResponse = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * OK + */ + public Builder createReimbursableExpenseResponse(io.codat.sync.expenses.models.components.CreateReimbursableExpenseResponse createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = Optional.ofNullable(createReimbursableExpenseResponse); + return this; + } + + /** + * OK + */ + public Builder createReimbursableExpenseResponse(Optional createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = createReimbursableExpenseResponse; + return this; + } + + /** + * The request made is not valid. + */ + public Builder errorMessage(io.codat.sync.expenses.models.components.ErrorMessage errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + * The request made is not valid. + */ + public Builder errorMessage(Optional errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = errorMessage; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public CreateReimbursableExpenseTransactionResponse build() { + return new CreateReimbursableExpenseTransactionResponse( + contentType, + createReimbursableExpenseResponse, + errorMessage, + statusCode, + rawResponse); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequest.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequest.java new file mode 100644 index 00000000..29e2d9bd --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequest.java @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.SpeakeasyMetadata; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class CreateTransferTransactionRequest { + + @SpeakeasyMetadata("request:mediaType=application/json") + private Optional createTransferRequest; + + /** + * Unique identifier for a company. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=companyId") + private String companyId; + + /** + * The unique identifier for your SMB's transaction. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=transactionId") + private String transactionId; + + public CreateTransferTransactionRequest( + Optional createTransferRequest, + String companyId, + String transactionId) { + Utils.checkNotNull(createTransferRequest, "createTransferRequest"); + Utils.checkNotNull(companyId, "companyId"); + Utils.checkNotNull(transactionId, "transactionId"); + this.createTransferRequest = createTransferRequest; + this.companyId = companyId; + this.transactionId = transactionId; + } + + public Optional createTransferRequest() { + return createTransferRequest; + } + + /** + * Unique identifier for a company. + */ + public String companyId() { + return companyId; + } + + /** + * The unique identifier for your SMB's transaction. + */ + public String transactionId() { + return transactionId; + } + + public final static Builder builder() { + return new Builder(); + } + + public CreateTransferTransactionRequest withCreateTransferRequest(io.codat.sync.expenses.models.components.CreateTransferRequest createTransferRequest) { + Utils.checkNotNull(createTransferRequest, "createTransferRequest"); + this.createTransferRequest = Optional.ofNullable(createTransferRequest); + return this; + } + + public CreateTransferTransactionRequest withCreateTransferRequest(Optional createTransferRequest) { + Utils.checkNotNull(createTransferRequest, "createTransferRequest"); + this.createTransferRequest = createTransferRequest; + return this; + } + + /** + * Unique identifier for a company. + */ + public CreateTransferTransactionRequest withCompanyId(String companyId) { + Utils.checkNotNull(companyId, "companyId"); + this.companyId = companyId; + return this; + } + + /** + * The unique identifier for your SMB's transaction. + */ + public CreateTransferTransactionRequest withTransactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransferTransactionRequest other = (CreateTransferTransactionRequest) o; + return + java.util.Objects.deepEquals(this.createTransferRequest, other.createTransferRequest) && + java.util.Objects.deepEquals(this.companyId, other.companyId) && + java.util.Objects.deepEquals(this.transactionId, other.transactionId); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + createTransferRequest, + companyId, + transactionId); + } + + @Override + public String toString() { + return Utils.toString(CreateTransferTransactionRequest.class, + "createTransferRequest", createTransferRequest, + "companyId", companyId, + "transactionId", transactionId); + } + + public final static class Builder { + + private Optional createTransferRequest = Optional.empty(); + + private String companyId; + + private String transactionId; + + private Builder() { + // force use of static builder() method + } + + public Builder createTransferRequest(io.codat.sync.expenses.models.components.CreateTransferRequest createTransferRequest) { + Utils.checkNotNull(createTransferRequest, "createTransferRequest"); + this.createTransferRequest = Optional.ofNullable(createTransferRequest); + return this; + } + + public Builder createTransferRequest(Optional createTransferRequest) { + Utils.checkNotNull(createTransferRequest, "createTransferRequest"); + this.createTransferRequest = createTransferRequest; + return this; + } + + /** + * Unique identifier for a company. + */ + public Builder companyId(String companyId) { + Utils.checkNotNull(companyId, "companyId"); + this.companyId = companyId; + return this; + } + + /** + * The unique identifier for your SMB's transaction. + */ + public Builder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public CreateTransferTransactionRequest build() { + return new CreateTransferTransactionRequest( + createTransferRequest, + companyId, + transactionId); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequestBuilder.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequestBuilder.java new file mode 100644 index 00000000..7db6fe42 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionRequestBuilder.java @@ -0,0 +1,59 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.models.errors.SDKError; +import io.codat.sync.expenses.utils.LazySingletonValue; +import io.codat.sync.expenses.utils.Options.Builder; +import io.codat.sync.expenses.utils.Options; +import io.codat.sync.expenses.utils.Utils; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class CreateTransferTransactionRequestBuilder { + + private CreateTransferTransactionRequest request; + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallCreateTransferTransaction sdk; + + public CreateTransferTransactionRequestBuilder(SDKMethodInterfaces.MethodCallCreateTransferTransaction sdk) { + this.sdk = sdk; + } + + public CreateTransferTransactionRequestBuilder request(CreateTransferTransactionRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CreateTransferTransactionRequestBuilder retryConfig(io.codat.sync.expenses.utils.RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public CreateTransferTransactionRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public CreateTransferTransactionResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.create( + request, + options); + } +} diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionResponse.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionResponse.java new file mode 100644 index 00000000..734840af --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/CreateTransferTransactionResponse.java @@ -0,0 +1,291 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class CreateTransferTransactionResponse implements io.codat.sync.expenses.utils.Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * OK + */ + private Optional createTransferResponse; + + /** + * The request made is not valid. + */ + private Optional errorMessage; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + public CreateTransferTransactionResponse( + String contentType, + Optional createTransferResponse, + Optional errorMessage, + int statusCode, + HttpResponse rawResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(createTransferResponse, "createTransferResponse"); + Utils.checkNotNull(errorMessage, "errorMessage"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.contentType = contentType; + this.createTransferResponse = createTransferResponse; + this.errorMessage = errorMessage; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + } + + /** + * HTTP response content type for this operation + */ + public String contentType() { + return contentType; + } + + /** + * OK + */ + public Optional createTransferResponse() { + return createTransferResponse; + } + + /** + * The request made is not valid. + */ + public Optional errorMessage() { + return errorMessage; + } + + /** + * HTTP response status code for this operation + */ + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public HttpResponse rawResponse() { + return rawResponse; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public CreateTransferTransactionResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * OK + */ + public CreateTransferTransactionResponse withCreateTransferResponse(io.codat.sync.expenses.models.components.CreateTransferResponse createTransferResponse) { + Utils.checkNotNull(createTransferResponse, "createTransferResponse"); + this.createTransferResponse = Optional.ofNullable(createTransferResponse); + return this; + } + + /** + * OK + */ + public CreateTransferTransactionResponse withCreateTransferResponse(Optional createTransferResponse) { + Utils.checkNotNull(createTransferResponse, "createTransferResponse"); + this.createTransferResponse = createTransferResponse; + return this; + } + + /** + * The request made is not valid. + */ + public CreateTransferTransactionResponse withErrorMessage(io.codat.sync.expenses.models.components.ErrorMessage errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + * The request made is not valid. + */ + public CreateTransferTransactionResponse withErrorMessage(Optional errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = errorMessage; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateTransferTransactionResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateTransferTransactionResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransferTransactionResponse other = (CreateTransferTransactionResponse) o; + return + java.util.Objects.deepEquals(this.contentType, other.contentType) && + java.util.Objects.deepEquals(this.createTransferResponse, other.createTransferResponse) && + java.util.Objects.deepEquals(this.errorMessage, other.errorMessage) && + java.util.Objects.deepEquals(this.statusCode, other.statusCode) && + java.util.Objects.deepEquals(this.rawResponse, other.rawResponse); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + contentType, + createTransferResponse, + errorMessage, + statusCode, + rawResponse); + } + + @Override + public String toString() { + return Utils.toString(CreateTransferTransactionResponse.class, + "contentType", contentType, + "createTransferResponse", createTransferResponse, + "errorMessage", errorMessage, + "statusCode", statusCode, + "rawResponse", rawResponse); + } + + public final static class Builder { + + private String contentType; + + private Optional createTransferResponse = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * OK + */ + public Builder createTransferResponse(io.codat.sync.expenses.models.components.CreateTransferResponse createTransferResponse) { + Utils.checkNotNull(createTransferResponse, "createTransferResponse"); + this.createTransferResponse = Optional.ofNullable(createTransferResponse); + return this; + } + + /** + * OK + */ + public Builder createTransferResponse(Optional createTransferResponse) { + Utils.checkNotNull(createTransferResponse, "createTransferResponse"); + this.createTransferResponse = createTransferResponse; + return this; + } + + /** + * The request made is not valid. + */ + public Builder errorMessage(io.codat.sync.expenses.models.components.ErrorMessage errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + * The request made is not valid. + */ + public Builder errorMessage(Optional errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = errorMessage; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public CreateTransferTransactionResponse build() { + return new CreateTransferTransactionResponse( + contentType, + createTransferResponse, + errorMessage, + statusCode, + rawResponse); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/InitiateSyncResponse.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/InitiateSyncResponse.java index 08047021..647f196e 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/InitiateSyncResponse.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/InitiateSyncResponse.java @@ -38,7 +38,7 @@ public class InitiateSyncResponse implements io.codat.sync.expenses.utils.Respon private HttpResponse rawResponse; /** - * Returns the newly created SyncId + * Returns the newly created syncId */ private Optional syncInitiated; @@ -89,7 +89,7 @@ public HttpResponse rawResponse() { } /** - * Returns the newly created SyncId + * Returns the newly created syncId */ public Optional syncInitiated() { return syncInitiated; @@ -145,7 +145,7 @@ public InitiateSyncResponse withRawResponse(HttpResponse rawRespons } /** - * Returns the newly created SyncId + * Returns the newly created syncId */ public InitiateSyncResponse withSyncInitiated(io.codat.sync.expenses.models.components.SyncInitiated syncInitiated) { Utils.checkNotNull(syncInitiated, "syncInitiated"); @@ -154,7 +154,7 @@ public InitiateSyncResponse withSyncInitiated(io.codat.sync.expenses.models.comp } /** - * Returns the newly created SyncId + * Returns the newly created syncId */ public InitiateSyncResponse withSyncInitiated(Optional syncInitiated) { Utils.checkNotNull(syncInitiated, "syncInitiated"); @@ -261,7 +261,7 @@ public Builder rawResponse(HttpResponse rawResponse) { } /** - * Returns the newly created SyncId + * Returns the newly created syncId */ public Builder syncInitiated(io.codat.sync.expenses.models.components.SyncInitiated syncInitiated) { Utils.checkNotNull(syncInitiated, "syncInitiated"); @@ -270,7 +270,7 @@ public Builder syncInitiated(io.codat.sync.expenses.models.components.SyncInitia } /** - * Returns the newly created SyncId + * Returns the newly created syncId */ public Builder syncInitiated(Optional syncInitiated) { Utils.checkNotNull(syncInitiated, "syncInitiated"); diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/SDKMethodInterfaces.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/SDKMethodInterfaces.java index 4f7c4ccf..39efd6fe 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/SDKMethodInterfaces.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/SDKMethodInterfaces.java @@ -246,9 +246,16 @@ io.codat.sync.expenses.models.operations.UpdateExpenseTransactionResponse update } - public interface MethodCallUploadExpenseAttachment { - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse uploadAttachment( - io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest request, + public interface MethodCallCreateReimbursableExpenseTransaction { + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionResponse create( + io.codat.sync.expenses.models.operations.CreateReimbursableExpenseTransactionRequest request, + Optional options) throws Exception; + } + + + public interface MethodCallUpdateReimbursableExpenseTransaction { + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionResponse update( + io.codat.sync.expenses.models.operations.UpdateReimbursableExpenseTransactionRequest request, Optional options) throws Exception; } @@ -301,4 +308,18 @@ io.codat.sync.expenses.models.operations.ListSyncTransactionsResponse list( Optional options) throws Exception; } + + public interface MethodCallUploadExpenseAttachment { + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentResponse upload( + io.codat.sync.expenses.models.operations.UploadExpenseAttachmentRequest request, + Optional options) throws Exception; + } + + + public interface MethodCallCreateTransferTransaction { + io.codat.sync.expenses.models.operations.CreateTransferTransactionResponse create( + io.codat.sync.expenses.models.operations.CreateTransferTransactionRequest request, + Optional options) throws Exception; + } + } diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequest.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequest.java new file mode 100644 index 00000000..94382ac7 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequest.java @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.SpeakeasyMetadata; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Optional; + + +public class UpdateReimbursableExpenseTransactionRequest { + + @SpeakeasyMetadata("request:mediaType=application/json") + private Optional createReimbursableExpenseRequest; + + /** + * Unique identifier for a company. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=companyId") + private String companyId; + + /** + * The unique identifier for your SMB's transaction. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=transactionId") + private String transactionId; + + public UpdateReimbursableExpenseTransactionRequest( + Optional createReimbursableExpenseRequest, + String companyId, + String transactionId) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + Utils.checkNotNull(companyId, "companyId"); + Utils.checkNotNull(transactionId, "transactionId"); + this.createReimbursableExpenseRequest = createReimbursableExpenseRequest; + this.companyId = companyId; + this.transactionId = transactionId; + } + + public Optional createReimbursableExpenseRequest() { + return createReimbursableExpenseRequest; + } + + /** + * Unique identifier for a company. + */ + public String companyId() { + return companyId; + } + + /** + * The unique identifier for your SMB's transaction. + */ + public String transactionId() { + return transactionId; + } + + public final static Builder builder() { + return new Builder(); + } + + public UpdateReimbursableExpenseTransactionRequest withCreateReimbursableExpenseRequest(io.codat.sync.expenses.models.components.CreateReimbursableExpenseRequest createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = Optional.ofNullable(createReimbursableExpenseRequest); + return this; + } + + public UpdateReimbursableExpenseTransactionRequest withCreateReimbursableExpenseRequest(Optional createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = createReimbursableExpenseRequest; + return this; + } + + /** + * Unique identifier for a company. + */ + public UpdateReimbursableExpenseTransactionRequest withCompanyId(String companyId) { + Utils.checkNotNull(companyId, "companyId"); + this.companyId = companyId; + return this; + } + + /** + * The unique identifier for your SMB's transaction. + */ + public UpdateReimbursableExpenseTransactionRequest withTransactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReimbursableExpenseTransactionRequest other = (UpdateReimbursableExpenseTransactionRequest) o; + return + java.util.Objects.deepEquals(this.createReimbursableExpenseRequest, other.createReimbursableExpenseRequest) && + java.util.Objects.deepEquals(this.companyId, other.companyId) && + java.util.Objects.deepEquals(this.transactionId, other.transactionId); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + createReimbursableExpenseRequest, + companyId, + transactionId); + } + + @Override + public String toString() { + return Utils.toString(UpdateReimbursableExpenseTransactionRequest.class, + "createReimbursableExpenseRequest", createReimbursableExpenseRequest, + "companyId", companyId, + "transactionId", transactionId); + } + + public final static class Builder { + + private Optional createReimbursableExpenseRequest = Optional.empty(); + + private String companyId; + + private String transactionId; + + private Builder() { + // force use of static builder() method + } + + public Builder createReimbursableExpenseRequest(io.codat.sync.expenses.models.components.CreateReimbursableExpenseRequest createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = Optional.ofNullable(createReimbursableExpenseRequest); + return this; + } + + public Builder createReimbursableExpenseRequest(Optional createReimbursableExpenseRequest) { + Utils.checkNotNull(createReimbursableExpenseRequest, "createReimbursableExpenseRequest"); + this.createReimbursableExpenseRequest = createReimbursableExpenseRequest; + return this; + } + + /** + * Unique identifier for a company. + */ + public Builder companyId(String companyId) { + Utils.checkNotNull(companyId, "companyId"); + this.companyId = companyId; + return this; + } + + /** + * The unique identifier for your SMB's transaction. + */ + public Builder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public UpdateReimbursableExpenseTransactionRequest build() { + return new UpdateReimbursableExpenseTransactionRequest( + createReimbursableExpenseRequest, + companyId, + transactionId); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequestBuilder.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequestBuilder.java new file mode 100644 index 00000000..8b17f72c --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionRequestBuilder.java @@ -0,0 +1,59 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.models.errors.SDKError; +import io.codat.sync.expenses.utils.LazySingletonValue; +import io.codat.sync.expenses.utils.Options.Builder; +import io.codat.sync.expenses.utils.Options; +import io.codat.sync.expenses.utils.Utils; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class UpdateReimbursableExpenseTransactionRequestBuilder { + + private UpdateReimbursableExpenseTransactionRequest request; + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallUpdateReimbursableExpenseTransaction sdk; + + public UpdateReimbursableExpenseTransactionRequestBuilder(SDKMethodInterfaces.MethodCallUpdateReimbursableExpenseTransaction sdk) { + this.sdk = sdk; + } + + public UpdateReimbursableExpenseTransactionRequestBuilder request(UpdateReimbursableExpenseTransactionRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public UpdateReimbursableExpenseTransactionRequestBuilder retryConfig(io.codat.sync.expenses.utils.RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public UpdateReimbursableExpenseTransactionRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public UpdateReimbursableExpenseTransactionResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.update( + request, + options); + } +} diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionResponse.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionResponse.java new file mode 100644 index 00000000..15ab2f58 --- /dev/null +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UpdateReimbursableExpenseTransactionResponse.java @@ -0,0 +1,291 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package io.codat.sync.expenses.models.operations; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.core.type.TypeReference; +import io.codat.sync.expenses.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class UpdateReimbursableExpenseTransactionResponse implements io.codat.sync.expenses.utils.Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * OK + */ + private Optional createReimbursableExpenseResponse; + + /** + * The request made is not valid. + */ + private Optional errorMessage; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + public UpdateReimbursableExpenseTransactionResponse( + String contentType, + Optional createReimbursableExpenseResponse, + Optional errorMessage, + int statusCode, + HttpResponse rawResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + Utils.checkNotNull(errorMessage, "errorMessage"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.contentType = contentType; + this.createReimbursableExpenseResponse = createReimbursableExpenseResponse; + this.errorMessage = errorMessage; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + } + + /** + * HTTP response content type for this operation + */ + public String contentType() { + return contentType; + } + + /** + * OK + */ + public Optional createReimbursableExpenseResponse() { + return createReimbursableExpenseResponse; + } + + /** + * The request made is not valid. + */ + public Optional errorMessage() { + return errorMessage; + } + + /** + * HTTP response status code for this operation + */ + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public HttpResponse rawResponse() { + return rawResponse; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public UpdateReimbursableExpenseTransactionResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * OK + */ + public UpdateReimbursableExpenseTransactionResponse withCreateReimbursableExpenseResponse(io.codat.sync.expenses.models.components.CreateReimbursableExpenseResponse createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = Optional.ofNullable(createReimbursableExpenseResponse); + return this; + } + + /** + * OK + */ + public UpdateReimbursableExpenseTransactionResponse withCreateReimbursableExpenseResponse(Optional createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = createReimbursableExpenseResponse; + return this; + } + + /** + * The request made is not valid. + */ + public UpdateReimbursableExpenseTransactionResponse withErrorMessage(io.codat.sync.expenses.models.components.ErrorMessage errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + * The request made is not valid. + */ + public UpdateReimbursableExpenseTransactionResponse withErrorMessage(Optional errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = errorMessage; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateReimbursableExpenseTransactionResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateReimbursableExpenseTransactionResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReimbursableExpenseTransactionResponse other = (UpdateReimbursableExpenseTransactionResponse) o; + return + java.util.Objects.deepEquals(this.contentType, other.contentType) && + java.util.Objects.deepEquals(this.createReimbursableExpenseResponse, other.createReimbursableExpenseResponse) && + java.util.Objects.deepEquals(this.errorMessage, other.errorMessage) && + java.util.Objects.deepEquals(this.statusCode, other.statusCode) && + java.util.Objects.deepEquals(this.rawResponse, other.rawResponse); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + contentType, + createReimbursableExpenseResponse, + errorMessage, + statusCode, + rawResponse); + } + + @Override + public String toString() { + return Utils.toString(UpdateReimbursableExpenseTransactionResponse.class, + "contentType", contentType, + "createReimbursableExpenseResponse", createReimbursableExpenseResponse, + "errorMessage", errorMessage, + "statusCode", statusCode, + "rawResponse", rawResponse); + } + + public final static class Builder { + + private String contentType; + + private Optional createReimbursableExpenseResponse = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * OK + */ + public Builder createReimbursableExpenseResponse(io.codat.sync.expenses.models.components.CreateReimbursableExpenseResponse createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = Optional.ofNullable(createReimbursableExpenseResponse); + return this; + } + + /** + * OK + */ + public Builder createReimbursableExpenseResponse(Optional createReimbursableExpenseResponse) { + Utils.checkNotNull(createReimbursableExpenseResponse, "createReimbursableExpenseResponse"); + this.createReimbursableExpenseResponse = createReimbursableExpenseResponse; + return this; + } + + /** + * The request made is not valid. + */ + public Builder errorMessage(io.codat.sync.expenses.models.components.ErrorMessage errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + /** + * The request made is not valid. + */ + public Builder errorMessage(Optional errorMessage) { + Utils.checkNotNull(errorMessage, "errorMessage"); + this.errorMessage = errorMessage; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public UpdateReimbursableExpenseTransactionResponse build() { + return new UpdateReimbursableExpenseTransactionResponse( + contentType, + createReimbursableExpenseResponse, + errorMessage, + statusCode, + rawResponse); + } + } +} + diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequestBuilder.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequestBuilder.java index 36739b11..fc06003f 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequestBuilder.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/models/operations/UploadExpenseAttachmentRequestBuilder.java @@ -52,7 +52,7 @@ public UploadExpenseAttachmentResponse call() throws Exception { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); - return sdk.uploadAttachment( + return sdk.upload( request, options); } diff --git a/sync-for-expenses/src/main/java/io/codat/sync/expenses/utils/Utils.java b/sync-for-expenses/src/main/java/io/codat/sync/expenses/utils/Utils.java index 046b1b0e..237796ec 100644 --- a/sync-for-expenses/src/main/java/io/codat/sync/expenses/utils/Utils.java +++ b/sync-for-expenses/src/main/java/io/codat/sync/expenses/utils/Utils.java @@ -279,7 +279,7 @@ public static String templateUrl(String url, Map params) { return sb.toString(); } - public static Map> getHeaders(Object headers) throws Exception { + public static Map> getHeaders(Object headers, Map>> globals) throws Exception { if (headers == null) { return null; } @@ -297,6 +297,10 @@ public static Map> getHeaders(Object headers) throws Except Object value = field.get(headers); value = resolveOptionals(value); + value = Utils.populateGlobal(value, field.getName(), "header", globals); + if (value == null) { + continue; + } if (value == null) { continue; }