diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 5d478797..c7f56c10 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.448.0 +speakeasyVersion: 1.455.5 sources: accounting-source: sourceNamespace: accounting-source @@ -9,11 +9,11 @@ sources: - main bank-feeds-source: sourceNamespace: bank-feeds-source - sourceRevisionDigest: sha256:b03ce9653088911fcc62e4160ee189c580f351aa25dfe56b5d05f5a7b96f35aa - sourceBlobDigest: sha256:b5233f0bab180b8aae271a0d5ab149316931ec9e84a140e1c073a2025305eb7d + sourceRevisionDigest: sha256:c8da9867e2243ea7063534e786f6af0377bf71302cf3527592959d11d6807ac9 + sourceBlobDigest: sha256:d8080d68edd35d878fad42ac6b343ac5c287f2cab63280c281a2adad5ddd117a tags: - latest - - speakeasy-sdk-regen-1732634784 + - speakeasy-sdk-regen-1734365257 - 3.0.0 banking-source: sourceNamespace: banking-source @@ -77,10 +77,10 @@ targets: bank-feeds-library: source: bank-feeds-source sourceNamespace: bank-feeds-source - sourceRevisionDigest: sha256:b03ce9653088911fcc62e4160ee189c580f351aa25dfe56b5d05f5a7b96f35aa - sourceBlobDigest: sha256:b5233f0bab180b8aae271a0d5ab149316931ec9e84a140e1c073a2025305eb7d - codeSamplesNamespace: bank-feeds-source-code-samples - codeSamplesRevisionDigest: sha256:76973441342874ccd37043d74d4eb34f717f8ba1b646f565e53788b44b77fe1d + sourceRevisionDigest: sha256:c8da9867e2243ea7063534e786f6af0377bf71302cf3527592959d11d6807ac9 + sourceBlobDigest: sha256:d8080d68edd35d878fad42ac6b343ac5c287f2cab63280c281a2adad5ddd117a + codeSamplesNamespace: bank-feeds-source-java-code-samples + codeSamplesRevisionDigest: sha256:1936534bff0c3a3c14d8c2b8babbdb0fa58e563c983ded79ae9417f5097e55fd banking-library: source: banking-source sourceNamespace: banking-source diff --git a/bank-feeds/.speakeasy/gen.lock b/bank-feeds/.speakeasy/gen.lock index f44b7083..1e4bb024 100755 --- a/bank-feeds/.speakeasy/gen.lock +++ b/bank-feeds/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 1f92decd-6f40-4ee5-936f-9c85d706eb7e management: - docChecksum: af010093774a298b2b6a17e641f9cd1b + docChecksum: 66b0b2a05ab126aac947c52e5cee36e3 docVersion: 3.0.0 - speakeasyVersion: 1.446.1 - generationVersion: 2.462.1 - releaseVersion: 2.0.0 - configChecksum: f6e6094b040d561de33cfde4a6af8af4 + speakeasyVersion: 1.455.5 + generationVersion: 2.479.3 + releaseVersion: 3.0.0 + configChecksum: 55e31d7501aa5fce1f3bc34fa65875ac repoURL: https://github.com/codatio/client-sdk-java.git repoSubDirectory: bank-feeds published: true @@ -14,7 +14,7 @@ features: java: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.1 - core: 3.32.2 + core: 3.33.1 decimal: 0.0.1 deprecations: 2.81.1 examples: 2.81.3 @@ -105,11 +105,15 @@ generatedFiles: - docs/models/components/SourceAccount.md - docs/models/components/SourceAccountBatchCreateResponse.md - docs/models/components/SourceAccountBatchErrorResponse.md + - docs/models/components/SourceAccountPrototype.md - docs/models/components/SourceAccountV2.md + - docs/models/components/SourceAccountV2AccountType.md - docs/models/components/SourceAccountV2BatchCreateResponse.md + - docs/models/components/SourceAccountV2Prototype.md - docs/models/components/SourceAccountV2Status.md - docs/models/components/SourceAccountWebhook.md - docs/models/components/SourceAccountWebhookPayload.md + - docs/models/components/SourceAccountWebhookPayloadSourceAccount.md - docs/models/components/SourceType.md - docs/models/components/Status.md - docs/models/components/SupplementalData.md @@ -295,11 +299,15 @@ generatedFiles: - src/main/java/io/codat/bank_feeds/models/components/SourceAccount.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountBatchCreateResponse.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountBatchErrorResponse.java + - src/main/java/io/codat/bank_feeds/models/components/SourceAccountPrototype.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2.java + - src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2AccountType.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2BatchCreateResponse.java + - src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2Prototype.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2Status.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhook.java - src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayload.java + - src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayloadSourceAccount.java - src/main/java/io/codat/bank_feeds/models/components/SourceType.java - src/main/java/io/codat/bank_feeds/models/components/Status.java - src/main/java/io/codat/bank_feeds/models/components/SupplementalData.java @@ -455,6 +463,7 @@ generatedFiles: - src/main/java/io/codat/bank_feeds/utils/Security.java - src/main/java/io/codat/bank_feeds/utils/SecurityMetadata.java - src/main/java/io/codat/bank_feeds/utils/SerializedBody.java + - src/main/java/io/codat/bank_feeds/utils/SessionManager.java - src/main/java/io/codat/bank_feeds/utils/SpeakeasyHTTPClient.java - src/main/java/io/codat/bank_feeds/utils/SpeakeasyMetadata.java - src/main/java/io/codat/bank_feeds/utils/TypedObject.java @@ -548,6 +557,7 @@ examples: pageSize: 100 query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" orderBy: "-modifiedDate" + tags: "region=uk && team=invoice-finance" responses: "200": application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"}], "totalResults": 1} @@ -559,6 +569,7 @@ examples: pageSize: 100 query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" orderBy: "-modifiedDate" + tags: "region=uk && team=invoice-finance" responses: "200": application/json: {"_links": {"current": {"href": "/companies?page=1&pageSize=100"}, "self": {"href": "/companies"}}, "pageNumber": 1, "pageSize": 100, "results": [{"created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/3fa85f64-5717-4562-b3fc-2c963f66afa6/connections/51baa045-4836-4317-a42e-3542e991e581/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "My Test Company make testing software", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "lastSync": "2022-01-01T12:30:00.000Z", "name": "My Test Company", "redirect": "https://link.codat.io/company/3fa85f64-5717-4562-b3fc-2c963f66afa6", "referenceSubsidiaryCompanies": []}], "totalResults": 1} @@ -569,6 +580,7 @@ examples: pageSize: 100 query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" orderBy: "-modifiedDate" + tags: "region=uk && team=invoice-finance" responses: "200": application/json: {"_links": {"current": {"href": "/companies?page=1&pageSize=100"}, "self": {"href": "/companies"}}, "pageNumber": 1, "pageSize": 100, "results": [{"created": "2022-01-01T11:30:00Z", "createdByUserName": "Joe Bloggs", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/d1568dde-adf6-11ed-afa1-0242ac120002/connections/51baa045-4836-4317-a42e-3542e991e581/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "Technology services, including web and app design and development", "id": "d1568dde-adf6-11ed-afa1-0242ac120002", "lastSync": "2022-01-01T12:30:00.000Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/d1568dde-adf6-11ed-afa1-0242ac120002", "referenceSubsidiaryCompanies": []}, {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "name": "Toft stores", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "referenceSubsidiaryCompanies": [{"id": "c8d3af58-7011-47ce-b3f2-89faf300ef6d", "links": {"portal": "https://app.codat.io/companies/c8d3af58-7011-47ce-b3f2-89faf300ef6d/summary"}, "name": "Toft stores UK"}, {"id": "db94eddc-9212-4568-9b5c-3eab0e325913", "links": {"portal": "https://app.codat.io/companies/db94eddc-9212-4568-9b5c-3eab0e325913/summary"}, "name": "Toft stores US"}]}, {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "id": "d5ab61b7-1ad0-46fd-9f9f-b6761047941e", "integrationId": "cc750323-5a47-4f28-8d8e-30fbbf2ce137", "integrationKey": "akxx", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/c8d3af58-7011-47ce-b3f2-89faf300ef6d/connections/d5ab61b7-1ad0-46fd-9f9f-b6761047941e/start", "platformName": "Oracle NetSuite", "sourceId": "9815b998-024d-4415-a40b-89903b2cad6f", "sourceType": "Accounting", "status": "Linked"}], "id": "c8d3af58-7011-47ce-b3f2-89faf300ef6d", "name": "Toft stores UK", "redirect": "https://link.codat.io/company/c8d3af58-7011-47ce-b3f2-89faf300ef6d", "referenceParentCompany": {"id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "links": {"portal": "https://app.codat.io/companies/ab12c58d-a678-4ebf-a159-ae99e1807bd0/summary"}, "name": "Toft stores"}, "referenceSubsidiaryCompanies": []}, {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "id": "1e5c8c9e-27fd-4ba9-9a2a-d02ba65bc2fb", "integrationId": "cc750323-5a47-4f28-8d8e-30fbbf2ce137", "integrationKey": "akxx", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/db94eddc-9212-4568-9b5c-3eab0e325913/connections/1e5c8c9e-27fd-4ba9-9a2a-d02ba65bc2fb/start", "platformName": "Oracle NetSuite", "sourceId": "9815b998-024d-4415-a40b-89903b2cad6f", "sourceType": "Accounting", "status": "Linked"}], "id": "db94eddc-9212-4568-9b5c-3eab0e325913", "name": "Toft stores US", "redirect": "https://link.codat.io/company/db94eddc-9212-4568-9b5c-3eab0e325913", "referenceParentCompany": {"id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "links": {"portal": "https://app.codat.io/companies/ab12c58d-a678-4ebf-a159-ae99e1807bd0/summary"}, "name": "Toft stores"}, "referenceSubsidiaryCompanies": []}], "totalResults": 3} @@ -579,6 +591,7 @@ examples: pageSize: 100 query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" orderBy: "-modifiedDate" + tags: "region=uk && team=invoice-finance" responses: "400": application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} @@ -589,6 +602,7 @@ examples: pageSize: 100 query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" orderBy: "-modifiedDate" + tags: "region=uk && team=invoice-finance" responses: "400": application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} @@ -775,7 +789,7 @@ examples: connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" responses: "200": - application/json: [{"sourceAccountId": "account-001", "sourceAccountName": "account-001", "sourceAccountNumber": "12345670", "sourceBalance": "99.99", "sourceCurrency": "GBP", "status": "pending", "targetAccountOptions": [{"accountNumber": "789", "id": "d21e25d6-98c5-4bfb-b469-105833bea3c8", "name": "Money Bank account", "sortCode": "123456"}, {"accountNumber": "99887766", "id": "d06ff4b2-e4f2-4681-9841-014bd008cdab", "name": "Bank of Dave account", "sortCode": "998866"}, {"accountNumber": "123456789", "id": "c8f252fc-84f3-4a8b-ace8-ae99f41a81ae", "name": "LuxLend account", "sortCode": "123456"}]}] + application/json: [{"sourceAccountId": "account-001", "sourceAccountName": "account-001", "sourceAccountNumber": "12345670", "sourceBalance": 99.99, "sourceCurrency": "GBP", "status": "pending", "targetAccountOptions": [{"accountNumber": "789", "id": "d21e25d6-98c5-4bfb-b469-105833bea3c8", "name": "Money Bank account", "sortCode": "123456"}, {"accountNumber": "99887766", "id": "d06ff4b2-e4f2-4681-9841-014bd008cdab", "name": "Bank of Dave account", "sortCode": "998866"}, {"accountNumber": "123456789", "id": "c8f252fc-84f3-4a8b-ace8-ae99f41a81ae", "name": "LuxLend account", "sortCode": "123456"}]}] get-company-information: Malformed query: parameters: @@ -792,10 +806,32 @@ examples: companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" requestBody: - application/json: {"accountInfo": {"accountOpenDate": "2023-05-06T00:00:00Z", "availableBalance": 10, "description": "account description 1", "nickname": "account 123"}, "accountName": "account-081", "accountNumber": "12345670", "accountType": "checking", "balance": 99.99, "currency": "GBP", "feedStartDate": "2024-05-01T00:00:00Z", "id": "acc-001", "modifiedDate": "2024-08-02T00:00:00.000Z", "routingInfo": {"bankCode": "21001088", "type": "bankcode"}, "status": "pending"} + application/json: {"accountInfo": {"accountOpenDate": "2022-10-23"}, "currency": "GBP", "modifiedDate": "2022-10-23T00:00:00Z"} responses: "400": application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + Version 2: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + requestBody: + application/json: {"accountInfo": {"accountOpenDate": "2022-10-23"}, "currency": "USD", "modifiedDate": "2022-10-23T00:00:00Z"} + responses: + "200": + application/json: {"accountInfo": {"accountOpenDate": "2023-05-06T00:00:00Z", "availableBalance": 10, "description": "account description 1", "nickname": "account 123"}, "accountName": "account-081", "accountNumber": "12345670", "accountType": "checking", "balance": 99.99, "currency": "GBP", "feedStartDate": "2024-05-01T00:00:00Z", "id": "acc-001", "modifiedDate": "2024-08-02T00:00:00.000Z", "routingInfo": {"bankCode": "21001088", "type": "bankcode"}, "status": "pending"} + "400": {} + Version 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + requestBody: + application/json: {"accountName": "account-081", "accountNumber": "12345670", "accountType": "Credit", "balance": 99.99, "currency": "GBP", "id": "acc-002", "modifiedDate": "2023-01-09T14:14:14.1057478Z", "sortCode": "123456"} + responses: + "200": + application/json: {"accountName": "account-095", "accountNumber": "12345671", "accountType": "Credit", "balance": 0, "currency": "USD", "id": "acc-003", "modifiedDate": "2023-01-09T14:14:14.1057478Z", "sortCode": "123456", "status": "pending"} + "400": {} delete-source-account: Unauthorized: parameters: @@ -1311,4 +1347,28 @@ examples: responses: "401": application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + Client rate limit reached: + speakeasy-default-client-rate-limit-reached: + requestBody: + application/json: {"AlertId": "a9367074-b5c3-42c4-9be4-be129f43577e", "ClientId": "bae71d36-ff47-420a-b4a6-f8c9ddf41140", "ClientName": "Bank of Dave", "Data": {"DailyQuota": 1000, "ExpiresUtc": "2022-10-23T00:00:00Z"}, "Message": "The current daily rate limit quota of 1000 requests for bae71d36-ff47-420a-b4a6-f8c9ddf41140 has been reached.", "RuleId": "70af3071-65d9-4ec3-b3cb-5283e8d55dac", "RuleType": "Rate Limit Reached"} + Client rate limit reset: + speakeasy-default-client-rate-limit-reset: + requestBody: + application/json: {"AlertId": "a9367074-b5c3-42c4-9be4-be129f43577e", "ClientId": "bae71d36-ff47-420a-b4a6-f8c9ddf41140", "ClientName": "Bank of Dave", "Data": {"DailyQuota": 1000, "ExpiresUtc": "2022-10-23T00:00:00Z", "QuotaRemaining": 1000, "ResetReason": "The quota was reset because it is a new day."}, "Message": "The current daily rate limit quota for client 30e0f9d2-52c0-4c9f-a806-bcd98a3bcd7e has been reset to 1000 requests.", "RuleId": "70af3071-65d9-4ec3-b3cb-5283e8d55dac", "RuleType": "Rate Limit Reset"} + bankFeeds.sourceAccount.connected: + Connected: + requestBody: + application/json: {"eventType": "bankFeeds.sourceAccount.connected", "generatedDate": "2022-10-23T00:00:00Z", "id": "ba29118f-5406-4e59-b05c-ba307ca38d01", "payload": {"connectionId": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "referenceCompany": {"description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "links": {"portal": "https://app.codat.io/companies/0498e921-9b53-4396-a412-4f2f5983b0a2/summary"}, "name": "Toft stores"}, "sourceAccount": {"accountName": "account-081", "accountNumber": "12345678", "balance": 99.99, "currency": "GBP", "id": "acc-002", "modifiedDate": "2023-01-09T14:14:14.105Z", "sortCode": "040004", "status": "pending"}}} + bankFeeds.sourceAccount.disconnected: + Disconnected: + requestBody: + application/json: {"eventType": "bankFeeds.sourceAccount.disconnected", "generatedDate": "2022-10-23T00:00:00Z", "id": "ba29118f-5406-4e59-b05c-ba307ca38d01", "payload": {"connectionId": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "referenceCompany": {"description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "links": {"portal": "https://app.codat.io/companies/0498e921-9b53-4396-a412-4f2f5983b0a2/summary"}, "name": "Toft stores"}, "sourceAccount": {"accountName": "account-081", "accountNumber": "12345678", "balance": 99.99, "currency": "GBP", "id": "acc-002", "modifiedDate": "2023-01-09T14:14:14.105Z", "sortCode": "040004", "status": "pending"}}} + client.rateLimit.reached: + Reached: + requestBody: + application/json: {"eventType": "client.rateLimit.reached", "generatedDate": "2024-09-01T00:00:00Z", "id": "743ec94a-8aa4-44bb-8bd4-e1855ee0e74b", "payload": {"dailyQuota": 12000, "expiryDate": "2024-09-01T12:14:14Z", "quotaRemaining": 0}} + client.rateLimit.reset: + Reset: + requestBody: + application/json: {"eventType": "client.rateLimit.reset", "generatedDate": "2024-09-01T00:00:00Z", "id": "743ec94a-8aa4-44bb-8bd4-e1855ee0e74b", "payload": {"dailyQuota": 12000, "expiryDate": "2024-09-01T23:59:99Z", "quotaRemaining": 11993}} generatedTests: {} diff --git a/bank-feeds/.speakeasy/gen.yaml b/bank-feeds/.speakeasy/gen.yaml index 8e7135b0..2fdb6a4d 100644 --- a/bank-feeds/.speakeasy/gen.yaml +++ b/bank-feeds/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: oAuth2PasswordEnabled: false telemetryEnabled: true java: - version: 2.0.0 + version: 3.0.0 additionalDependencies: [] additionalPlugins: [] artifactID: bank-feeds diff --git a/bank-feeds/README.md b/bank-feeds/README.md index d1e60aad..14278111 100644 --- a/bank-feeds/README.md +++ b/bank-feeds/README.md @@ -30,14 +30,17 @@ A bank feed is a connection between a source bank account in your application an ## Table of Contents + + * [Endpoints](#endpoints) + * [SDK Installation](#sdk-installation) + * [Example Usage](#example-usage) + * [SDK Example Usage](#sdk-example-usage) + * [Available Resources and Operations](#available-resources-and-operations) + * [Retries](#retries) + * [Error Handling](#error-handling) + * [Server Selection](#server-selection) + * [Authentication](#authentication) -* [SDK Installation](#sdk-installation) -* [SDK Example Usage](#sdk-example-usage) -* [Available Resources and Operations](#available-resources-and-operations) -* [Retries](#retries) -* [Error Handling](#error-handling) -* [Server Selection](#server-selection) -* [Authentication](#authentication) @@ -51,7 +54,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'io.codat:bank-feeds:2.0.0' +implementation 'io.codat:bank-feeds:3.0.0' ``` Maven: @@ -59,7 +62,7 @@ Maven: io.codat bank-feeds - 2.0.0 + 3.0.0 ``` @@ -88,31 +91,56 @@ gradlew.bat publishToMavenLocal -Pskip.signing package hello.world; import io.codat.bank_feeds.CodatBankFeeds; -import io.codat.bank_feeds.models.components.CompanyRequestBody; -import io.codat.bank_feeds.models.errors.ErrorMessage; -import io.codat.bank_feeds.models.operations.CreateCompanyResponse; +import io.codat.bank_feeds.models.components.CompanyReference; +import io.codat.bank_feeds.models.components.CompanyReferenceLinks; +import io.codat.bank_feeds.models.components.SourceAccount; +import io.codat.bank_feeds.models.components.SourceAccountWebhook; +import io.codat.bank_feeds.models.components.SourceAccountWebhookPayload; +import io.codat.bank_feeds.models.components.SourceAccountWebhookPayloadSourceAccount; +import io.codat.bank_feeds.models.components.Status; +import io.codat.bank_feeds.models.webhooks.BankFeedsSourceAccountConnectedResponse; import java.lang.Exception; +import java.math.BigDecimal; public class Application { - public static void main(String[] args) throws ErrorMessage, Exception { + public static void main(String[] args) throws Exception { CodatBankFeeds sdk = CodatBankFeeds.builder() - .authHeader("Basic BASE_64_ENCODED(API_KEY)") .build(); - CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") - .description("Requested early access to the new financing scheme.") + SourceAccountWebhook req = SourceAccountWebhook.builder() + .eventType("bankFeeds.sourceAccount.connected") + .generatedDate("2022-10-23T00:00:00Z") + .id("ba29118f-5406-4e59-b05c-ba307ca38d01") + .payload(SourceAccountWebhookPayload.builder() + .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") + .referenceCompany(CompanyReference.builder() + .description("Requested early access to the new financing scheme.") + .id("0498e921-9b53-4396-a412-4f2f5983b0a2") + .links(CompanyReferenceLinks.builder() + .portal("https://app.codat.io/companies/0498e921-9b53-4396-a412-4f2f5983b0a2/summary") + .build()) + .name("Toft stores") + .build()) + .sourceAccount(SourceAccountWebhookPayloadSourceAccount.of(SourceAccount.builder() + .id("acc-002") + .accountName("account-081") + .accountNumber("12345678") + .balance(new BigDecimal("99.99")) + .currency("GBP") + .modifiedDate("2023-01-09T14:14:14.105Z") + .sortCode("040004") + .status(Status.PENDING) + .build())) + .build()) .build(); - CreateCompanyResponse res = sdk.companies().create() + BankFeedsSourceAccountConnectedResponse res = sdk.bankFeedsSourceAccountConnected() .request(req) .call(); - if (res.company().isPresent()) { - // handle response - } + // handle response } } ``` @@ -213,7 +241,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); @@ -270,7 +298,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); @@ -318,7 +346,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); @@ -359,7 +387,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); @@ -405,7 +433,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); diff --git a/bank-feeds/RELEASES.md b/bank-feeds/RELEASES.md index 9d5d86f2..70f0d9b9 100644 --- a/bank-feeds/RELEASES.md +++ b/bank-feeds/RELEASES.md @@ -38,4 +38,14 @@ Based on: ### Generated - [java v2.0.0] bank-feeds ### Releases -- [Maven Central v2.0.0] https://central.sonatype.com/artifact/io.codat/bank-feeds/2.0.0 - bank-feeds \ No newline at end of file +- [Maven Central v2.0.0] https://central.sonatype.com/artifact/io.codat/bank-feeds/2.0.0 - bank-feeds + +## 2024-12-16 16:07:30 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.455.5 (2.479.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v3.0.0] bank-feeds +### Releases +- [Maven Central v3.0.0] https://central.sonatype.com/artifact/io.codat/bank-feeds/3.0.0 - bank-feeds \ No newline at end of file diff --git a/bank-feeds/USAGE.md b/bank-feeds/USAGE.md index 565deaa9..ce3784bd 100644 --- a/bank-feeds/USAGE.md +++ b/bank-feeds/USAGE.md @@ -17,7 +17,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); diff --git a/bank-feeds/build.gradle b/bank-feeds/build.gradle index a64a0478..d92c8776 100644 --- a/bank-feeds/build.gradle +++ b/bank-feeds/build.gradle @@ -63,7 +63,7 @@ tasks.withType(Javadoc) { } group = "io.codat" -version = "2.0.0" +version = "3.0.0" sourcesJar { archiveBaseName = "bank-feeds" @@ -101,7 +101,7 @@ publishing { maven(MavenPublication) { groupId = 'io.codat' artifactId = 'bank-feeds' - version = '2.0.0' + version = '3.0.0' from components.java diff --git a/bank-feeds/docs/models/components/BankFeedMapping.md b/bank-feeds/docs/models/components/BankFeedMapping.md index 99f68d51..b76ec41f 100644 --- a/bank-feeds/docs/models/components/BankFeedMapping.md +++ b/bank-feeds/docs/models/components/BankFeedMapping.md @@ -11,7 +11,7 @@ A bank feed connection between a source account and a target account, including | `sourceAccountId` | *Optional\* | :heavy_minus_sign: | Unique ID for the source account. | | | `sourceAccountName` | *Optional\* | :heavy_minus_sign: | Name for the source account. | | | `sourceAccountNumber` | *Optional\* | :heavy_minus_sign: | Account number for the source account. | | -| `sourceBalance` | *Optional\* | :heavy_minus_sign: | Balance for the source account. | | +| `sourceBalance` | *Optional\* | :heavy_minus_sign: | Balance for the source account. | | | `sourceCurrency` | *Optional\* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `status` | *Optional\* | :heavy_minus_sign: | The status. | | | `targetAccountId` | *JsonNullable\* | :heavy_minus_sign: | Unique ID for the target account in the accounting software. | | diff --git a/bank-feeds/docs/models/components/SourceAccountPrototype.md b/bank-feeds/docs/models/components/SourceAccountPrototype.md new file mode 100644 index 00000000..a75a0873 --- /dev/null +++ b/bank-feeds/docs/models/components/SourceAccountPrototype.md @@ -0,0 +1,15 @@ +# SourceAccountPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accountName` | *JsonNullable\* | :heavy_minus_sign: | The bank account name. | | +| `accountNumber` | *JsonNullable\* | :heavy_minus_sign: | The account number. | | +| `accountType` | *JsonNullable\* | :heavy_minus_sign: | The type of bank account e.g. Credit. | | +| `balance` | *JsonNullable\* | :heavy_minus_sign: | The latest balance for the bank account. | | +| `currency` | *Optional\* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `id` | *Optional\* | :heavy_minus_sign: | Unique ID for the bank account. | | +| `modifiedDate` | *Optional\* | :heavy_minus_sign: | 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 | +| `sortCode` | *JsonNullable\* | :heavy_minus_sign: | The sort code. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/components/SourceAccountV2.md b/bank-feeds/docs/models/components/SourceAccountV2.md index ed3cb91d..5461724d 100644 --- a/bank-feeds/docs/models/components/SourceAccountV2.md +++ b/bank-feeds/docs/models/components/SourceAccountV2.md @@ -10,11 +10,12 @@ The target bank account in a supported accounting software for ingestion into a | `accountInfo` | [JsonNullable\](../../models/components/AccountInfo.md) | :heavy_minus_sign: | N/A | | | `accountName` | *String* | :heavy_check_mark: | The bank account name. | | | `accountNumber` | *String* | :heavy_check_mark: | The account number. | | -| `accountType` | [AccountType](../../models/components/AccountType.md) | :heavy_check_mark: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | | +| `accountType` | [SourceAccountV2AccountType](../../models/components/SourceAccountV2AccountType.md) | :heavy_check_mark: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | | | `balance` | *BigDecimal* | :heavy_check_mark: | The latest balance for the bank account. | | | `currency` | *String* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `feedStartDate` | *JsonNullable\* | :heavy_minus_sign: | In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example:
```
2020-10-08
``` | 2022-10-23 | | `id` | *String* | :heavy_check_mark: | Unique ID for the bank account. | | | `modifiedDate` | *Optional\* | :heavy_minus_sign: | 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 | | `routingInfo` | [Optional\](../../models/components/RoutingInfo.md) | :heavy_minus_sign: | Routing information for the bank. This does not include account number. | | +| `sortCode` | *JsonNullable\* | :heavy_minus_sign: | The sort code. | | | `status` | [JsonNullable\](../../models/components/SourceAccountV2Status.md) | :heavy_minus_sign: | Status of the source account. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/components/SourceAccountV2AccountType.md b/bank-feeds/docs/models/components/SourceAccountV2AccountType.md new file mode 100644 index 00000000..a8207471 --- /dev/null +++ b/bank-feeds/docs/models/components/SourceAccountV2AccountType.md @@ -0,0 +1,14 @@ +# SourceAccountV2AccountType + +The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `CHECKING` | checking | +| `SAVINGS` | savings | +| `LOAN` | loan | +| `CREDIT_CARD` | creditCard | +| `PREPAID_CARD` | prepaidCard | \ No newline at end of file diff --git a/bank-feeds/docs/models/components/SourceAccountV2Prototype.md b/bank-feeds/docs/models/components/SourceAccountV2Prototype.md new file mode 100644 index 00000000..4a86f973 --- /dev/null +++ b/bank-feeds/docs/models/components/SourceAccountV2Prototype.md @@ -0,0 +1,17 @@ +# SourceAccountV2Prototype + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accountInfo` | [JsonNullable\](../../models/components/AccountInfo.md) | :heavy_minus_sign: | N/A | | +| `accountName` | *Optional\* | :heavy_minus_sign: | The bank account name. | | +| `accountNumber` | *Optional\* | :heavy_minus_sign: | The account number. | | +| `accountType` | [Optional\](../../models/components/AccountType.md) | :heavy_minus_sign: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | | +| `balance` | *Optional\* | :heavy_minus_sign: | The latest balance for the bank account. | | +| `currency` | *Optional\* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `id` | *Optional\* | :heavy_minus_sign: | Unique ID for the bank account. | | +| `modifiedDate` | *Optional\* | :heavy_minus_sign: | 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 | +| `routingInfo` | [Optional\](../../models/components/RoutingInfo.md) | :heavy_minus_sign: | Routing information for the bank. This does not include account number. | | +| `sortCode` | *JsonNullable\* | :heavy_minus_sign: | The sort code. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/components/SourceAccountWebhookPayload.md b/bank-feeds/docs/models/components/SourceAccountWebhookPayload.md index 92b6c6dd..e31b0cd1 100644 --- a/bank-feeds/docs/models/components/SourceAccountWebhookPayload.md +++ b/bank-feeds/docs/models/components/SourceAccountWebhookPayload.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `companyId` | *Optional\* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `connectionId` | *Optional\* | :heavy_minus_sign: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `referenceCompany` | [Optional\](../../models/components/CompanyReference.md) | :heavy_minus_sign: | N/A | | -| `sourceAccount` | [Optional\](../../models/components/SourceAccount.md) | :heavy_minus_sign: | The target bank account in a supported accounting software for ingestion into a bank feed. | {
"id": "acc-002",
"accountName": "account-081",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345670",
"currency": "GBP",
"balance": 99.99,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `companyId` | *Optional\* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connectionId` | *Optional\* | :heavy_minus_sign: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `referenceCompany` | [Optional\](../../models/components/CompanyReference.md) | :heavy_minus_sign: | N/A | | +| `sourceAccount` | [Optional\](../../models/components/SourceAccountWebhookPayloadSourceAccount.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/bank-feeds/docs/models/components/SourceAccountWebhookPayloadSourceAccount.md b/bank-feeds/docs/models/components/SourceAccountWebhookPayloadSourceAccount.md new file mode 100644 index 00000000..ccd7275b --- /dev/null +++ b/bank-feeds/docs/models/components/SourceAccountWebhookPayloadSourceAccount.md @@ -0,0 +1,2 @@ +# SourceAccountWebhookPayloadSourceAccount + diff --git a/bank-feeds/docs/models/operations/ListCompaniesRequest.md b/bank-feeds/docs/models/operations/ListCompaniesRequest.md index a1dd2014..b8d960f8 100644 --- a/bank-feeds/docs/models/operations/ListCompaniesRequest.md +++ b/bank-feeds/docs/models/operations/ListCompaniesRequest.md @@ -3,9 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `orderBy` | *Optional\* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | -| `page` | *Optional\* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | -| `pageSize` | *Optional\* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `query` | *Optional\* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `orderBy` | *Optional\* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | +| `page` | *Optional\* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | +| `pageSize` | *Optional\* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | +| `query` | *Optional\* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | +| `tags` | *Optional\* | :heavy_minus_sign: | Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). | region=uk && team=invoice-finance | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/accountmapping/README.md b/bank-feeds/docs/sdks/accountmapping/README.md index c32916e4..85ff5d7e 100644 --- a/bank-feeds/docs/sdks/accountmapping/README.md +++ b/bank-feeds/docs/sdks/accountmapping/README.md @@ -67,7 +67,7 @@ public class Application { .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") .bankFeedAccountMapping(BankFeedAccountMapping.builder() - .sourceAccountId("") + .sourceAccountId("acc-002") .targetAccountId("account-081") .build()) .build(); diff --git a/bank-feeds/docs/sdks/companies/README.md b/bank-feeds/docs/sdks/companies/README.md index d1860b74..57096dc1 100644 --- a/bank-feeds/docs/sdks/companies/README.md +++ b/bank-feeds/docs/sdks/companies/README.md @@ -43,7 +43,7 @@ public class Application { .build(); CompanyRequestBody req = CompanyRequestBody.builder() - .name("Bank of Dave") + .name("Technicalium") .description("Requested early access to the new financing scheme.") .build(); @@ -254,6 +254,19 @@ public class Application { A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. +## Filter by tags + +The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): + +- equals (`=`) +- not equals (`!=`) +- contains (`~`) + +For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: +- Foreign key: `uid = {yourCustomerId}` +- Region: `region != uk` +- Owning team and region: `region = uk && owningTeam = invoice-finance` + ### Example Usage ```java @@ -278,6 +291,7 @@ public class Application { .page(1) .pageSize(100) .query("id=e3334455-1aed-4e71-ab43-6bccf12092ee") + .tags("region=uk && team=invoice-finance") .build(); ListCompaniesResponse res = sdk.companies().list() @@ -338,7 +352,7 @@ public class Application { UpdateCompanyRequest req = UpdateCompanyRequest.builder() .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .companyRequestBody(CompanyRequestBody.builder() - .name("Bank of Dave") + .name("New Name") .description("Requested early access to the new financing scheme.") .build()) .build(); diff --git a/bank-feeds/docs/sdks/connections/README.md b/bank-feeds/docs/sdks/connections/README.md index f42c9e9e..9e08b531 100644 --- a/bank-feeds/docs/sdks/connections/README.md +++ b/bank-feeds/docs/sdks/connections/README.md @@ -254,9 +254,11 @@ public class Application { package hello.world; import io.codat.bank_feeds.CodatBankFeeds; +import io.codat.bank_feeds.models.components.DataConnectionStatus; import io.codat.bank_feeds.models.errors.ErrorMessage; import io.codat.bank_feeds.models.operations.UnlinkConnectionRequest; import io.codat.bank_feeds.models.operations.UnlinkConnectionResponse; +import io.codat.bank_feeds.models.operations.UnlinkConnectionUpdateConnection; import java.lang.Exception; public class Application { @@ -270,6 +272,9 @@ public class Application { UnlinkConnectionRequest req = UnlinkConnectionRequest.builder() .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") + .requestBody(UnlinkConnectionUpdateConnection.builder() + .status(DataConnectionStatus.UNLINKED) + .build()) .build(); UnlinkConnectionResponse res = sdk.connections().unlink() diff --git a/bank-feeds/docs/sdks/sourceaccounts/README.md b/bank-feeds/docs/sdks/sourceaccounts/README.md index 6146a98a..0e7637d6 100644 --- a/bank-feeds/docs/sdks/sourceaccounts/README.md +++ b/bank-feeds/docs/sdks/sourceaccounts/README.md @@ -29,17 +29,12 @@ package hello.world; import io.codat.bank_feeds.CodatBankFeeds; import io.codat.bank_feeds.models.components.AccountInfo; -import io.codat.bank_feeds.models.components.AccountType; -import io.codat.bank_feeds.models.components.RoutingInfo; -import io.codat.bank_feeds.models.components.SourceAccountV2; -import io.codat.bank_feeds.models.components.SourceAccountV2Status; -import io.codat.bank_feeds.models.components.Type; +import io.codat.bank_feeds.models.components.SourceAccountV2Prototype; import io.codat.bank_feeds.models.errors.ErrorMessage; import io.codat.bank_feeds.models.operations.CreateSourceAccountRequest; import io.codat.bank_feeds.models.operations.CreateSourceAccountRequestBody; import io.codat.bank_feeds.models.operations.CreateSourceAccountResponse; import java.lang.Exception; -import java.math.BigDecimal; public class Application { @@ -52,26 +47,12 @@ public class Application { CreateSourceAccountRequest req = CreateSourceAccountRequest.builder() .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") - .requestBody(CreateSourceAccountRequestBody.of(SourceAccountV2.builder() - .accountName("") - .accountNumber("") - .accountType(AccountType.LOAN) - .balance(new BigDecimal("1343.65")) - .currency("GBP") - .id("") + .requestBody(CreateSourceAccountRequestBody.of(SourceAccountV2Prototype.builder() .accountInfo(AccountInfo.builder() - .accountOpenDate("2023-05-23T00:00:00Z") - .availableBalance(new BigDecimal("400")) - .description("account description 2") - .nickname("account 1290") - .build()) - .feedStartDate("2024-05-01T00:00:00Z") - .modifiedDate("2024-08-02T00:00:00.000Z") - .routingInfo(RoutingInfo.builder() - .bankCode("21001088") - .type(Type.BANKCODE) + .accountOpenDate("2022-10-23") .build()) - .status(SourceAccountV2Status.PENDING) + .currency("USD") + .modifiedDate("2022-10-23T00:00:00Z") .build())) .build(); @@ -139,7 +120,7 @@ public class Application { .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") .requestBody(CreateBatchSourceAccountRequestBody.ofSourceAccount(List.of( SourceAccount.builder() - .id("") + .id("acc-002") .accountName("account-081") .accountNumber("12345670") .accountType("Credit") @@ -150,7 +131,7 @@ public class Application { .status(Status.PENDING) .build(), SourceAccount.builder() - .id("") + .id("acc-003") .accountName("account-095") .accountNumber("12345671") .accountType("Credit") @@ -335,7 +316,7 @@ public class Application { .build(); GenerateCredentialsRequest req = GenerateCredentialsRequest.builder() - .requestBody("0xeCFd9fD7b9".getBytes(StandardCharsets.UTF_8)) + .requestBody("0xeDCfFBde9E".getBytes(StandardCharsets.UTF_8)) .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") .build(); @@ -465,12 +446,13 @@ public class Application { .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") .sourceAccount(SourceAccount.builder() - .id("") - .accountName("account-081") - .accountNumber("12345670") + .id("acc-003") + .accountName("account-095") + .accountNumber("12345671") .accountType("Credit") - .balance(new BigDecimal("99.99")) - .currency("GBP") + .balance(new BigDecimal("0")) + .currency("USD") + .feedStartDate("2022-10-23T00:00:00Z") .modifiedDate("2023-01-09T14:14:14.1057478Z") .sortCode("123456") .status(Status.PENDING) diff --git a/bank-feeds/docs/sdks/transactions/README.md b/bank-feeds/docs/sdks/transactions/README.md index 53f3eb33..b934f9a3 100644 --- a/bank-feeds/docs/sdks/transactions/README.md +++ b/bank-feeds/docs/sdks/transactions/README.md @@ -29,6 +29,7 @@ Alternatively, you can view the [Get create bank transaction model](https://docs package hello.world; import io.codat.bank_feeds.CodatBankFeeds; +import io.codat.bank_feeds.models.components.BankTransactionType; import io.codat.bank_feeds.models.components.BankTransactions; import io.codat.bank_feeds.models.components.CreateBankTransactions; import io.codat.bank_feeds.models.errors.ErrorMessage; @@ -51,17 +52,40 @@ public class Application { .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") .connectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171") .createBankTransactions(CreateBankTransactions.builder() - .accountId("EILBDVJVNUAGVKRQ") + .accountId("49cd5a42-b311-4750-9361-52e2ed1d4653") .transactions(List.of( BankTransactions.builder() - .amount(new BigDecimal("999.99")) - .balance(new BigDecimal("-999.99")) - .counterparty("ACME INC") - .date("2022-10-23T00:00:00Z") - .description("Debit for Payment Id sdp-1-57379a43-c4b8-49f5-bd7c-699189ee7a60") + .amount(new BigDecimal("100")) + .balance(new BigDecimal("100")) + .counterparty("Bank of Example") + .date("2023-08-22T10:21:00Z") + .description("Repayment of Credit Card") .id("716422529") + .reconciled(true) + .reference("Ref-12345") + .transactionType(BankTransactionType.CREDIT) + .build(), + BankTransactions.builder() + .amount(new BigDecimal("-100")) + .balance(new BigDecimal("0")) + .counterparty("Amazon") + .date("2023-08-22T10:22:00Z") + .description("Amazon Purchase") + .id("716422530") + .reconciled(false) + .reference("Ref-12346") + .transactionType(BankTransactionType.DEBIT) + .build(), + BankTransactions.builder() + .amount(new BigDecimal("-60")) + .balance(new BigDecimal("-60")) + .counterparty("Office Mart") + .date("2023-08-22T10:23:00Z") + .description("Office Supplies") + .id("716422531") .reconciled(false) - .reference("reference for transaction") + .reference("Ref-12347") + .transactionType(BankTransactionType.DEBIT) .build())) .build()) .build(); @@ -186,7 +210,7 @@ public class Application { GetCreateOperationRequest req = GetCreateOperationRequest.builder() .companyId("8a210b68-6988-11ed-a1eb-0242ac120002") - .pushOperationKey("1b33a562-bac6-42b7-8818-d55dba8df363") + .pushOperationKey("1fb73c31-a851-46c2-ab8a-5ce6e25b57b8") .build(); GetCreateOperationResponse res = sdk.transactions().getCreateOperation() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/AccountMapping.java b/bank-feeds/src/main/java/io/codat/bank_feeds/AccountMapping.java index 99d4862b..669a21e4 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/AccountMapping.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/AccountMapping.java @@ -199,10 +199,10 @@ public CreateBankAccountMappingResponse create( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -234,7 +234,7 @@ public CreateBankAccountMappingResponse create( new BeforeRequestContextImpl( "create-bank-account-mapping", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -247,7 +247,7 @@ public CreateBankAccountMappingResponse create( new AfterErrorContextImpl( "create-bank-account-mapping", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -260,7 +260,7 @@ public CreateBankAccountMappingResponse create( new AfterSuccessContextImpl( "create-bank-account-mapping", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -386,10 +386,10 @@ public GetBankAccountMappingResponse get( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -421,7 +421,7 @@ public GetBankAccountMappingResponse get( new BeforeRequestContextImpl( "get-bank-account-mapping", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -434,7 +434,7 @@ public GetBankAccountMappingResponse get( new AfterErrorContextImpl( "get-bank-account-mapping", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -447,7 +447,7 @@ public GetBankAccountMappingResponse get( new AfterSuccessContextImpl( "get-bank-account-mapping", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/BankAccounts.java b/bank-feeds/src/main/java/io/codat/bank_feeds/BankAccounts.java index edc92590..1dbabf19 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/BankAccounts.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/BankAccounts.java @@ -139,10 +139,10 @@ public CreateBankAccountResponse create( CreateBankAccountRequest.class, request, null)); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -174,7 +174,7 @@ public CreateBankAccountResponse create( new BeforeRequestContextImpl( "create-bank-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -187,7 +187,7 @@ public CreateBankAccountResponse create( new AfterErrorContextImpl( "create-bank-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -200,7 +200,7 @@ public CreateBankAccountResponse create( new AfterSuccessContextImpl( "create-bank-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -329,10 +329,10 @@ public GetCreateBankAccountsModelResponse getCreateModel( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -364,7 +364,7 @@ public GetCreateBankAccountsModelResponse getCreateModel( new BeforeRequestContextImpl( "get-create-bankAccounts-model", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -377,7 +377,7 @@ public GetCreateBankAccountsModelResponse getCreateModel( new AfterErrorContextImpl( "get-create-bankAccounts-model", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -390,7 +390,7 @@ public GetCreateBankAccountsModelResponse getCreateModel( new AfterSuccessContextImpl( "get-create-bankAccounts-model", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -518,10 +518,10 @@ public ListBankAccountsResponse list( ListBankAccountsRequest.class, request, null)); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -553,7 +553,7 @@ public ListBankAccountsResponse list( new BeforeRequestContextImpl( "list-bank-accounts", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -566,7 +566,7 @@ public ListBankAccountsResponse list( new AfterErrorContextImpl( "list-bank-accounts", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -579,7 +579,7 @@ public ListBankAccountsResponse list( new AfterSuccessContextImpl( "list-bank-accounts", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/CodatBankFeeds.java b/bank-feeds/src/main/java/io/codat/bank_feeds/CodatBankFeeds.java index 2e3a6a3a..2a9d756e 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/CodatBankFeeds.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/CodatBankFeeds.java @@ -12,6 +12,7 @@ import java.lang.String; import java.util.Map; import java.util.Optional; +import java.util.function.Consumer; /** * Bank Feeds API: Bank Feeds API enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. @@ -245,9 +246,16 @@ public Builder retryConfig(RetryConfig retryConfig) { this.sdkConfiguration.retryConfig = Optional.of(retryConfig); return this; } - // Visible for testing, will be accessed via reflection - void _hooks(io.codat.bank_feeds.utils.Hooks hooks) { - sdkConfiguration.setHooks(hooks); + // Visible for testing, may be accessed via reflection in tests + Builder _hooks(io.codat.bank_feeds.utils.Hooks hooks) { + sdkConfiguration.setHooks(hooks); + return this; + } + + // Visible for testing, may be accessed via reflection in tests + Builder _hooks(Consumer consumer) { + consumer.accept(sdkConfiguration.hooks()); + return this; } /** diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/Companies.java b/bank-feeds/src/main/java/io/codat/bank_feeds/Companies.java index 5e0246c4..e0d7c8c8 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/Companies.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/Companies.java @@ -139,10 +139,10 @@ public CreateCompanyResponse create( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -174,7 +174,7 @@ public CreateCompanyResponse create( new BeforeRequestContextImpl( "create-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -187,7 +187,7 @@ public CreateCompanyResponse create( new AfterErrorContextImpl( "create-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -200,7 +200,7 @@ public CreateCompanyResponse create( new AfterSuccessContextImpl( "create-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -320,10 +320,10 @@ public DeleteCompanyResponse delete( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -355,7 +355,7 @@ public DeleteCompanyResponse delete( new BeforeRequestContextImpl( "delete-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -368,7 +368,7 @@ public DeleteCompanyResponse delete( new AfterErrorContextImpl( "delete-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -381,7 +381,7 @@ public DeleteCompanyResponse delete( new AfterSuccessContextImpl( "delete-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -490,10 +490,10 @@ public GetCompanyResponse get( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -525,7 +525,7 @@ public GetCompanyResponse get( new BeforeRequestContextImpl( "get-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -538,7 +538,7 @@ public GetCompanyResponse get( new AfterErrorContextImpl( "get-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -551,7 +551,7 @@ public GetCompanyResponse get( new AfterSuccessContextImpl( "get-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -662,10 +662,10 @@ public GetCompanyAccessTokenResponse getAccessToken( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -697,7 +697,7 @@ public GetCompanyAccessTokenResponse getAccessToken( new BeforeRequestContextImpl( "get-company-access-token", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -710,7 +710,7 @@ public GetCompanyAccessTokenResponse getAccessToken( new AfterErrorContextImpl( "get-company-access-token", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -723,7 +723,7 @@ public GetCompanyAccessTokenResponse getAccessToken( new AfterSuccessContextImpl( "get-company-access-token", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -790,6 +790,19 @@ public GetCompanyAccessTokenResponse getAccessToken( * * A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. * Each company can have multiple [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + * + * ## Filter by tags + * + * The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): + * + * - equals (`=`) + * - not equals (`!=`) + * - contains (`~`) + * + * For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: + * - Foreign key: `uid = {yourCustomerId}` + * - Region: `region != uk` + * - Owning team and region: `region = uk && owningTeam = invoice-finance` * @return The call builder */ public ListCompaniesRequestBuilder list() { @@ -802,6 +815,19 @@ public ListCompaniesRequestBuilder list() { * * A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. * Each company can have multiple [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + * + * ## Filter by tags + * + * The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): + * + * - equals (`=`) + * - not equals (`!=`) + * - contains (`~`) + * + * For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: + * - Foreign key: `uid = {yourCustomerId}` + * - Region: `region != uk` + * - Owning team and region: `region = uk && owningTeam = invoice-finance` * @param request The request object containing all of the parameters for the API call. * @return The response from the API call * @throws Exception if the API call fails @@ -817,6 +843,19 @@ public ListCompaniesResponse list( * * A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. * Each company can have multiple [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + * + * ## Filter by tags + * + * The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): + * + * - equals (`=`) + * - not equals (`!=`) + * - contains (`~`) + * + * For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: + * - Foreign key: `uid = {yourCustomerId}` + * - Region: `region != uk` + * - Owning team and region: `region = uk && owningTeam = invoice-finance` * @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 @@ -843,10 +882,10 @@ public ListCompaniesResponse list( ListCompaniesRequest.class, request, null)); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -878,7 +917,7 @@ public ListCompaniesResponse list( new BeforeRequestContextImpl( "list-companies", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -891,7 +930,7 @@ public ListCompaniesResponse list( new AfterErrorContextImpl( "list-companies", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -904,7 +943,7 @@ public ListCompaniesResponse list( new AfterSuccessContextImpl( "list-companies", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -1031,10 +1070,10 @@ public UpdateCompanyResponse update( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -1066,7 +1105,7 @@ public UpdateCompanyResponse update( new BeforeRequestContextImpl( "update-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -1079,7 +1118,7 @@ public UpdateCompanyResponse update( new AfterErrorContextImpl( "update-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -1092,7 +1131,7 @@ public UpdateCompanyResponse update( new AfterSuccessContextImpl( "update-company", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/CompanyInformation.java b/bank-feeds/src/main/java/io/codat/bank_feeds/CompanyInformation.java index 4267c274..11130746 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/CompanyInformation.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/CompanyInformation.java @@ -99,10 +99,10 @@ public GetCompanyInformationResponse get( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -134,7 +134,7 @@ public GetCompanyInformationResponse get( new BeforeRequestContextImpl( "get-company-information", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -147,7 +147,7 @@ public GetCompanyInformationResponse get( new AfterErrorContextImpl( "get-company-information", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -160,7 +160,7 @@ public GetCompanyInformationResponse get( new AfterSuccessContextImpl( "get-company-information", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/Configuration.java b/bank-feeds/src/main/java/io/codat/bank_feeds/Configuration.java index 154b96c0..03776d5a 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/Configuration.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/Configuration.java @@ -100,10 +100,10 @@ public GetConfigurationResponse get( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -135,7 +135,7 @@ public GetConfigurationResponse get( new BeforeRequestContextImpl( "get-configuration", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -148,7 +148,7 @@ public GetConfigurationResponse get( new AfterErrorContextImpl( "get-configuration", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -161,7 +161,7 @@ public GetConfigurationResponse get( new AfterSuccessContextImpl( "get-configuration", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -279,10 +279,10 @@ public SetConfigurationResponse set( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -314,7 +314,7 @@ public SetConfigurationResponse set( new BeforeRequestContextImpl( "set-configuration", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -327,7 +327,7 @@ public SetConfigurationResponse set( new AfterErrorContextImpl( "set-configuration", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -340,7 +340,7 @@ public SetConfigurationResponse set( new AfterSuccessContextImpl( "set-configuration", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/Connections.java b/bank-feeds/src/main/java/io/codat/bank_feeds/Connections.java index 1a923f1c..3f28d177 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/Connections.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/Connections.java @@ -129,10 +129,10 @@ public CreateConnectionResponse create( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -164,7 +164,7 @@ public CreateConnectionResponse create( new BeforeRequestContextImpl( "create-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -177,7 +177,7 @@ public CreateConnectionResponse create( new AfterErrorContextImpl( "create-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -190,7 +190,7 @@ public CreateConnectionResponse create( new AfterSuccessContextImpl( "create-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -301,10 +301,10 @@ public DeleteConnectionResponse delete( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -336,7 +336,7 @@ public DeleteConnectionResponse delete( new BeforeRequestContextImpl( "delete-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -349,7 +349,7 @@ public DeleteConnectionResponse delete( new AfterErrorContextImpl( "delete-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -362,7 +362,7 @@ public DeleteConnectionResponse delete( new AfterSuccessContextImpl( "delete-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -459,10 +459,10 @@ public GetConnectionResponse get( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -494,7 +494,7 @@ public GetConnectionResponse get( new BeforeRequestContextImpl( "get-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -507,7 +507,7 @@ public GetConnectionResponse get( new AfterErrorContextImpl( "get-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -520,7 +520,7 @@ public GetConnectionResponse get( new AfterSuccessContextImpl( "get-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -633,10 +633,10 @@ public ListConnectionsResponse list( ListConnectionsRequest.class, request, null)); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -668,7 +668,7 @@ public ListConnectionsResponse list( new BeforeRequestContextImpl( "list-connections", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -681,7 +681,7 @@ public ListConnectionsResponse list( new AfterErrorContextImpl( "list-connections", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -694,7 +694,7 @@ public ListConnectionsResponse list( new AfterSuccessContextImpl( "list-connections", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -812,10 +812,10 @@ public UnlinkConnectionResponse unlink( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -847,7 +847,7 @@ public UnlinkConnectionResponse unlink( new BeforeRequestContextImpl( "unlink-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -860,7 +860,7 @@ public UnlinkConnectionResponse unlink( new AfterErrorContextImpl( "unlink-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -873,7 +873,7 @@ public UnlinkConnectionResponse unlink( new AfterSuccessContextImpl( "unlink-connection", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/SDKConfiguration.java b/bank-feeds/src/main/java/io/codat/bank_feeds/SDKConfiguration.java index d7b07867..61e01be4 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/SDKConfiguration.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/SDKConfiguration.java @@ -18,13 +18,19 @@ class SDKConfiguration { public Optional securitySource() { return Optional.ofNullable(securitySource); } + public HTTPClient defaultClient; + public String serverUrl; + + public String resolvedServerUrl() { + return serverUrl; + } public int serverIdx = 0; private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "3.0.0"; - public static final String SDK_VERSION = "2.0.0"; - public static final String GEN_VERSION = "2.462.1"; + public static final String SDK_VERSION = "3.0.0"; + public static final String GEN_VERSION = "2.479.3"; private static final String BASE_PACKAGE = "io.codat.bank_feeds"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", @@ -51,7 +57,7 @@ public void setHooks(Hooks hooks) { public void initialize() { SDKHooks.initialize(_hooks); // apply the sdk init hook immediately - SdkInitData data = _hooks.sdkInit(new SdkInitData(serverUrl, defaultClient)); + SdkInitData data = _hooks.sdkInit(new SdkInitData(resolvedServerUrl(), defaultClient)); this.serverUrl = data.baseUrl(); this.defaultClient = data.client(); } diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/SourceAccounts.java b/bank-feeds/src/main/java/io/codat/bank_feeds/SourceAccounts.java index 227a3918..1a761803 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/SourceAccounts.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/SourceAccounts.java @@ -145,10 +145,10 @@ public CreateSourceAccountResponse create( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -180,7 +180,7 @@ public CreateSourceAccountResponse create( new BeforeRequestContextImpl( "create-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -193,7 +193,7 @@ public CreateSourceAccountResponse create( new AfterErrorContextImpl( "create-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -206,7 +206,7 @@ public CreateSourceAccountResponse create( new AfterSuccessContextImpl( "create-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -333,10 +333,10 @@ public CreateBatchSourceAccountResponse createBatch( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -368,7 +368,7 @@ public CreateBatchSourceAccountResponse createBatch( new BeforeRequestContextImpl( "create-batch-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -381,7 +381,7 @@ public CreateBatchSourceAccountResponse createBatch( new AfterErrorContextImpl( "create-batch-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -394,7 +394,7 @@ public CreateBatchSourceAccountResponse createBatch( new AfterSuccessContextImpl( "create-batch-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -526,10 +526,10 @@ public DeleteSourceAccountResponse delete( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -561,7 +561,7 @@ public DeleteSourceAccountResponse delete( new BeforeRequestContextImpl( "delete-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -574,7 +574,7 @@ public DeleteSourceAccountResponse delete( new AfterErrorContextImpl( "delete-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -587,7 +587,7 @@ public DeleteSourceAccountResponse delete( new AfterSuccessContextImpl( "delete-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -690,10 +690,10 @@ public DeleteBankFeedCredentialsResponse deleteCredentials( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -725,7 +725,7 @@ public DeleteBankFeedCredentialsResponse deleteCredentials( new BeforeRequestContextImpl( "delete-bank-feed-credentials", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -738,7 +738,7 @@ public DeleteBankFeedCredentialsResponse deleteCredentials( new AfterErrorContextImpl( "delete-bank-feed-credentials", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -751,7 +751,7 @@ public DeleteBankFeedCredentialsResponse deleteCredentials( new AfterSuccessContextImpl( "delete-bank-feed-credentials", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -879,10 +879,10 @@ public GenerateCredentialsResponse generateCredentials( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -914,7 +914,7 @@ public GenerateCredentialsResponse generateCredentials( new BeforeRequestContextImpl( "generate-credentials", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -927,7 +927,7 @@ public GenerateCredentialsResponse generateCredentials( new AfterErrorContextImpl( "generate-credentials", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -940,7 +940,7 @@ public GenerateCredentialsResponse generateCredentials( new AfterSuccessContextImpl( "generate-credentials", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -1063,10 +1063,10 @@ public ListSourceAccountsResponse list( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -1098,7 +1098,7 @@ public ListSourceAccountsResponse list( new BeforeRequestContextImpl( "list-source-accounts", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -1111,7 +1111,7 @@ public ListSourceAccountsResponse list( new AfterErrorContextImpl( "list-source-accounts", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -1124,7 +1124,7 @@ public ListSourceAccountsResponse list( new AfterSuccessContextImpl( "list-source-accounts", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -1257,10 +1257,10 @@ public UpdateSourceAccountResponse update( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -1292,7 +1292,7 @@ public UpdateSourceAccountResponse update( new BeforeRequestContextImpl( "update-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -1305,7 +1305,7 @@ public UpdateSourceAccountResponse update( new AfterErrorContextImpl( "update-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -1318,7 +1318,7 @@ public UpdateSourceAccountResponse update( new AfterSuccessContextImpl( "update-source-account", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/Sync.java b/bank-feeds/src/main/java/io/codat/bank_feeds/Sync.java index bbc43b11..22943c52 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/Sync.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/Sync.java @@ -94,10 +94,10 @@ public GetLastSuccessfulResponse getLastSuccessfulSync( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -129,7 +129,7 @@ public GetLastSuccessfulResponse getLastSuccessfulSync( new BeforeRequestContextImpl( "get-last-successful", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -142,7 +142,7 @@ public GetLastSuccessfulResponse getLastSuccessfulSync( new AfterErrorContextImpl( "get-last-successful", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -155,7 +155,7 @@ public GetLastSuccessfulResponse getLastSuccessfulSync( new AfterSuccessContextImpl( "get-last-successful", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/Transactions.java b/bank-feeds/src/main/java/io/codat/bank_feeds/Transactions.java index a3c5edf9..3f6c21c6 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/Transactions.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/Transactions.java @@ -147,10 +147,10 @@ public CreateBankTransactionsResponse create( CreateBankTransactionsRequest.class, request, null)); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -182,7 +182,7 @@ public CreateBankTransactionsResponse create( new BeforeRequestContextImpl( "create-bank-transactions", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -195,7 +195,7 @@ public CreateBankTransactionsResponse create( new AfterErrorContextImpl( "create-bank-transactions", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -208,7 +208,7 @@ public CreateBankTransactionsResponse create( new AfterSuccessContextImpl( "create-bank-transactions", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -334,10 +334,10 @@ public GetCreateBankTransactionsModelResponse getCreateModel( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -369,7 +369,7 @@ public GetCreateBankTransactionsModelResponse getCreateModel( new BeforeRequestContextImpl( "get-create-bank-transactions-model", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -382,7 +382,7 @@ public GetCreateBankTransactionsModelResponse getCreateModel( new AfterErrorContextImpl( "get-create-bank-transactions-model", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -395,7 +395,7 @@ public GetCreateBankTransactionsModelResponse getCreateModel( new AfterSuccessContextImpl( "get-create-bank-transactions-model", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -515,10 +515,10 @@ public GetCreateOperationResponse getCreateOperation( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -550,7 +550,7 @@ public GetCreateOperationResponse getCreateOperation( new BeforeRequestContextImpl( "get-create-operation", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -563,7 +563,7 @@ public GetCreateOperationResponse getCreateOperation( new AfterErrorContextImpl( "get-create-operation", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -576,7 +576,7 @@ public GetCreateOperationResponse getCreateOperation( new AfterSuccessContextImpl( "get-create-operation", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() @@ -701,10 +701,10 @@ public ListCreateOperationsResponse listCreateOperations( ListCreateOperationsRequest.class, request, null)); - + + Optional _hookSecuritySource = this.sdkConfiguration.securitySource(); Utils.configureSecurity(_req, this.sdkConfiguration.securitySource.getSecurity()); - HTTPClient _client = this.sdkConfiguration.defaultClient; HTTPRequest _finalReq = _req; RetryConfig _retryConfig; @@ -736,7 +736,7 @@ public ListCreateOperationsResponse listCreateOperations( new BeforeRequestContextImpl( "list-create-operations", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _finalReq.build()); } catch (Exception _e) { throw new NonRetryableException(_e); @@ -749,7 +749,7 @@ public ListCreateOperationsResponse listCreateOperations( new AfterErrorContextImpl( "list-create-operations", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), Optional.empty(), Optional.of(_e)); } @@ -762,7 +762,7 @@ public ListCreateOperationsResponse listCreateOperations( new AfterSuccessContextImpl( "list-create-operations", Optional.of(List.of()), - sdkConfiguration.securitySource()), + _hookSecuritySource), _retries.run()); String _contentType = _httpRes .headers() diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/BankFeedMapping.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/BankFeedMapping.java index 56a1090d..8b845051 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/BankFeedMapping.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/BankFeedMapping.java @@ -14,6 +14,7 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; +import java.math.BigDecimal; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -76,7 +77,7 @@ public class BankFeedMapping { */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("sourceBalance") - private Optional sourceBalance; + private Optional sourceBalance; /** * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. @@ -125,7 +126,7 @@ public BankFeedMapping( @JsonProperty("sourceAccountId") Optional sourceAccountId, @JsonProperty("sourceAccountName") Optional sourceAccountName, @JsonProperty("sourceAccountNumber") Optional sourceAccountNumber, - @JsonProperty("sourceBalance") Optional sourceBalance, + @JsonProperty("sourceBalance") Optional sourceBalance, @JsonProperty("sourceCurrency") Optional sourceCurrency, @JsonProperty("status") Optional status, @JsonProperty("targetAccountId") JsonNullable targetAccountId, @@ -210,9 +211,10 @@ public Optional sourceAccountNumber() { /** * Balance for the source account. */ + @SuppressWarnings("unchecked") @JsonIgnore - public Optional sourceBalance() { - return sourceBalance; + public Optional sourceBalance() { + return (Optional) sourceBalance; } /** @@ -377,16 +379,24 @@ public BankFeedMapping withSourceAccountNumber(Optional sourceAccountNum /** * Balance for the source account. */ - public BankFeedMapping withSourceBalance(String sourceBalance) { + public BankFeedMapping withSourceBalance(BigDecimal sourceBalance) { Utils.checkNotNull(sourceBalance, "sourceBalance"); this.sourceBalance = Optional.ofNullable(sourceBalance); return this; } + /** + * Balance for the source account. + */ + public BankFeedMapping withSourceBalance(double sourceBalance) { + this.sourceBalance = Optional.of(BigDecimal.valueOf(sourceBalance)); + return this; + } + /** * Balance for the source account. */ - public BankFeedMapping withSourceBalance(Optional sourceBalance) { + public BankFeedMapping withSourceBalance(Optional sourceBalance) { Utils.checkNotNull(sourceBalance, "sourceBalance"); this.sourceBalance = sourceBalance; return this; @@ -556,7 +566,7 @@ public final static class Builder { private Optional sourceAccountNumber = Optional.empty(); - private Optional sourceBalance = Optional.empty(); + private Optional sourceBalance = Optional.empty(); private Optional sourceCurrency = Optional.empty(); @@ -683,7 +693,7 @@ public Builder sourceAccountNumber(Optional sourceAccountNumber) { /** * Balance for the source account. */ - public Builder sourceBalance(String sourceBalance) { + public Builder sourceBalance(BigDecimal sourceBalance) { Utils.checkNotNull(sourceBalance, "sourceBalance"); this.sourceBalance = Optional.ofNullable(sourceBalance); return this; @@ -692,7 +702,15 @@ public Builder sourceBalance(String sourceBalance) { /** * Balance for the source account. */ - public Builder sourceBalance(Optional sourceBalance) { + public Builder sourceBalance(double sourceBalance) { + this.sourceBalance = Optional.of(BigDecimal.valueOf(sourceBalance)); + return this; + } + + /** + * Balance for the source account. + */ + public Builder sourceBalance(Optional sourceBalance) { Utils.checkNotNull(sourceBalance, "sourceBalance"); this.sourceBalance = sourceBalance; return this; diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountPrototype.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountPrototype.java new file mode 100644 index 00000000..f6832f17 --- /dev/null +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountPrototype.java @@ -0,0 +1,711 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.bank_feeds.models.components; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.codat.bank_feeds.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigDecimal; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class SourceAccountPrototype { + + /** + * The bank account name. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountName") + private JsonNullable accountName; + + /** + * The account number. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountNumber") + private JsonNullable accountNumber; + + /** + * The type of bank account e.g. Credit. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountType") + private JsonNullable accountType; + + /** + * The latest balance for the bank account. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("balance") + private JsonNullable balance; + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("currency") + private Optional currency; + + /** + * Unique ID for the bank account. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("id") + private Optional 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. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("modifiedDate") + private Optional modifiedDate; + + /** + * The sort code. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("sortCode") + private JsonNullable sortCode; + + @JsonCreator + public SourceAccountPrototype( + @JsonProperty("accountName") JsonNullable accountName, + @JsonProperty("accountNumber") JsonNullable accountNumber, + @JsonProperty("accountType") JsonNullable accountType, + @JsonProperty("balance") JsonNullable balance, + @JsonProperty("currency") Optional currency, + @JsonProperty("id") Optional id, + @JsonProperty("modifiedDate") Optional modifiedDate, + @JsonProperty("sortCode") JsonNullable sortCode) { + Utils.checkNotNull(accountName, "accountName"); + Utils.checkNotNull(accountNumber, "accountNumber"); + Utils.checkNotNull(accountType, "accountType"); + Utils.checkNotNull(balance, "balance"); + Utils.checkNotNull(currency, "currency"); + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(modifiedDate, "modifiedDate"); + Utils.checkNotNull(sortCode, "sortCode"); + this.accountName = accountName; + this.accountNumber = accountNumber; + this.accountType = accountType; + this.balance = balance; + this.currency = currency; + this.id = id; + this.modifiedDate = modifiedDate; + this.sortCode = sortCode; + } + + public SourceAccountPrototype() { + this(JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined()); + } + + /** + * The bank account name. + */ + @JsonIgnore + public JsonNullable accountName() { + return accountName; + } + + /** + * The account number. + */ + @JsonIgnore + public JsonNullable accountNumber() { + return accountNumber; + } + + /** + * The type of bank account e.g. Credit. + */ + @JsonIgnore + public JsonNullable accountType() { + return accountType; + } + + /** + * The latest balance for the bank account. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable balance() { + return (JsonNullable) balance; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + @JsonIgnore + public Optional currency() { + return currency; + } + + /** + * Unique ID for the bank account. + */ + @JsonIgnore + public Optional 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. + */ + @JsonIgnore + public Optional modifiedDate() { + return modifiedDate; + } + + /** + * The sort code. + */ + @JsonIgnore + public JsonNullable sortCode() { + return sortCode; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The bank account name. + */ + public SourceAccountPrototype withAccountName(String accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = JsonNullable.of(accountName); + return this; + } + + /** + * The bank account name. + */ + public SourceAccountPrototype withAccountName(JsonNullable accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = accountName; + return this; + } + + /** + * The account number. + */ + public SourceAccountPrototype withAccountNumber(String accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = JsonNullable.of(accountNumber); + return this; + } + + /** + * The account number. + */ + public SourceAccountPrototype withAccountNumber(JsonNullable accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = accountNumber; + return this; + } + + /** + * The type of bank account e.g. Credit. + */ + public SourceAccountPrototype withAccountType(String accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = JsonNullable.of(accountType); + return this; + } + + /** + * The type of bank account e.g. Credit. + */ + public SourceAccountPrototype withAccountType(JsonNullable accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = accountType; + return this; + } + + /** + * The latest balance for the bank account. + */ + public SourceAccountPrototype withBalance(BigDecimal balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = JsonNullable.of(balance); + return this; + } + + /** + * The latest balance for the bank account. + */ + public SourceAccountPrototype withBalance(double balance) { + this.balance = JsonNullable.of(BigDecimal.valueOf(balance)); + return this; + } + + /** + * The latest balance for the bank account. + */ + public SourceAccountPrototype withBalance(JsonNullable balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = balance; + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public SourceAccountPrototype withCurrency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public SourceAccountPrototype withCurrency(Optional currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * Unique ID for the bank account. + */ + public SourceAccountPrototype withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Unique ID for the bank account. + */ + public SourceAccountPrototype withId(Optional 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 SourceAccountPrototype withModifiedDate(String modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = Optional.ofNullable(modifiedDate); + 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 SourceAccountPrototype withModifiedDate(Optional modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = modifiedDate; + return this; + } + + /** + * The sort code. + */ + public SourceAccountPrototype withSortCode(String sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = JsonNullable.of(sortCode); + return this; + } + + /** + * The sort code. + */ + public SourceAccountPrototype withSortCode(JsonNullable sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = sortCode; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceAccountPrototype other = (SourceAccountPrototype) o; + return + Objects.deepEquals(this.accountName, other.accountName) && + Objects.deepEquals(this.accountNumber, other.accountNumber) && + Objects.deepEquals(this.accountType, other.accountType) && + Objects.deepEquals(this.balance, other.balance) && + Objects.deepEquals(this.currency, other.currency) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.modifiedDate, other.modifiedDate) && + Objects.deepEquals(this.sortCode, other.sortCode); + } + + @Override + public int hashCode() { + return Objects.hash( + accountName, + accountNumber, + accountType, + balance, + currency, + id, + modifiedDate, + sortCode); + } + + @Override + public String toString() { + return Utils.toString(SourceAccountPrototype.class, + "accountName", accountName, + "accountNumber", accountNumber, + "accountType", accountType, + "balance", balance, + "currency", currency, + "id", id, + "modifiedDate", modifiedDate, + "sortCode", sortCode); + } + + public final static class Builder { + + private JsonNullable accountName = JsonNullable.undefined(); + + private JsonNullable accountNumber = JsonNullable.undefined(); + + private JsonNullable accountType = JsonNullable.undefined(); + + private JsonNullable balance = JsonNullable.undefined(); + + private Optional currency = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional modifiedDate = Optional.empty(); + + private JsonNullable sortCode = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The bank account name. + */ + public Builder accountName(String accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = JsonNullable.of(accountName); + return this; + } + + /** + * The bank account name. + */ + public Builder accountName(JsonNullable accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = accountName; + return this; + } + + /** + * The account number. + */ + public Builder accountNumber(String accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = JsonNullable.of(accountNumber); + return this; + } + + /** + * The account number. + */ + public Builder accountNumber(JsonNullable accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = accountNumber; + return this; + } + + /** + * The type of bank account e.g. Credit. + */ + public Builder accountType(String accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = JsonNullable.of(accountType); + return this; + } + + /** + * The type of bank account e.g. Credit. + */ + public Builder accountType(JsonNullable accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = accountType; + return this; + } + + /** + * The latest balance for the bank account. + */ + public Builder balance(BigDecimal balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = JsonNullable.of(balance); + return this; + } + + /** + * The latest balance for the bank account. + */ + public Builder balance(double balance) { + this.balance = JsonNullable.of(BigDecimal.valueOf(balance)); + return this; + } + + /** + * The latest balance for the bank account. + */ + public Builder balance(JsonNullable balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = balance; + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public Builder currency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public Builder currency(Optional currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * Unique ID for the bank account. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Unique ID for the bank account. + */ + public Builder id(Optional 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 modifiedDate(String modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = Optional.ofNullable(modifiedDate); + 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 modifiedDate(Optional modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = modifiedDate; + return this; + } + + /** + * The sort code. + */ + public Builder sortCode(String sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = JsonNullable.of(sortCode); + return this; + } + + /** + * The sort code. + */ + public Builder sortCode(JsonNullable sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = sortCode; + return this; + } + + public SourceAccountPrototype build() { + return new SourceAccountPrototype( + accountName, + accountNumber, + accountType, + balance, + currency, + id, + modifiedDate, + sortCode); + } + } +} + diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2.java index 843e03bb..8c0079a1 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2.java @@ -45,7 +45,7 @@ public class SourceAccountV2 { * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. */ @JsonProperty("accountType") - private AccountType accountType; + private SourceAccountV2AccountType accountType; /** * The latest balance for the bank account. @@ -113,6 +113,13 @@ public class SourceAccountV2 { @JsonProperty("routingInfo") private Optional routingInfo; + /** + * The sort code. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("sortCode") + private JsonNullable sortCode; + /** * Status of the source account. */ @@ -125,13 +132,14 @@ public SourceAccountV2( @JsonProperty("accountInfo") JsonNullable accountInfo, @JsonProperty("accountName") String accountName, @JsonProperty("accountNumber") String accountNumber, - @JsonProperty("accountType") AccountType accountType, + @JsonProperty("accountType") SourceAccountV2AccountType accountType, @JsonProperty("balance") BigDecimal balance, @JsonProperty("currency") String currency, @JsonProperty("feedStartDate") JsonNullable feedStartDate, @JsonProperty("id") String id, @JsonProperty("modifiedDate") Optional modifiedDate, @JsonProperty("routingInfo") Optional routingInfo, + @JsonProperty("sortCode") JsonNullable sortCode, @JsonProperty("status") JsonNullable status) { Utils.checkNotNull(accountInfo, "accountInfo"); Utils.checkNotNull(accountName, "accountName"); @@ -143,6 +151,7 @@ public SourceAccountV2( Utils.checkNotNull(id, "id"); Utils.checkNotNull(modifiedDate, "modifiedDate"); Utils.checkNotNull(routingInfo, "routingInfo"); + Utils.checkNotNull(sortCode, "sortCode"); Utils.checkNotNull(status, "status"); this.accountInfo = accountInfo; this.accountName = accountName; @@ -154,17 +163,18 @@ public SourceAccountV2( this.id = id; this.modifiedDate = modifiedDate; this.routingInfo = routingInfo; + this.sortCode = sortCode; this.status = status; } public SourceAccountV2( String accountName, String accountNumber, - AccountType accountType, + SourceAccountV2AccountType accountType, BigDecimal balance, String currency, String id) { - this(JsonNullable.undefined(), accountName, accountNumber, accountType, balance, currency, JsonNullable.undefined(), id, Optional.empty(), Optional.empty(), JsonNullable.undefined()); + this(JsonNullable.undefined(), accountName, accountNumber, accountType, balance, currency, JsonNullable.undefined(), id, Optional.empty(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined()); } @SuppressWarnings("unchecked") @@ -193,7 +203,7 @@ public String accountNumber() { * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. */ @JsonIgnore - public AccountType accountType() { + public SourceAccountV2AccountType accountType() { return accountType; } @@ -273,6 +283,14 @@ public Optional routingInfo() { return (Optional) routingInfo; } + /** + * The sort code. + */ + @JsonIgnore + public JsonNullable sortCode() { + return sortCode; + } + /** * Status of the source account. */ @@ -319,7 +337,7 @@ public SourceAccountV2 withAccountNumber(String accountNumber) { /** * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. */ - public SourceAccountV2 withAccountType(AccountType accountType) { + public SourceAccountV2 withAccountType(SourceAccountV2AccountType accountType) { Utils.checkNotNull(accountType, "accountType"); this.accountType = accountType; return this; @@ -462,6 +480,24 @@ public SourceAccountV2 withRoutingInfo(Optional routingIn return this; } + /** + * The sort code. + */ + public SourceAccountV2 withSortCode(String sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = JsonNullable.of(sortCode); + return this; + } + + /** + * The sort code. + */ + public SourceAccountV2 withSortCode(JsonNullable sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = sortCode; + return this; + } + /** * Status of the source account. */ @@ -500,6 +536,7 @@ public boolean equals(java.lang.Object o) { Objects.deepEquals(this.id, other.id) && Objects.deepEquals(this.modifiedDate, other.modifiedDate) && Objects.deepEquals(this.routingInfo, other.routingInfo) && + Objects.deepEquals(this.sortCode, other.sortCode) && Objects.deepEquals(this.status, other.status); } @@ -516,6 +553,7 @@ public int hashCode() { id, modifiedDate, routingInfo, + sortCode, status); } @@ -532,6 +570,7 @@ public String toString() { "id", id, "modifiedDate", modifiedDate, "routingInfo", routingInfo, + "sortCode", sortCode, "status", status); } @@ -543,7 +582,7 @@ public final static class Builder { private String accountNumber; - private AccountType accountType; + private SourceAccountV2AccountType accountType; private BigDecimal balance; @@ -557,6 +596,8 @@ public final static class Builder { private Optional routingInfo = Optional.empty(); + private JsonNullable sortCode = JsonNullable.undefined(); + private JsonNullable status = JsonNullable.undefined(); private Builder() { @@ -596,7 +637,7 @@ public Builder accountNumber(String accountNumber) { /** * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. */ - public Builder accountType(AccountType accountType) { + public Builder accountType(SourceAccountV2AccountType accountType) { Utils.checkNotNull(accountType, "accountType"); this.accountType = accountType; return this; @@ -739,6 +780,24 @@ public Builder routingInfo(Optional routingInfo) { return this; } + /** + * The sort code. + */ + public Builder sortCode(String sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = JsonNullable.of(sortCode); + return this; + } + + /** + * The sort code. + */ + public Builder sortCode(JsonNullable sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = sortCode; + return this; + } + /** * Status of the source account. */ @@ -769,6 +828,7 @@ public SourceAccountV2 build() { id, modifiedDate, routingInfo, + sortCode, status); } } diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2AccountType.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2AccountType.java new file mode 100644 index 00000000..2a4777f3 --- /dev/null +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2AccountType.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.bank_feeds.models.components; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.String; + +/** + * SourceAccountV2AccountType - The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ +public enum SourceAccountV2AccountType { + CHECKING("checking"), + SAVINGS("savings"), + LOAN("loan"), + CREDIT_CARD("creditCard"), + PREPAID_CARD("prepaidCard"); + + @JsonValue + private final String value; + + private SourceAccountV2AccountType(String value) { + this.value = value; + } + + public String value() { + return value; + } +} diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2Prototype.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2Prototype.java new file mode 100644 index 00000000..4a0e886b --- /dev/null +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountV2Prototype.java @@ -0,0 +1,816 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.bank_feeds.models.components; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.codat.bank_feeds.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.math.BigDecimal; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class SourceAccountV2Prototype { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountInfo") + private JsonNullable accountInfo; + + /** + * The bank account name. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountName") + private Optional accountName; + + /** + * The account number. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountNumber") + private Optional accountNumber; + + /** + * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("accountType") + private Optional accountType; + + /** + * The latest balance for the bank account. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("balance") + private Optional balance; + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("currency") + private Optional currency; + + /** + * Unique ID for the bank account. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("id") + private Optional 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. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("modifiedDate") + private Optional modifiedDate; + + /** + * Routing information for the bank. This does not include account number. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("routingInfo") + private Optional routingInfo; + + /** + * The sort code. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("sortCode") + private JsonNullable sortCode; + + @JsonCreator + public SourceAccountV2Prototype( + @JsonProperty("accountInfo") JsonNullable accountInfo, + @JsonProperty("accountName") Optional accountName, + @JsonProperty("accountNumber") Optional accountNumber, + @JsonProperty("accountType") Optional accountType, + @JsonProperty("balance") Optional balance, + @JsonProperty("currency") Optional currency, + @JsonProperty("id") Optional id, + @JsonProperty("modifiedDate") Optional modifiedDate, + @JsonProperty("routingInfo") Optional routingInfo, + @JsonProperty("sortCode") JsonNullable sortCode) { + Utils.checkNotNull(accountInfo, "accountInfo"); + Utils.checkNotNull(accountName, "accountName"); + Utils.checkNotNull(accountNumber, "accountNumber"); + Utils.checkNotNull(accountType, "accountType"); + Utils.checkNotNull(balance, "balance"); + Utils.checkNotNull(currency, "currency"); + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(modifiedDate, "modifiedDate"); + Utils.checkNotNull(routingInfo, "routingInfo"); + Utils.checkNotNull(sortCode, "sortCode"); + this.accountInfo = accountInfo; + this.accountName = accountName; + this.accountNumber = accountNumber; + this.accountType = accountType; + this.balance = balance; + this.currency = currency; + this.id = id; + this.modifiedDate = modifiedDate; + this.routingInfo = routingInfo; + this.sortCode = sortCode; + } + + public SourceAccountV2Prototype() { + this(JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined()); + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable accountInfo() { + return (JsonNullable) accountInfo; + } + + /** + * The bank account name. + */ + @JsonIgnore + public Optional accountName() { + return accountName; + } + + /** + * The account number. + */ + @JsonIgnore + public Optional accountNumber() { + return accountNumber; + } + + /** + * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional accountType() { + return (Optional) accountType; + } + + /** + * The latest balance for the bank account. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional balance() { + return (Optional) balance; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + @JsonIgnore + public Optional currency() { + return currency; + } + + /** + * Unique ID for the bank account. + */ + @JsonIgnore + public Optional 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. + */ + @JsonIgnore + public Optional modifiedDate() { + return modifiedDate; + } + + /** + * Routing information for the bank. This does not include account number. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional routingInfo() { + return (Optional) routingInfo; + } + + /** + * The sort code. + */ + @JsonIgnore + public JsonNullable sortCode() { + return sortCode; + } + + public final static Builder builder() { + return new Builder(); + } + + public SourceAccountV2Prototype withAccountInfo(AccountInfo accountInfo) { + Utils.checkNotNull(accountInfo, "accountInfo"); + this.accountInfo = JsonNullable.of(accountInfo); + return this; + } + + public SourceAccountV2Prototype withAccountInfo(JsonNullable accountInfo) { + Utils.checkNotNull(accountInfo, "accountInfo"); + this.accountInfo = accountInfo; + return this; + } + + /** + * The bank account name. + */ + public SourceAccountV2Prototype withAccountName(String accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = Optional.ofNullable(accountName); + return this; + } + + /** + * The bank account name. + */ + public SourceAccountV2Prototype withAccountName(Optional accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = accountName; + return this; + } + + /** + * The account number. + */ + public SourceAccountV2Prototype withAccountNumber(String accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = Optional.ofNullable(accountNumber); + return this; + } + + /** + * The account number. + */ + public SourceAccountV2Prototype withAccountNumber(Optional accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = accountNumber; + return this; + } + + /** + * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ + public SourceAccountV2Prototype withAccountType(AccountType accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = Optional.ofNullable(accountType); + return this; + } + + /** + * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ + public SourceAccountV2Prototype withAccountType(Optional accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = accountType; + return this; + } + + /** + * The latest balance for the bank account. + */ + public SourceAccountV2Prototype withBalance(BigDecimal balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = Optional.ofNullable(balance); + return this; + } + + /** + * The latest balance for the bank account. + */ + public SourceAccountV2Prototype withBalance(double balance) { + this.balance = Optional.of(BigDecimal.valueOf(balance)); + return this; + } + + /** + * The latest balance for the bank account. + */ + public SourceAccountV2Prototype withBalance(Optional balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = balance; + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public SourceAccountV2Prototype withCurrency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public SourceAccountV2Prototype withCurrency(Optional currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * Unique ID for the bank account. + */ + public SourceAccountV2Prototype withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Unique ID for the bank account. + */ + public SourceAccountV2Prototype withId(Optional 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 SourceAccountV2Prototype withModifiedDate(String modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = Optional.ofNullable(modifiedDate); + 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 SourceAccountV2Prototype withModifiedDate(Optional modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = modifiedDate; + return this; + } + + /** + * Routing information for the bank. This does not include account number. + */ + public SourceAccountV2Prototype withRoutingInfo(RoutingInfo routingInfo) { + Utils.checkNotNull(routingInfo, "routingInfo"); + this.routingInfo = Optional.ofNullable(routingInfo); + return this; + } + + /** + * Routing information for the bank. This does not include account number. + */ + public SourceAccountV2Prototype withRoutingInfo(Optional routingInfo) { + Utils.checkNotNull(routingInfo, "routingInfo"); + this.routingInfo = routingInfo; + return this; + } + + /** + * The sort code. + */ + public SourceAccountV2Prototype withSortCode(String sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = JsonNullable.of(sortCode); + return this; + } + + /** + * The sort code. + */ + public SourceAccountV2Prototype withSortCode(JsonNullable sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = sortCode; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceAccountV2Prototype other = (SourceAccountV2Prototype) o; + return + Objects.deepEquals(this.accountInfo, other.accountInfo) && + Objects.deepEquals(this.accountName, other.accountName) && + Objects.deepEquals(this.accountNumber, other.accountNumber) && + Objects.deepEquals(this.accountType, other.accountType) && + Objects.deepEquals(this.balance, other.balance) && + Objects.deepEquals(this.currency, other.currency) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.modifiedDate, other.modifiedDate) && + Objects.deepEquals(this.routingInfo, other.routingInfo) && + Objects.deepEquals(this.sortCode, other.sortCode); + } + + @Override + public int hashCode() { + return Objects.hash( + accountInfo, + accountName, + accountNumber, + accountType, + balance, + currency, + id, + modifiedDate, + routingInfo, + sortCode); + } + + @Override + public String toString() { + return Utils.toString(SourceAccountV2Prototype.class, + "accountInfo", accountInfo, + "accountName", accountName, + "accountNumber", accountNumber, + "accountType", accountType, + "balance", balance, + "currency", currency, + "id", id, + "modifiedDate", modifiedDate, + "routingInfo", routingInfo, + "sortCode", sortCode); + } + + public final static class Builder { + + private JsonNullable accountInfo = JsonNullable.undefined(); + + private Optional accountName = Optional.empty(); + + private Optional accountNumber = Optional.empty(); + + private Optional accountType = Optional.empty(); + + private Optional balance = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional modifiedDate = Optional.empty(); + + private Optional routingInfo = Optional.empty(); + + private JsonNullable sortCode = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + public Builder accountInfo(AccountInfo accountInfo) { + Utils.checkNotNull(accountInfo, "accountInfo"); + this.accountInfo = JsonNullable.of(accountInfo); + return this; + } + + public Builder accountInfo(JsonNullable accountInfo) { + Utils.checkNotNull(accountInfo, "accountInfo"); + this.accountInfo = accountInfo; + return this; + } + + /** + * The bank account name. + */ + public Builder accountName(String accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = Optional.ofNullable(accountName); + return this; + } + + /** + * The bank account name. + */ + public Builder accountName(Optional accountName) { + Utils.checkNotNull(accountName, "accountName"); + this.accountName = accountName; + return this; + } + + /** + * The account number. + */ + public Builder accountNumber(String accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = Optional.ofNullable(accountNumber); + return this; + } + + /** + * The account number. + */ + public Builder accountNumber(Optional accountNumber) { + Utils.checkNotNull(accountNumber, "accountNumber"); + this.accountNumber = accountNumber; + return this; + } + + /** + * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ + public Builder accountType(AccountType accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = Optional.ofNullable(accountType); + return this; + } + + /** + * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + */ + public Builder accountType(Optional accountType) { + Utils.checkNotNull(accountType, "accountType"); + this.accountType = accountType; + return this; + } + + /** + * The latest balance for the bank account. + */ + public Builder balance(BigDecimal balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = Optional.ofNullable(balance); + return this; + } + + /** + * The latest balance for the bank account. + */ + public Builder balance(double balance) { + this.balance = Optional.of(BigDecimal.valueOf(balance)); + return this; + } + + /** + * The latest balance for the bank account. + */ + public Builder balance(Optional balance) { + Utils.checkNotNull(balance, "balance"); + this.balance = balance; + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public Builder currency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = Optional.ofNullable(currency); + return this; + } + + /** + * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + * + * ## Unknown currencies + * + * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * + * There are only a very small number of edge cases where this currency code is returned by the Codat system. + */ + public Builder currency(Optional currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * Unique ID for the bank account. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Unique ID for the bank account. + */ + public Builder id(Optional 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 modifiedDate(String modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = Optional.ofNullable(modifiedDate); + 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 modifiedDate(Optional modifiedDate) { + Utils.checkNotNull(modifiedDate, "modifiedDate"); + this.modifiedDate = modifiedDate; + return this; + } + + /** + * Routing information for the bank. This does not include account number. + */ + public Builder routingInfo(RoutingInfo routingInfo) { + Utils.checkNotNull(routingInfo, "routingInfo"); + this.routingInfo = Optional.ofNullable(routingInfo); + return this; + } + + /** + * Routing information for the bank. This does not include account number. + */ + public Builder routingInfo(Optional routingInfo) { + Utils.checkNotNull(routingInfo, "routingInfo"); + this.routingInfo = routingInfo; + return this; + } + + /** + * The sort code. + */ + public Builder sortCode(String sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = JsonNullable.of(sortCode); + return this; + } + + /** + * The sort code. + */ + public Builder sortCode(JsonNullable sortCode) { + Utils.checkNotNull(sortCode, "sortCode"); + this.sortCode = sortCode; + return this; + } + + public SourceAccountV2Prototype build() { + return new SourceAccountV2Prototype( + accountInfo, + accountName, + accountNumber, + accountType, + balance, + currency, + id, + modifiedDate, + routingInfo, + sortCode); + } + } +} + diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayload.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayload.java index 7d2f6f3d..8b0764d7 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayload.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayload.java @@ -38,19 +38,16 @@ public class SourceAccountWebhookPayload { @JsonProperty("referenceCompany") private Optional referenceCompany; - /** - * The target bank account in a supported accounting software for ingestion into a bank feed. - */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("sourceAccount") - private Optional sourceAccount; + private Optional sourceAccount; @JsonCreator public SourceAccountWebhookPayload( @JsonProperty("companyId") Optional companyId, @JsonProperty("connectionId") Optional connectionId, @JsonProperty("referenceCompany") Optional referenceCompany, - @JsonProperty("sourceAccount") Optional sourceAccount) { + @JsonProperty("sourceAccount") Optional sourceAccount) { Utils.checkNotNull(companyId, "companyId"); Utils.checkNotNull(connectionId, "connectionId"); Utils.checkNotNull(referenceCompany, "referenceCompany"); @@ -87,13 +84,10 @@ public Optional referenceCompany() { return (Optional) referenceCompany; } - /** - * The target bank account in a supported accounting software for ingestion into a bank feed. - */ @SuppressWarnings("unchecked") @JsonIgnore - public Optional sourceAccount() { - return (Optional) sourceAccount; + public Optional sourceAccount() { + return (Optional) sourceAccount; } public final static Builder builder() { @@ -148,19 +142,13 @@ public SourceAccountWebhookPayload withReferenceCompany(Optional sourceAccount) { + public SourceAccountWebhookPayload withSourceAccount(Optional sourceAccount) { Utils.checkNotNull(sourceAccount, "sourceAccount"); this.sourceAccount = sourceAccount; return this; @@ -208,7 +196,7 @@ public final static class Builder { private Optional referenceCompany = Optional.empty(); - private Optional sourceAccount = Optional.empty(); + private Optional sourceAccount = Optional.empty(); private Builder() { // force use of static builder() method @@ -262,19 +250,13 @@ public Builder referenceCompany(Optional referenceCo return this; } - /** - * The target bank account in a supported accounting software for ingestion into a bank feed. - */ - public Builder sourceAccount(SourceAccount sourceAccount) { + public Builder sourceAccount(SourceAccountWebhookPayloadSourceAccount sourceAccount) { Utils.checkNotNull(sourceAccount, "sourceAccount"); this.sourceAccount = Optional.ofNullable(sourceAccount); return this; } - /** - * The target bank account in a supported accounting software for ingestion into a bank feed. - */ - public Builder sourceAccount(Optional sourceAccount) { + public Builder sourceAccount(Optional sourceAccount) { Utils.checkNotNull(sourceAccount, "sourceAccount"); this.sourceAccount = sourceAccount; return this; diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayloadSourceAccount.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayloadSourceAccount.java new file mode 100644 index 00000000..d529ba5d --- /dev/null +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/components/SourceAccountWebhookPayloadSourceAccount.java @@ -0,0 +1,97 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.bank_feeds.models.components; + + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.codat.bank_feeds.utils.OneOfDeserializer; +import io.codat.bank_feeds.utils.TypedObject; +import io.codat.bank_feeds.utils.Utils.JsonShape; +import io.codat.bank_feeds.utils.Utils.TypeReferenceWithShape; +import io.codat.bank_feeds.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Objects; + + +@JsonDeserialize(using = SourceAccountWebhookPayloadSourceAccount._Deserializer.class) +public class SourceAccountWebhookPayloadSourceAccount { + + @JsonValue + private TypedObject value; + + private SourceAccountWebhookPayloadSourceAccount(TypedObject value) { + this.value = value; + } + + public static SourceAccountWebhookPayloadSourceAccount of(SourceAccountV2 value) { + Utils.checkNotNull(value, "value"); + return new SourceAccountWebhookPayloadSourceAccount(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + } + + public static SourceAccountWebhookPayloadSourceAccount of(SourceAccount value) { + Utils.checkNotNull(value, "value"); + return new SourceAccountWebhookPayloadSourceAccount(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + } + + /** + * Returns an instance of one of these types: + *
    + *
  • {@code io.codat.bank_feeds.models.components.SourceAccountV2}
  • + *
  • {@code io.codat.bank_feeds.models.components.SourceAccount}
  • + *
+ * + *

Use {@code instanceof} to determine what type is returned. For example: + * + *

+     * if (obj.value() instanceof String) {
+     *     String answer = (String) obj.value();
+     *     System.out.println("answer=" + answer);
+     * }
+     * 
+ * + * @return value of oneOf type + **/ + public java.lang.Object value() { + return value.value(); + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceAccountWebhookPayloadSourceAccount other = (SourceAccountWebhookPayloadSourceAccount) o; + return Objects.deepEquals(this.value.value(), other.value.value()); + } + + @Override + public int hashCode() { + return Objects.hash(value.value()); + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends OneOfDeserializer { + + public _Deserializer() { + super(SourceAccountWebhookPayloadSourceAccount.class, false, + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + } + } + + @Override + public String toString() { + return Utils.toString(SourceAccountWebhookPayloadSourceAccount.class, + "value", value); + } + +} diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/CreateSourceAccountRequestBody.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/CreateSourceAccountRequestBody.java index 20469b48..f59a0f5a 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/CreateSourceAccountRequestBody.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/CreateSourceAccountRequestBody.java @@ -8,8 +8,8 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import io.codat.bank_feeds.models.components.SourceAccount; -import io.codat.bank_feeds.models.components.SourceAccountV2; +import io.codat.bank_feeds.models.components.SourceAccountPrototype; +import io.codat.bank_feeds.models.components.SourceAccountV2Prototype; import io.codat.bank_feeds.utils.OneOfDeserializer; import io.codat.bank_feeds.utils.TypedObject; import io.codat.bank_feeds.utils.Utils.JsonShape; @@ -31,21 +31,21 @@ private CreateSourceAccountRequestBody(TypedObject value) { this.value = value; } - public static CreateSourceAccountRequestBody of(SourceAccountV2 value) { + public static CreateSourceAccountRequestBody of(SourceAccountV2Prototype value) { Utils.checkNotNull(value, "value"); - return new CreateSourceAccountRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateSourceAccountRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static CreateSourceAccountRequestBody of(SourceAccount value) { + public static CreateSourceAccountRequestBody of(SourceAccountPrototype value) { Utils.checkNotNull(value, "value"); - return new CreateSourceAccountRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateSourceAccountRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } /** * Returns an instance of one of these types: *
    - *
  • {@code io.codat.bank_feeds.models.components.SourceAccountV2}
  • - *
  • {@code io.codat.bank_feeds.models.components.SourceAccount}
  • + *
  • {@code io.codat.bank_feeds.models.components.SourceAccountV2Prototype}
  • + *
  • {@code io.codat.bank_feeds.models.components.SourceAccountPrototype}
  • *
* *

Use {@code instanceof} to determine what type is returned. For example: @@ -85,8 +85,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/ListCompaniesRequest.java b/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/ListCompaniesRequest.java index ffd6723c..30a49ac4 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/ListCompaniesRequest.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/models/operations/ListCompaniesRequest.java @@ -44,24 +44,33 @@ public class ListCompaniesRequest { @SpeakeasyMetadata("queryParam:style=form,explode=true,name=query") private Optional query; + /** + * Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=tags") + private Optional tags; + @JsonCreator public ListCompaniesRequest( Optional orderBy, Optional page, Optional pageSize, - Optional query) { + Optional query, + Optional tags) { Utils.checkNotNull(orderBy, "orderBy"); Utils.checkNotNull(page, "page"); Utils.checkNotNull(pageSize, "pageSize"); Utils.checkNotNull(query, "query"); + Utils.checkNotNull(tags, "tags"); this.orderBy = orderBy; this.page = page; this.pageSize = pageSize; this.query = query; + this.tags = tags; } public ListCompaniesRequest() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -96,6 +105,14 @@ public Optional query() { return query; } + /** + * Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). + */ + @JsonIgnore + public Optional tags() { + return tags; + } + public final static Builder builder() { return new Builder(); } @@ -171,6 +188,24 @@ public ListCompaniesRequest withQuery(Optional query) { this.query = query; return this; } + + /** + * Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). + */ + public ListCompaniesRequest withTags(String tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + * Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). + */ + public ListCompaniesRequest withTags(Optional tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = tags; + return this; + } @Override public boolean equals(java.lang.Object o) { @@ -185,7 +220,8 @@ public boolean equals(java.lang.Object o) { Objects.deepEquals(this.orderBy, other.orderBy) && Objects.deepEquals(this.page, other.page) && Objects.deepEquals(this.pageSize, other.pageSize) && - Objects.deepEquals(this.query, other.query); + Objects.deepEquals(this.query, other.query) && + Objects.deepEquals(this.tags, other.tags); } @Override @@ -194,7 +230,8 @@ public int hashCode() { orderBy, page, pageSize, - query); + query, + tags); } @Override @@ -203,7 +240,8 @@ public String toString() { "orderBy", orderBy, "page", page, "pageSize", pageSize, - "query", query); + "query", query, + "tags", tags); } public final static class Builder { @@ -214,7 +252,9 @@ public final static class Builder { private Optional pageSize; - private Optional query = Optional.empty(); + private Optional query = Optional.empty(); + + private Optional tags = Optional.empty(); private Builder() { // force use of static builder() method @@ -291,6 +331,24 @@ public Builder query(Optional query) { this.query = query; return this; } + + /** + * Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). + */ + public Builder tags(String tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + * Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). + */ + public Builder tags(Optional tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = tags; + return this; + } public ListCompaniesRequest build() { if (page == null) { @@ -302,7 +360,8 @@ public ListCompaniesRequest build() { orderBy, page, pageSize, - query); + query, + tags); } private static final LazySingletonValue> _SINGLETON_VALUE_Page = diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Security.java b/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Security.java index 66da5493..48000fbd 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Security.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Security.java @@ -6,7 +6,11 @@ import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; +import java.util.Arrays; import java.util.Base64; +import java.util.Optional; +import java.util.regex.Pattern; +import java.util.stream.Stream; public final class Security { @@ -125,7 +129,7 @@ private static void parseSecuritySchemeValue(HTTPRequest request, SecurityMetada case "oauth2": if (!"client_credentials".equals(schemeMetadata.subtype)) { request.addHeader(securityMetadata.name, Utils.prefixBearer(Utils.valToString(value))); - } + } break; case "http": switch (schemeMetadata.subtype) { @@ -179,4 +183,60 @@ private static void parseBasicAuthScheme(HTTPRequest requestBuilder, Object sche .encodeToString(String.format("%s:%s", username, password) .getBytes(StandardCharsets.UTF_8))); } + + public static Stream findFieldsWhereMetadataContainsRegexes(Object o, String... regexes) { + Field[] fields = o.getClass().getDeclaredFields(); + return Arrays.stream(fields) // + .filter(f -> { + SpeakeasyMetadata[] anns = f.getDeclaredAnnotationsByType(SpeakeasyMetadata.class); + if (anns == null) { + return false; + } + return Arrays // + .stream(regexes) // + .allMatch(regex -> matches(anns, regex)); + }); + } + + public static Optional findStringValueWhereMetadataContainsRegexes(Object o, String... regexes) { + return findValueWhereMetadataContainsRegexes(o, regexes).map(x -> (String) x); + } + + public static Optional findStringValueWhereMetadataNameIs(Object o, String name) { + return Security.findStringValueWhereMetadataContainsRegexes(o, "\\bname=" + name + "\\b"); + } + + public static Optional findValueWhereMetadataContainsRegexes(Object o, String... regexes) { + return findFieldsWhereMetadataContainsRegexes(o, regexes) + .flatMap(f -> { + f.setAccessible(true); + Object result; + try { + result = f.get(o); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + if (result instanceof Optional) { + @SuppressWarnings("unchecked") + Optional r = (Optional) result; + if (r.isEmpty()) { + return Stream.empty(); + } else { + return Stream.of(r.get()); + } + } else { + return Stream.of(result); + } + }).findAny(); + } + + private static boolean matches(SpeakeasyMetadata[] anns, String regex) { + Pattern pattern = Pattern.compile(regex); + for (SpeakeasyMetadata ann : anns) { + if (pattern.matcher(ann.value()).find()) { + return true; + } + } + return false; + } } \ No newline at end of file diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/utils/SessionManager.java b/bank-feeds/src/main/java/io/codat/bank_feeds/utils/SessionManager.java new file mode 100644 index 00000000..50adfc63 --- /dev/null +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/utils/SessionManager.java @@ -0,0 +1,178 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.bank_feeds.utils; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +import io.codat.bank_feeds.models.errors.AuthException; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public final class SessionManager { + + // VisibleForTesting + public static final int REFRESH_BEFORE_EXPIRY_SECONDS = 60; + + private final Map> sessions = new HashMap<>(); + + public interface HasSessionKey { + String sessionKey(); + } + + public final static class Session { + private final T credentials; + private final Optional token; + private final List scopes; + private final Optional expiresAt; + + public Session(T credentials, Optional token, List scopes, Optional expiresAt) { + this.credentials = credentials; + this.token = token; + this.scopes = scopes; + this.expiresAt = expiresAt; + } + + public T credentials() { + return credentials; + } + + public Optional token() { + return token; + } + + public List scopes() { + return scopes; + } + + public Optional expiresAt() { + return expiresAt; + } + + } + + public Session getSession(T credentials, Optional> scopes, Function, Session> tokenProvider ) { + final String sessionKey = credentials.sessionKey(); + + Optional> currentSession = Optional.ofNullable(sessions.get(sessionKey)); + final Session session; + if (shouldCreateNewSession(currentSession, scopes)) { + // note that we accumulate scopes. For example if a session existed + // for scope 'read' and this request requires scope 'write' then we + // request a new token for `read, write`. + + // TODO it may be better to rather make `sessions` a Map> + // where the none of the Session scope lists fully contains another in the same + // map value. + // This would ensure that an operation is always called with a token with the + // minimum + // permissions required and also would ensure that a token request is not + // rejected + // because of disallowed scope combinations (yet to see that in the wild). + // For the example above with `read` and `write` scoped requests we would get a + // token + // for `read` scope, and then get a token for `write` scope and store both + // tokens in separate + // Session objects in the map value list for the credential pair. + + List accumulatedScopes = accumulateScopes(scopes, currentSession); + session = tokenProvider.apply(accumulatedScopes); + sessions.put(sessionKey, session); + } else { + session = currentSession.get(); + } + return session; + } + + // VisibleForTesting + public static boolean shouldCreateNewSession(Optional> currentSession, Optional> oauthScopes) { + return !currentSession.isPresent() // + || !hasRequiredScopes(currentSession.get().scopes, oauthScopes) // + || hasTokenExpired(currentSession.get().expiresAt, OffsetDateTime.now()); + } + + + private static < T extends HasSessionKey> List accumulateScopes(Optional> requiredScopes, Optional> session) { + if (session.isPresent()) { + List scopes = new ArrayList<>(requiredScopes.orElse(Collections.emptyList())); + scopes.addAll(session.get().scopes); + return scopes.stream() // + .distinct() // + .collect(Collectors.toList()); + } else { + return requiredScopes.orElse(Collections.emptyList()); + } + } + + // VisibleForTesting + public static boolean hasTokenExpired(Optional expiresAt, OffsetDateTime now) { + return expiresAt.isEmpty() // + || now.plusSeconds(REFRESH_BEFORE_EXPIRY_SECONDS).isAfter(expiresAt.get()); + } + + // VisibleForTesting + public static boolean hasRequiredScopes(List sessionScopes, Optional> requiredScopes) { + return sessionScopes.containsAll(requiredScopes.orElse(Collections.emptyList())); + } + + public void remove(String sessionKey) { + sessions.remove(sessionKey); + } + + public static Session requestOAuth2Token(HTTPClient client, T credentials, List scopes, + Map payload, URI tokenUri) { + try { + HttpRequest request = HttpRequest // + .newBuilder(tokenUri) // + .header("Content-Type", "application/x-www-form-urlencoded") // + .POST(RequestBody.serializeFormData(payload).body()) // + .build(); + HttpResponse response = client.send(request); + if (response.statusCode() != HttpURLConnection.HTTP_OK) { + String responseBody = Utils.toUtf8AndClose(response.body()); + throw new AuthException(response.statusCode(), + "Unexpected status code " + response.statusCode() + ": " + responseBody); + } + TokenResponse t = Utils.mapper().readValue(response.body(), TokenResponse.class); + if (!t.tokenType.orElse("").equals("Bearer")) { + throw new AuthException("Expected 'Bearer' token type but was '" + t.tokenType.orElse("") + "'"); + } + final Optional expiresAt = t.expiresInMs + .map(x -> OffsetDateTime.now().plus(x, ChronoUnit.MILLIS)); + return new Session(credentials, t.accessToken, scopes, expiresAt); + } catch (IOException | IllegalArgumentException | IllegalAccessException | InterruptedException | URISyntaxException e) { + throw new RuntimeException(e); + } + } + + final static class TokenResponse { + + @JsonProperty("access_token") + Optional accessToken; + + @JsonProperty("token_type") + Optional tokenType; + + @JsonProperty("expires_in") + Optional expiresInMs; + + } + +} diff --git a/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Utils.java b/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Utils.java index a2553537..45d7d379 100644 --- a/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Utils.java +++ b/bank-feeds/src/main/java/io/codat/bank_feeds/utils/Utils.java @@ -15,7 +15,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; -import java.net.URLEncoder; import java.net.http.HttpClient.Version; import java.net.http.HttpHeaders; import java.net.http.HttpRequest; @@ -24,6 +23,8 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.ArrayList; @@ -38,7 +39,6 @@ import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Optional; -import java.util.UUID; import java.util.concurrent.Callable; import java.util.function.BiPredicate; import java.util.regex.Matcher; @@ -50,7 +50,6 @@ import javax.net.ssl.SSLSession; import org.apache.commons.io.IOUtils; -import org.apache.http.NameValuePair; import org.openapitools.jackson.nullable.JsonNullable; import com.fasterxml.jackson.core.JsonProcessingException; @@ -1192,4 +1191,15 @@ public static void setSseSentinel(Object o, String value) { } } + public static String sessionKey(String... items) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + String input = Arrays.stream(items).collect(Collectors.joining(":")); + byte[] bytes = md.digest(input.getBytes(StandardCharsets.UTF_8)); + return Utils.bytesToLowerCaseHex(bytes); + } catch (NoSuchAlgorithmException e) { + // not expected, MD5 always available + throw new RuntimeException(e); + } + } }