From 17e84ff220563702351232a9e9172ea831c59b95 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Wed, 27 Nov 2024 10:13:31 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.448.0 --- .speakeasy/workflow.lock | 33 +- .speakeasy/workflow.yaml | 18 +- sync-for-payables/.speakeasy/gen.lock | 55 ++- sync-for-payables/.speakeasy/gen.yaml | 4 +- sync-for-payables/README.md | 65 +-- sync-for-payables/RELEASES.md | 12 +- sync-for-payables/build.gradle | 7 +- .../docs/models/components/Company.md | 2 + .../models/components/CompanyReference.md | 12 + .../components/CompanyReferenceLinks.md | 10 + .../docs/sdks/codatsyncpayables/README.md | 4 +- .../docs/sdks/companies/README.md | 2 +- .../docs/sdks/connections/README.md | 2 +- .../io/codat/sync/payables/Companies.java | 6 +- .../io/codat/sync/payables/Connections.java | 6 +- .../codat/sync/payables/SDKConfiguration.java | 4 +- .../payables/models/components/Company.java | 106 ++++- .../models/components/CompanyReference.java | 371 ++++++++++++++++++ .../components/CompanyReferenceLinks.java | 130 ++++++ .../sync/payables/utils/HTTPRequest.java | 68 +++- .../payables/utils/PathParamsMetadata.java | 4 +- .../sync/payables/utils/QueryParameter.java | 62 +++ .../sync/payables/utils/QueryParameters.java | 59 ++- .../payables/utils/QueryParamsMetadata.java | 4 +- .../codat/sync/payables/utils/Security.java | 2 +- .../sync/payables/utils/Utf8UrlEncoder.java | 117 ++++++ .../io/codat/sync/payables/utils/Utils.java | 67 ++-- 27 files changed, 1041 insertions(+), 191 deletions(-) create mode 100644 sync-for-payables/docs/models/components/CompanyReference.md create mode 100644 sync-for-payables/docs/models/components/CompanyReferenceLinks.md create mode 100644 sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReference.java create mode 100644 sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReferenceLinks.java create mode 100644 sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameter.java create mode 100644 sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utf8UrlEncoder.java diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d5d1fab7..5d478797 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.447.0 +speakeasyVersion: 1.448.0 sources: accounting-source: sourceNamespace: accounting-source @@ -55,11 +55,12 @@ sources: - prealpha sync-for-payables-source: sourceNamespace: sync-for-payables-source - sourceRevisionDigest: sha256:b7ab686758f0afcdfdea71a46fe64a0cc9e8e4ce32af1314372c9134dbb13ad6 - sourceBlobDigest: sha256:f472244dc98845d90f55da060a2cc4acee05c771a89a0ff55bc5db04108e5693 + sourceRevisionDigest: sha256:2b3e38c90e4baf9c46b6c00ffd9dd90eef071a47c830a6bbd70a5c42dd8540ec + sourceBlobDigest: sha256:57b656eed2c5a98f97da8f59e196bb8052ead3cc7c87673cdf5e19c6badbb570 tags: - latest - - main + - speakeasy-sdk-regen-1732702366 + - 3.0.0 sync-for-payroll-source: sourceNamespace: sync-for-payroll-source sourceRevisionDigest: sha256:9a6cc9d1da201eabac09e3f13d97e740b849b852f5f83b828ff41f58ad9849b3 @@ -116,8 +117,10 @@ targets: sync-for-payables-library: source: sync-for-payables-source sourceNamespace: sync-for-payables-source - sourceRevisionDigest: sha256:b7ab686758f0afcdfdea71a46fe64a0cc9e8e4ce32af1314372c9134dbb13ad6 - sourceBlobDigest: sha256:f472244dc98845d90f55da060a2cc4acee05c771a89a0ff55bc5db04108e5693 + sourceRevisionDigest: sha256:2b3e38c90e4baf9c46b6c00ffd9dd90eef071a47c830a6bbd70a5c42dd8540ec + sourceBlobDigest: sha256:57b656eed2c5a98f97da8f59e196bb8052ead3cc7c87673cdf5e19c6badbb570 + codeSamplesNamespace: sync-for-payables-source-java-code-samples + codeSamplesRevisionDigest: sha256:798680652aa6d4e60eecd57638e44f1f91ee6c96178b3b599ecdae1573353667 sync-for-payroll-library: source: sync-for-payroll-source sourceNamespace: sync-for-payroll-source @@ -185,7 +188,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/accounting-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/accounting-source-java-code-samples blocking: false bank-feeds-library: target: java @@ -199,7 +202,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/bank-feeds-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/bank-feeds-source-java-code-samples blocking: false banking-library: target: java @@ -213,7 +216,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/banking-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/banking-source-java-code-samples blocking: false lending-library: target: java @@ -227,7 +230,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/lending-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/lending-source-java-code-samples blocking: false platform-library: target: java @@ -241,7 +244,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/platform-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/platform-source-java-code-samples blocking: false sync-for-commerce-library: target: java @@ -255,7 +258,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-commerce-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-commerce-source-java-code-samples blocking: false sync-for-expenses-library: target: java @@ -269,7 +272,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-expenses-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-expenses-source-java-code-samples blocking: false sync-for-payables-library: target: java @@ -283,7 +286,7 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-payables-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-payables-source-java-code-samples blocking: false sync-for-payroll-library: target: java @@ -297,5 +300,5 @@ workflow: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-payroll-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-payroll-source-java-code-samples blocking: false diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 57890041..5b6aea1d 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -59,7 +59,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/accounting-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/accounting-source-java-code-samples blocking: false bank-feeds-library: target: java @@ -73,7 +73,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/bank-feeds-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/bank-feeds-source-java-code-samples blocking: false banking-library: target: java @@ -87,7 +87,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/banking-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/banking-source-java-code-samples blocking: false lending-library: target: java @@ -101,7 +101,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/lending-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/lending-source-java-code-samples blocking: false platform-library: target: java @@ -115,7 +115,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/platform-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/platform-source-java-code-samples blocking: false sync-for-commerce-library: target: java @@ -129,7 +129,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-commerce-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-commerce-source-java-code-samples blocking: false sync-for-expenses-library: target: java @@ -143,7 +143,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-expenses-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-expenses-source-java-code-samples blocking: false sync-for-payables-library: target: java @@ -157,7 +157,7 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-payables-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-payables-source-java-code-samples blocking: false sync-for-payroll-library: target: java @@ -171,5 +171,5 @@ targets: gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: - location: registry.speakeasyapi.dev/codat/codat/sync-for-payroll-source-code-samples + location: registry.speakeasyapi.dev/codat/codat/sync-for-payroll-source-java-code-samples blocking: false diff --git a/sync-for-payables/.speakeasy/gen.lock b/sync-for-payables/.speakeasy/gen.lock index 86319812..362f19a9 100755 --- a/sync-for-payables/.speakeasy/gen.lock +++ b/sync-for-payables/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 18757ebf-96ad-433f-80e1-10950345f2fe management: - docChecksum: c0f4a56a46c488781ea9be7def894f8c + docChecksum: 05c2a60eb0f4b40cda5e4a92d94e7b93 docVersion: 3.0.0 - speakeasyVersion: 1.423.5 - generationVersion: 2.445.1 - releaseVersion: 4.0.0 - configChecksum: 0d7af15455983e0b6530d6cf34cf6862 + speakeasyVersion: 1.448.0 + generationVersion: 2.466.0 + releaseVersion: 4.1.0 + configChecksum: 0dbf7f959ac283270d1cc400973e6ed0 repoURL: https://github.com/codatio/client-sdk-java.git repoSubDirectory: sync-for-payables published: true @@ -14,7 +14,7 @@ features: java: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.1 - core: 3.30.6 + core: 3.32.2 decimal: 0.0.1 deprecations: 2.81.1 downloadStreams: 0.1.1 @@ -27,7 +27,7 @@ features: nullables: 0.1.0 retries: 0.1.1 sdkHooks: 0.1.0 - tests: 0.1.0 + serverEventsSentinels: 0.2.0 webhooks: 1.0.0 generatedFiles: - .gitattributes @@ -66,6 +66,8 @@ generatedFiles: - docs/models/components/Companies.md - docs/models/components/Company.md - docs/models/components/CompanyInformation.md + - docs/models/components/CompanyReference.md + - docs/models/components/CompanyReferenceLinks.md - docs/models/components/CompanyRequestBody.md - docs/models/components/Connection.md - docs/models/components/Connections.md @@ -192,6 +194,8 @@ generatedFiles: - src/main/java/io/codat/sync/payables/models/components/Companies.java - src/main/java/io/codat/sync/payables/models/components/Company.java - src/main/java/io/codat/sync/payables/models/components/CompanyInformation.java + - src/main/java/io/codat/sync/payables/models/components/CompanyReference.java + - src/main/java/io/codat/sync/payables/models/components/CompanyReferenceLinks.java - src/main/java/io/codat/sync/payables/models/components/CompanyRequestBody.java - src/main/java/io/codat/sync/payables/models/components/Connection.java - src/main/java/io/codat/sync/payables/models/components/Connections.java @@ -310,6 +314,7 @@ generatedFiles: - src/main/java/io/codat/sync/payables/utils/OneOfDeserializer.java - src/main/java/io/codat/sync/payables/utils/Options.java - src/main/java/io/codat/sync/payables/utils/PathParamsMetadata.java + - src/main/java/io/codat/sync/payables/utils/QueryParameter.java - src/main/java/io/codat/sync/payables/utils/QueryParameters.java - src/main/java/io/codat/sync/payables/utils/QueryParamsMetadata.java - src/main/java/io/codat/sync/payables/utils/RequestBody.java @@ -324,6 +329,7 @@ generatedFiles: - src/main/java/io/codat/sync/payables/utils/SpeakeasyMetadata.java - src/main/java/io/codat/sync/payables/utils/TypedObject.java - src/main/java/io/codat/sync/payables/utils/Types.java + - src/main/java/io/codat/sync/payables/utils/Utf8UrlEncoder.java - src/main/java/io/codat/sync/payables/utils/Utils.java examples: create-company: @@ -332,14 +338,14 @@ examples: application/json: {"description": "Requested early access to the new financing scheme.", "name": "Technicalium"} responses: "200": - application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "referenceSubsidiaryCompanies": []} "400": {} With a description: requestBody: application/json: {"description": "Technology services, including web and app design and development", "name": "Technicalium"} responses: "200": - application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "Technology services, including web and app design and development", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "Technology services, including web and app design and development", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "referenceSubsidiaryCompanies": []} "400": {} With a group: requestBody: @@ -359,7 +365,7 @@ examples: application/json: {"description": "Requested early access to the new financing scheme.", "name": "Bank of Dave"} responses: "200": - application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "tags": {"region": "us"}} + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "referenceSubsidiaryCompanies": [], "tags": {"region": "us"}} delete-company: Unauthorized: parameters: @@ -375,7 +381,7 @@ examples: companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" responses: "200": - application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "My First Company", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Toft stores holdings", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "referenceSubsidiaryCompanies": []} With groups: parameters: path: @@ -390,6 +396,20 @@ examples: responses: "401": application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + Parent multi-entity company: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "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"}]} + Subsidiary multi-entity company: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"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"}], "description": "", "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": []} list-companies: "": parameters: @@ -411,7 +431,7 @@ examples: orderBy: "-modifiedDate" 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", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00: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"}], "totalResults": 1} + 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} List of Companies: parameters: query: @@ -421,7 +441,7 @@ examples: orderBy: "-modifiedDate" 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", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00: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"}, {"created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}], "id": "a70bc148-dc21-46b2-a257-d9c58ac15cbb", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/096db70b-78de-4ff0-aa98-299cb5fe17a0/connections/a70bc148-dc21-46b2-a257-d9c58ac15cbb/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "A new digital agency with a passion for creating amazing digital experiences", "id": "096db70b-78de-4ff0-aa98-299cb5fe17a0", "lastSync": "2022-01-01T12:30:00.000Z", "name": "Godata", "redirect": "https://link.codat.io/company/096db70b-78de-4ff0-aa98-299cb5fe17a0"}], "totalResults": 2} + 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} Malformed query: parameters: query: @@ -451,7 +471,7 @@ examples: application/json: {"description": "Requested early access to the new financing scheme.", "name": "New Name"} responses: "200": - application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}], "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", "tags": {"region": "us", "uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"}} + application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "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", "tags": {"region": "us", "uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"}} "401": {} Update description: parameters: @@ -461,7 +481,7 @@ examples: application/json: {"description": "Additional documents required", "name": "Same name"} responses: "200": - application/json: {"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", "tags": {"region": "us", "uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"}} + application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "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", "tags": {"region": "us", "uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"}} "401": {} Unauthorized: parameters: @@ -542,7 +562,7 @@ examples: orderBy: "-modifiedDate" responses: "200": - application/json: {"_links": {"current": {"href": "string"}, "next": {"href": "string"}, "previous": {"href": "string"}, "self": {"href": "string"}}, "pageNumber": 0, "pageSize": 0, "results": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}], "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"}], "totalResults": 0} + application/json: {"_links": {"current": {"href": "string"}, "next": {"href": "string"}, "previous": {"href": "string"}, "self": {"href": "string"}}, "pageNumber": 0, "pageSize": 0, "results": [{"created": "2022-10-27T09:53:29Z", "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"}], "totalResults": 0} Malformed query: parameters: path: @@ -1026,7 +1046,7 @@ examples: continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" responses: "200": - application/json: {"pagination": {"continuationToken": "eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ=="}, "results": [{"addresses": [{"city": "Bakersfield", "country": "USA", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "region": "California", "type": "Billing"}], "balance": 100, "contactName": "Martin Dale", "defaultCurrency": "GBP", "emailAddress": "martyd@citylim.co", "id": "c523e12f-8b74-4d3a-bbd8-32d7a2f598b4", "phone": "07999 999999", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "supplierName": "City Limousines"}, {"addresses": [{"country": "Djibouti", "line1": "test", "region": "string", "type": "Billing"}], "contactName": "AI Support", "defaultCurrency": "GBP", "id": "41", "phone": "01224 658 999", "sourceModifiedDate": "2022-12-07T10:48:18Z", "status": "Active", "supplierName": "AI Support"}]} + application/json: {"pagination": {"continuationToken": "eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ=="}, "results": [{"addresses": [{"city": "Bakersfield", "country": "USA", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "region": "California", "type": "Billing"}], "balance": 100, "contactName": "Martin Dale", "defaultCurrency": "GBP", "emailAddress": "martyd@citylim.co", "id": "c523e12f-8b74-4d3a-bbd8-32d7a2f598b4", "phone": "07999 999999", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "supplierName": "City Limousines"}, {"addresses": [{"country": "Djibouti", "line1": "test", "region": "string", "type": "Billing"}], "contactName": "AI Support", "defaultCurrency": "GBP", "id": "41", "sourceModifiedDate": "2022-12-07T10:48:18Z", "status": "Active", "supplierName": "AI Support"}]} Malformed query: parameters: path: @@ -1047,3 +1067,4 @@ examples: 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} +generatedTests: {} diff --git a/sync-for-payables/.speakeasy/gen.yaml b/sync-for-payables/.speakeasy/gen.yaml index 8ceb23d0..7f3d70e1 100644 --- a/sync-for-payables/.speakeasy/gen.yaml +++ b/sync-for-payables/.speakeasy/gen.yaml @@ -9,9 +9,10 @@ generation: requestResponseComponentNamesFeb2024: false auth: oAuth2ClientCredentialsEnabled: false + oAuth2PasswordEnabled: false telemetryEnabled: true java: - version: 4.0.0 + version: 4.1.0 additionalDependencies: [] additionalPlugins: [] artifactID: sync.payables @@ -20,6 +21,7 @@ java: companyEmail: support@codat.io companyName: Codat companyURL: https://www.codat.io/ + defaultErrorName: SDKError description: Streamline your customers' accounts payable workflow. flattenGlobalSecurity: true githubURL: github.com/codatio/client-sdk-java/sync.payables diff --git a/sync-for-payables/README.md b/sync-for-payables/README.md index dccacf28..49a5265a 100644 --- a/sync-for-payables/README.md +++ b/sync-for-payables/README.md @@ -62,7 +62,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'io.codat:sync.payables:4.0.0' +implementation 'io.codat:sync.payables:4.1.0' ``` Maven: @@ -70,7 +70,7 @@ Maven: io.codat sync.payables - 4.0.0 + 4.1.0 ``` @@ -289,10 +289,10 @@ Handling errors in this SDK should largely match your expectations. All operatio By default, an API error will throw a `models/errors/SDKError` exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `create` method throws the following exceptions: -| Error Type | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| models/errors/ErrorMessage | 400, 401, 402, 403, 429, 500, 503 | application/json | -| models/errors/SDKError | 4XX, 5XX | \*/\* | +| Error Type | Status Code | Content Type | +| -------------------------- | --------------------------------- | ---------------- | +| models/errors/ErrorMessage | 400, 401, 402, 403, 429, 500, 503 | application/json | +| models/errors/SDKError | 4XX, 5XX | \*/\* | ### Example @@ -333,54 +333,9 @@ public class Application { ## Server Selection -### Select Server by Index - -You can override the default server globally by passing a server index to the `serverIndex` builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: - -| # | Server | Variables | -| - | ------ | --------- | -| 0 | `https://api.codat.io` | None | - -#### Example - -```java -package hello.world; - -import io.codat.sync.payables.CodatSyncPayables; -import io.codat.sync.payables.models.components.CompanyRequestBody; -import io.codat.sync.payables.models.errors.ErrorMessage; -import io.codat.sync.payables.models.operations.CreateCompanyResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws ErrorMessage, Exception { - - CodatSyncPayables sdk = CodatSyncPayables.builder() - .serverIndex(0) - .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.") - .build(); - - CreateCompanyResponse res = sdk.companies().create() - .request(req) - .call(); - - if (res.company().isPresent()) { - // handle response - } - } -} -``` - - ### Override Server URL Per-Client -The default server can also be overridden globally by passing a URL to the `serverURL` builder method when initializing the SDK client instance. For example: +The default server can also be overridden globally using the `.serverURL(String serverUrl)` builder method when initializing the SDK client instance. For example: ```java package hello.world; @@ -423,9 +378,9 @@ public class Application { This SDK supports the following security scheme globally: -| Name | Type | Scheme | -| ------------ | ------------ | ------------ | -| `authHeader` | apiKey | API key | +| Name | Type | Scheme | +| ------------ | ------ | ------- | +| `authHeader` | apiKey | API key | To authenticate with the API the `authHeader` parameter must be set when initializing the SDK client instance. For example: ```java diff --git a/sync-for-payables/RELEASES.md b/sync-for-payables/RELEASES.md index 1436f093..c0252285 100644 --- a/sync-for-payables/RELEASES.md +++ b/sync-for-payables/RELEASES.md @@ -78,4 +78,14 @@ Based on: ### Generated - [java v4.0.0] sync-for-payables ### Releases -- [Maven Central v4.0.0] https://central.sonatype.com/artifact/io.codat.sync/payables/4.0.0 - sync-for-payables \ No newline at end of file +- [Maven Central v4.0.0] https://central.sonatype.com/artifact/io.codat.sync/payables/4.0.0 - sync-for-payables + +## 2024-11-27 10:12:38 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.448.0 (2.466.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v4.1.0] sync-for-payables +### Releases +- [Maven Central v4.1.0] https://central.sonatype.com/artifact/io.codat.sync/payables/4.1.0 - sync-for-payables \ No newline at end of file diff --git a/sync-for-payables/build.gradle b/sync-for-payables/build.gradle index a823bce8..836fd8cb 100644 --- a/sync-for-payables/build.gradle +++ b/sync-for-payables/build.gradle @@ -63,7 +63,7 @@ tasks.withType(Javadoc) { } group = "io.codat" -version = "4.0.0" +version = "4.1.0" sourcesJar { archiveBaseName = "sync.payables" @@ -101,7 +101,7 @@ publishing { maven(MavenPublication) { groupId = 'io.codat' artifactId = 'sync.payables' - version = '4.0.0' + version = '4.1.0' from components.java @@ -145,10 +145,11 @@ if (!project.hasProperty('skip.signing')) { } dependencies { + api 'com.fasterxml.jackson.core:jackson-annotations:2.17.2' implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' - implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + api('org.openapitools:jackson-databind-nullable:0.2.6') {exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'} implementation 'org.apache.httpcomponents:httpclient:4.5.14' implementation 'org.apache.httpcomponents:httpmime:4.5.14' implementation 'commons-io:commons-io:2.15.1' diff --git a/sync-for-payables/docs/models/components/Company.md b/sync-for-payables/docs/models/components/Company.md index 131d3329..aff360bc 100644 --- a/sync-for-payables/docs/models/components/Company.md +++ b/sync-for-payables/docs/models/components/Company.md @@ -20,4 +20,6 @@ When you create a company, you can specify a `name` and we will automatically ge | `name` | *String* | :heavy_check_mark: | The name of the company | Codat Ltd. | | `products` | List\<*String*> | :heavy_minus_sign: | An array of products that are currently enabled for the company. | | | `redirect` | *String* | :heavy_check_mark: | The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. | https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739 | +| `referenceParentCompany` | [Optional\](../../models/components/CompanyReference.md) | :heavy_minus_sign: | N/A | | +| `referenceSubsidiaryCompanies` | List\<[CompanyReference](../../models/components/CompanyReference.md)> | :heavy_minus_sign: | A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. | | | `tags` | Map\ | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/components/CompanyReference.md b/sync-for-payables/docs/models/components/CompanyReference.md new file mode 100644 index 00000000..36df806e --- /dev/null +++ b/sync-for-payables/docs/models/components/CompanyReference.md @@ -0,0 +1,12 @@ +# CompanyReference + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `description` | *Optional\* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | +| `id` | *Optional\* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `links` | [Optional\](../../models/components/CompanyReferenceLinks.md) | :heavy_minus_sign: | A collection of links for the company. | | +| `name` | *Optional\* | :heavy_minus_sign: | The name of the company | Codat Ltd. | +| `tags` | Map\ | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/components/CompanyReferenceLinks.md b/sync-for-payables/docs/models/components/CompanyReferenceLinks.md new file mode 100644 index 00000000..cf075bb9 --- /dev/null +++ b/sync-for-payables/docs/models/components/CompanyReferenceLinks.md @@ -0,0 +1,10 @@ +# CompanyReferenceLinks + +A collection of links for the company. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | +| `portal` | *Optional\* | :heavy_minus_sign: | Link to the company page in the portal. | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/codatsyncpayables/README.md b/sync-for-payables/docs/sdks/codatsyncpayables/README.md index bded9360..48d6c755 100644 --- a/sync-for-payables/docs/sdks/codatsyncpayables/README.md +++ b/sync-for-payables/docs/sdks/codatsyncpayables/README.md @@ -31,4 +31,6 @@ The bill pay kit is an API and a set of supporting tools designed to integrate a | Bill payments | Get, create, and update Bill payments. | | Suppliers | Get, create, and update Suppliers. | | Bank accounts | Create a bank account for a given company's connection. | - \ No newline at end of file + + +### Available Operations diff --git a/sync-for-payables/docs/sdks/companies/README.md b/sync-for-payables/docs/sdks/companies/README.md index c6b4d208..3018de50 100644 --- a/sync-for-payables/docs/sdks/companies/README.md +++ b/sync-for-payables/docs/sdks/companies/README.md @@ -192,7 +192,7 @@ public class Application { ## list -The *List companies* endpoint returns a list of [companies] associated to your instances. +The *List companies* endpoint returns a list of [companies](https://docs.codat.io/sync-for-payables-api#/schemas/Company) associated to your instances. A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-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. diff --git a/sync-for-payables/docs/sdks/connections/README.md b/sync-for-payables/docs/sdks/connections/README.md index 3306beb8..bbdd7bf9 100644 --- a/sync-for-payables/docs/sdks/connections/README.md +++ b/sync-for-payables/docs/sdks/connections/README.md @@ -17,7 +17,7 @@ Create new and manage existing data connections for a company. Creates a connection for the company by providing a valid `platformKey`. -Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. +Use the [List Integrations](https://docs.codat.io/platform-api#/operations/list-integrations) endpoint to access valid platform keys. ### Example Usage diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/Companies.java b/sync-for-payables/src/main/java/io/codat/sync/payables/Companies.java index 3bec335a..8567361a 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/Companies.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/Companies.java @@ -609,7 +609,7 @@ public GetCompanyResponse get( /** * List companies - * The *List companies* endpoint returns a list of [companies] associated to your instances. + * The *List companies* endpoint returns a list of [companies](https://docs.codat.io/sync-for-payables-api#/schemas/Company) associated to your instances. * * A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. * Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-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. @@ -621,7 +621,7 @@ public ListCompaniesRequestBuilder list() { /** * List companies - * The *List companies* endpoint returns a list of [companies] associated to your instances. + * The *List companies* endpoint returns a list of [companies](https://docs.codat.io/sync-for-payables-api#/schemas/Company) associated to your instances. * * A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. * Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-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. @@ -636,7 +636,7 @@ public ListCompaniesResponse list( /** * List companies - * The *List companies* endpoint returns a list of [companies] associated to your instances. + * The *List companies* endpoint returns a list of [companies](https://docs.codat.io/sync-for-payables-api#/schemas/Company) associated to your instances. * * A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. * Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-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. diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/Connections.java b/sync-for-payables/src/main/java/io/codat/sync/payables/Connections.java index 9fe8e040..1c42d828 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/Connections.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/Connections.java @@ -70,7 +70,7 @@ public class Connections implements * Create connection * Creates a connection for the company by providing a valid `platformKey`. * - * Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. + * Use the [List Integrations](https://docs.codat.io/platform-api#/operations/list-integrations) endpoint to access valid platform keys. * @return The call builder */ public CreateConnectionRequestBuilder create() { @@ -81,7 +81,7 @@ public CreateConnectionRequestBuilder create() { * Create connection * Creates a connection for the company by providing a valid `platformKey`. * - * Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. + * Use the [List Integrations](https://docs.codat.io/platform-api#/operations/list-integrations) endpoint to access valid platform keys. * @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 @@ -95,7 +95,7 @@ public CreateConnectionResponse create( * Create connection * Creates a connection for the company by providing a valid `platformKey`. * - * Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. + * Use the [List Integrations](https://docs.codat.io/platform-api#/operations/list-integrations) endpoint to access valid platform keys. * @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 diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/SDKConfiguration.java b/sync-for-payables/src/main/java/io/codat/sync/payables/SDKConfiguration.java index bf6d556b..a1744a97 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/SDKConfiguration.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/SDKConfiguration.java @@ -23,8 +23,8 @@ public Optional securitySource() { 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 = "4.0.0"; - public static final String GEN_VERSION = "2.445.1"; + public static final String SDK_VERSION = "4.1.0"; + public static final String GEN_VERSION = "2.466.0"; private static final String BASE_PACKAGE = "io.codat.sync.payables"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/Company.java b/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/Company.java index e4188635..ef69f394 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/Company.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/Company.java @@ -123,6 +123,17 @@ public class Company { @JsonProperty("redirect") private String redirect; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("referenceParentCompany") + private Optional referenceParentCompany; + + /** + * A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("referenceSubsidiaryCompanies") + private Optional> referenceSubsidiaryCompanies; + /** * A collection of user-defined key-value pairs that store custom metadata against the company. */ @@ -141,6 +152,8 @@ public Company( @JsonProperty("name") String name, @JsonProperty("products") Optional> products, @JsonProperty("redirect") String redirect, + @JsonProperty("referenceParentCompany") Optional referenceParentCompany, + @JsonProperty("referenceSubsidiaryCompanies") Optional> referenceSubsidiaryCompanies, @JsonProperty("tags") Optional> tags) { Utils.checkNotNull(created, "created"); Utils.checkNotNull(createdByUserName, "createdByUserName"); @@ -151,6 +164,8 @@ public Company( Utils.checkNotNull(name, "name"); Utils.checkNotNull(products, "products"); Utils.checkNotNull(redirect, "redirect"); + Utils.checkNotNull(referenceParentCompany, "referenceParentCompany"); + Utils.checkNotNull(referenceSubsidiaryCompanies, "referenceSubsidiaryCompanies"); Utils.checkNotNull(tags, "tags"); this.created = created; this.createdByUserName = createdByUserName; @@ -161,6 +176,8 @@ public Company( this.name = name; this.products = products; this.redirect = redirect; + this.referenceParentCompany = referenceParentCompany; + this.referenceSubsidiaryCompanies = referenceSubsidiaryCompanies; this.tags = tags; } @@ -168,7 +185,7 @@ public Company( String id, String name, String redirect) { - this(Optional.empty(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), id, Optional.empty(), name, Optional.empty(), redirect, Optional.empty()); + this(Optional.empty(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), id, Optional.empty(), name, Optional.empty(), redirect, Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -278,6 +295,21 @@ public String redirect() { return redirect; } + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional referenceParentCompany() { + return (Optional) referenceParentCompany; + } + + /** + * A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> referenceSubsidiaryCompanies() { + return (Optional>) referenceSubsidiaryCompanies; + } + /** * A collection of user-defined key-value pairs that store custom metadata against the company. */ @@ -492,6 +524,36 @@ public Company withRedirect(String redirect) { return this; } + public Company withReferenceParentCompany(CompanyReference referenceParentCompany) { + Utils.checkNotNull(referenceParentCompany, "referenceParentCompany"); + this.referenceParentCompany = Optional.ofNullable(referenceParentCompany); + return this; + } + + public Company withReferenceParentCompany(Optional referenceParentCompany) { + Utils.checkNotNull(referenceParentCompany, "referenceParentCompany"); + this.referenceParentCompany = referenceParentCompany; + return this; + } + + /** + * A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. + */ + public Company withReferenceSubsidiaryCompanies(List referenceSubsidiaryCompanies) { + Utils.checkNotNull(referenceSubsidiaryCompanies, "referenceSubsidiaryCompanies"); + this.referenceSubsidiaryCompanies = Optional.ofNullable(referenceSubsidiaryCompanies); + return this; + } + + /** + * A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. + */ + public Company withReferenceSubsidiaryCompanies(Optional> referenceSubsidiaryCompanies) { + Utils.checkNotNull(referenceSubsidiaryCompanies, "referenceSubsidiaryCompanies"); + this.referenceSubsidiaryCompanies = referenceSubsidiaryCompanies; + return this; + } + /** * A collection of user-defined key-value pairs that store custom metadata against the company. */ @@ -529,6 +591,8 @@ public boolean equals(java.lang.Object o) { Objects.deepEquals(this.name, other.name) && Objects.deepEquals(this.products, other.products) && Objects.deepEquals(this.redirect, other.redirect) && + Objects.deepEquals(this.referenceParentCompany, other.referenceParentCompany) && + Objects.deepEquals(this.referenceSubsidiaryCompanies, other.referenceSubsidiaryCompanies) && Objects.deepEquals(this.tags, other.tags); } @@ -544,6 +608,8 @@ public int hashCode() { name, products, redirect, + referenceParentCompany, + referenceSubsidiaryCompanies, tags); } @@ -559,6 +625,8 @@ public String toString() { "name", name, "products", products, "redirect", redirect, + "referenceParentCompany", referenceParentCompany, + "referenceSubsidiaryCompanies", referenceSubsidiaryCompanies, "tags", tags); } @@ -582,6 +650,10 @@ public final static class Builder { private String redirect; + private Optional referenceParentCompany = Optional.empty(); + + private Optional> referenceSubsidiaryCompanies = Optional.empty(); + private Optional> tags = Optional.empty(); private Builder() { @@ -789,6 +861,36 @@ public Builder redirect(String redirect) { return this; } + public Builder referenceParentCompany(CompanyReference referenceParentCompany) { + Utils.checkNotNull(referenceParentCompany, "referenceParentCompany"); + this.referenceParentCompany = Optional.ofNullable(referenceParentCompany); + return this; + } + + public Builder referenceParentCompany(Optional referenceParentCompany) { + Utils.checkNotNull(referenceParentCompany, "referenceParentCompany"); + this.referenceParentCompany = referenceParentCompany; + return this; + } + + /** + * A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. + */ + public Builder referenceSubsidiaryCompanies(List referenceSubsidiaryCompanies) { + Utils.checkNotNull(referenceSubsidiaryCompanies, "referenceSubsidiaryCompanies"); + this.referenceSubsidiaryCompanies = Optional.ofNullable(referenceSubsidiaryCompanies); + return this; + } + + /** + * A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. + */ + public Builder referenceSubsidiaryCompanies(Optional> referenceSubsidiaryCompanies) { + Utils.checkNotNull(referenceSubsidiaryCompanies, "referenceSubsidiaryCompanies"); + this.referenceSubsidiaryCompanies = referenceSubsidiaryCompanies; + return this; + } + /** * A collection of user-defined key-value pairs that store custom metadata against the company. */ @@ -818,6 +920,8 @@ public Company build() { name, products, redirect, + referenceParentCompany, + referenceSubsidiaryCompanies, tags); } } diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReference.java b/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReference.java new file mode 100644 index 00000000..99e47026 --- /dev/null +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReference.java @@ -0,0 +1,371 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.sync.payables.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.sync.payables.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + + +public class CompanyReference { + + /** + * Additional information about the company. This can be used to store foreign IDs, references, etc. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("description") + private Optional description; + + /** + * Unique identifier for your SMB in Codat. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("id") + private Optional id; + + /** + * A collection of links for the company. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("links") + private Optional links; + + /** + * The name of the company + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private Optional name; + + /** + * A collection of user-defined key-value pairs that store custom metadata against the company. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("tags") + private Optional> tags; + + @JsonCreator + public CompanyReference( + @JsonProperty("description") Optional description, + @JsonProperty("id") Optional id, + @JsonProperty("links") Optional links, + @JsonProperty("name") Optional name, + @JsonProperty("tags") Optional> tags) { + Utils.checkNotNull(description, "description"); + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(links, "links"); + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(tags, "tags"); + this.description = description; + this.id = id; + this.links = links; + this.name = name; + this.tags = tags; + } + + public CompanyReference() { + this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + } + + /** + * Additional information about the company. This can be used to store foreign IDs, references, etc. + */ + @JsonIgnore + public Optional description() { + return description; + } + + /** + * Unique identifier for your SMB in Codat. + */ + @JsonIgnore + public Optional id() { + return id; + } + + /** + * A collection of links for the company. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional links() { + return (Optional) links; + } + + /** + * The name of the company + */ + @JsonIgnore + public Optional name() { + return name; + } + + /** + * A collection of user-defined key-value pairs that store custom metadata against the company. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> tags() { + return (Optional>) tags; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Additional information about the company. This can be used to store foreign IDs, references, etc. + */ + public CompanyReference withDescription(String description) { + Utils.checkNotNull(description, "description"); + this.description = Optional.ofNullable(description); + return this; + } + + /** + * Additional information about the company. This can be used to store foreign IDs, references, etc. + */ + public CompanyReference withDescription(Optional description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + /** + * Unique identifier for your SMB in Codat. + */ + public CompanyReference withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Unique identifier for your SMB in Codat. + */ + public CompanyReference withId(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * A collection of links for the company. + */ + public CompanyReference withLinks(CompanyReferenceLinks links) { + Utils.checkNotNull(links, "links"); + this.links = Optional.ofNullable(links); + return this; + } + + /** + * A collection of links for the company. + */ + public CompanyReference withLinks(Optional links) { + Utils.checkNotNull(links, "links"); + this.links = links; + return this; + } + + /** + * The name of the company + */ + public CompanyReference withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + /** + * The name of the company + */ + public CompanyReference withName(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * A collection of user-defined key-value pairs that store custom metadata against the company. + */ + public CompanyReference withTags(Map tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + * A collection of user-defined key-value pairs that store custom metadata against the company. + */ + public CompanyReference withTags(Optional> tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = tags; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompanyReference other = (CompanyReference) o; + return + Objects.deepEquals(this.description, other.description) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.links, other.links) && + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.tags, other.tags); + } + + @Override + public int hashCode() { + return Objects.hash( + description, + id, + links, + name, + tags); + } + + @Override + public String toString() { + return Utils.toString(CompanyReference.class, + "description", description, + "id", id, + "links", links, + "name", name, + "tags", tags); + } + + public final static class Builder { + + private Optional description = Optional.empty(); + + private Optional id = Optional.empty(); + + private Optional links = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Additional information about the company. This can be used to store foreign IDs, references, etc. + */ + public Builder description(String description) { + Utils.checkNotNull(description, "description"); + this.description = Optional.ofNullable(description); + return this; + } + + /** + * Additional information about the company. This can be used to store foreign IDs, references, etc. + */ + public Builder description(Optional description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + /** + * Unique identifier for your SMB in Codat. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + /** + * Unique identifier for your SMB in Codat. + */ + public Builder id(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * A collection of links for the company. + */ + public Builder links(CompanyReferenceLinks links) { + Utils.checkNotNull(links, "links"); + this.links = Optional.ofNullable(links); + return this; + } + + /** + * A collection of links for the company. + */ + public Builder links(Optional links) { + Utils.checkNotNull(links, "links"); + this.links = links; + return this; + } + + /** + * The name of the company + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + /** + * The name of the company + */ + public Builder name(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * A collection of user-defined key-value pairs that store custom metadata against the company. + */ + public Builder tags(Map tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + * A collection of user-defined key-value pairs that store custom metadata against the company. + */ + public Builder tags(Optional> tags) { + Utils.checkNotNull(tags, "tags"); + this.tags = tags; + return this; + } + + public CompanyReference build() { + return new CompanyReference( + description, + id, + links, + name, + tags); + } + } +} + diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReferenceLinks.java b/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReferenceLinks.java new file mode 100644 index 00000000..b8a4ba06 --- /dev/null +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/models/components/CompanyReferenceLinks.java @@ -0,0 +1,130 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.sync.payables.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.sync.payables.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + +/** + * CompanyReferenceLinks - A collection of links for the company. + */ + +public class CompanyReferenceLinks { + + /** + * Link to the company page in the portal. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("portal") + private Optional portal; + + @JsonCreator + public CompanyReferenceLinks( + @JsonProperty("portal") Optional portal) { + Utils.checkNotNull(portal, "portal"); + this.portal = portal; + } + + public CompanyReferenceLinks() { + this(Optional.empty()); + } + + /** + * Link to the company page in the portal. + */ + @JsonIgnore + public Optional portal() { + return portal; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Link to the company page in the portal. + */ + public CompanyReferenceLinks withPortal(String portal) { + Utils.checkNotNull(portal, "portal"); + this.portal = Optional.ofNullable(portal); + return this; + } + + /** + * Link to the company page in the portal. + */ + public CompanyReferenceLinks withPortal(Optional portal) { + Utils.checkNotNull(portal, "portal"); + this.portal = portal; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompanyReferenceLinks other = (CompanyReferenceLinks) o; + return + Objects.deepEquals(this.portal, other.portal); + } + + @Override + public int hashCode() { + return Objects.hash( + portal); + } + + @Override + public String toString() { + return Utils.toString(CompanyReferenceLinks.class, + "portal", portal); + } + + public final static class Builder { + + private Optional portal = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Link to the company page in the portal. + */ + public Builder portal(String portal) { + Utils.checkNotNull(portal, "portal"); + this.portal = Optional.ofNullable(portal); + return this; + } + + /** + * Link to the company page in the portal. + */ + public Builder portal(Optional portal) { + Utils.checkNotNull(portal, "portal"); + this.portal = portal; + return this; + } + + public CompanyReferenceLinks build() { + return new CompanyReferenceLinks( + portal); + } + } +} + diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/HTTPRequest.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/HTTPRequest.java index 9fa07ebf..bcf9bae7 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/HTTPRequest.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/HTTPRequest.java @@ -4,6 +4,7 @@ package io.codat.sync.payables.utils; +import java.net.URI; import java.net.URISyntaxException; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublisher; @@ -15,15 +16,15 @@ import java.util.Map; import java.util.Optional; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.message.BasicNameValuePair; - public class HTTPRequest { + private static final String FRAGMENT_SEGMENT_START = "#"; + private static final String QUERY_NAME_VALUE_DELIMITER = "="; + private static final String QUERY_PARAMETER_DELIMITER = "&"; + private static final String QUERY_SEGMENT_START = "?"; private final String baseURL; private final String method; - private final List queryParams = new ArrayList<>(); + private final List queryParams = new ArrayList<>(); private final Map> headers = new HashMap<>(); private Optional body = Optional.empty(); // mutable @@ -54,21 +55,21 @@ public HTTPRequest addHeaders(Map> map) { return this; } - public HTTPRequest addQueryParam(String name, String value) { - addQueryParam(new BasicNameValuePair(name, value)); + public HTTPRequest addQueryParam(QueryParameter param) { + this.queryParams.add(param); return this; } - - public HTTPRequest addQueryParam(NameValuePair param) { - this.queryParams.add(param); + + public HTTPRequest addQueryParam(String key, String value, boolean allowReserved) { + this.queryParams.add(QueryParameter.of(key, value, allowReserved)); return this; } - public HTTPRequest addQueryParams(Collection params) { + public HTTPRequest addQueryParams(Collection params) { params.forEach(p -> addQueryParam(p)); return this; } - + public HttpRequest build() { HttpRequest.Builder requestBuilder = HttpRequest.newBuilder(); @@ -81,14 +82,49 @@ public HttpRequest build() { } requestBuilder.method(method, bodyPublisher); try { - URIBuilder b = new URIBuilder(this.baseURL); - queryParams.forEach(pair -> b.addParameter(pair.getName(), pair.getValue())); - requestBuilder.uri(b.build()); + requestBuilder.uri(new URI(buildUrl(baseURL, queryParams))); } catch (URISyntaxException e) { throw new RuntimeException(e); } headers.forEach((k, list) -> list.forEach(v -> requestBuilder.header(k, v))); return requestBuilder.build(); } - + + // VisibleForTesting + public static String buildUrl(String baseURL, Collection queryParams) { + if (queryParams.isEmpty()) { + return baseURL; + } else { + final String base; + final String fragment; + int i = baseURL.indexOf(FRAGMENT_SEGMENT_START); + if (i == -1) { + base = baseURL; + fragment = ""; + } else { + base = baseURL.substring(0, i); + fragment = baseURL.substring(i); + } + StringBuilder b = new StringBuilder(base); + if (!base.contains(QUERY_SEGMENT_START)) { + b.append(QUERY_SEGMENT_START); + } else { + b.append(QUERY_PARAMETER_DELIMITER); + } + boolean first = true; + for (QueryParameter p : queryParams) { + if (!first) { + b.append(QUERY_PARAMETER_DELIMITER); + } + first = false; + // don't allow reserved characters to be unencoded in key (??) + b.append(Utf8UrlEncoder.DEFAULT.encode(p.name())); + b.append(QUERY_NAME_VALUE_DELIMITER); + b.append(Utf8UrlEncoder.allowReserved(p.allowReserved()).encode(p.value())); + } + b.append(fragment); + return b.toString(); + } + } + } \ No newline at end of file diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/PathParamsMetadata.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/PathParamsMetadata.java index ee6e2fed..13489f11 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/PathParamsMetadata.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/PathParamsMetadata.java @@ -8,15 +8,17 @@ class PathParamsMetadata { + // these fields set via reflection + String style = "simple"; boolean explode; String name; String serialization; + boolean allowReserved; private PathParamsMetadata() { } - // pathParam:style=simple,explode=false,name=apiID static PathParamsMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { return Metadata.parse("pathParam", new PathParamsMetadata(), field); } diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameter.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameter.java new file mode 100644 index 00000000..f7c15bb5 --- /dev/null +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameter.java @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.sync.payables.utils; + +import java.util.Objects; + +// internal class, not for public use +// TODO move to internal package +public final class QueryParameter { + + private final String name; + private final String value; + private final boolean allowReserved; + + private QueryParameter(String name, String value, boolean allowReserved) { + this.name = name; + this.value = value; + this.allowReserved = allowReserved; + } + + public static QueryParameter of(String name, String value, boolean allowReserved) { + return new QueryParameter(name, value, allowReserved); + } + + public String name() { + return name; + } + + public String value() { + return value; + } + + public boolean allowReserved() { + return allowReserved; + } + + @Override + public String toString() { + return "QueryParameter [name=" + name + ", value=" + value + ", allowReserved=" + allowReserved + "]"; + } + + @Override + public int hashCode() { + return Objects.hash(allowReserved, name, value); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + QueryParameter other = (QueryParameter) obj; + return allowReserved == other.allowReserved && Objects.equals(name, other.name) + && Objects.equals(value, other.value); + } + +} diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameters.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameters.java index d7f55a50..d1697934 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameters.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParameters.java @@ -11,16 +11,13 @@ import java.util.Map; import java.util.stream.Collectors; -import org.apache.http.NameValuePair; -import org.apache.http.message.BasicNameValuePair; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class QueryParameters { - public static List parseQueryParams(Class type, T queryParams, + public static List parseQueryParams(Class type, T queryParams, Map>> globals) throws Exception { - List allParams = new ArrayList<>(); + List allParams = new ArrayList<>(); Field[] fields = type.getDeclaredFields(); @@ -45,20 +42,20 @@ public static List parseQueryParams(Class t } if (queryParamsMetadata.serialization != null && !queryParamsMetadata.serialization.isBlank()) { - List params = parseSerializedParams(queryParamsMetadata, value); + List params = parseSerializedParams(queryParamsMetadata, value); allParams.addAll(params); } else { switch (queryParamsMetadata.style) { case "form": - List formParams = parseDelimitedParams(queryParamsMetadata, value, ","); + List formParams = parseDelimitedParams(queryParamsMetadata, value, ","); allParams.addAll(formParams); break; case "deepObject": - List deepObjectParams = parseDeepObjectParams(queryParamsMetadata, value); + List deepObjectParams = parseDeepObjectParams(queryParamsMetadata, value); allParams.addAll(deepObjectParams); break; case "pipeDelimited": - List pipeDelimitedParams = parseDelimitedParams(queryParamsMetadata, value, "|"); + List pipeDelimitedParams = parseDelimitedParams(queryParamsMetadata, value, "|"); allParams.addAll(pipeDelimitedParams); break; default: @@ -70,14 +67,14 @@ public static List parseQueryParams(Class t return allParams; } - private static List parseSerializedParams(QueryParamsMetadata queryParamsMetadata, Object value) + private static List parseSerializedParams(QueryParamsMetadata queryParamsMetadata, Object value) throws JsonProcessingException { - List params = new ArrayList<>(); + List params = new ArrayList<>(); switch (queryParamsMetadata.serialization) { case "json": ObjectMapper mapper = JSON.getMapper(); String json = mapper.writeValueAsString(value); - params.add(new BasicNameValuePair(queryParamsMetadata.name, json)); + params.add(QueryParameter.of(queryParamsMetadata.name, json, queryParamsMetadata.allowReserved)); break; default: break; @@ -85,9 +82,9 @@ private static List parseSerializedParams(QueryParamsMetadata que return params; } - private static List parseDelimitedParams(QueryParamsMetadata queryParamsMetadata, Object value, String delimiter) + private static List parseDelimitedParams(QueryParamsMetadata queryParamsMetadata, Object value, String delimiter) throws IllegalArgumentException, IllegalAccessException { - List params = new ArrayList<>(); + List params = new ArrayList<>(); switch (Types.getType(value.getClass())) { case ARRAY: { @@ -107,7 +104,7 @@ private static List parseDelimitedParams(QueryParamsMetadata quer values.add(String.join(delimiter, items)); } - params.addAll(values.stream().map(v -> new BasicNameValuePair(queryParamsMetadata.name, v)) + params.addAll(values.stream().map(v -> QueryParameter.of(queryParamsMetadata.name, v, queryParamsMetadata.allowReserved)) .collect(Collectors.toList())); break; } @@ -121,20 +118,20 @@ private static List parseDelimitedParams(QueryParamsMetadata quer String val = Utils.valToString(entry.getValue()); if (queryParamsMetadata.explode) { - params.add(new BasicNameValuePair(key, val)); + params.add(QueryParameter.of(key, val, queryParamsMetadata.allowReserved)); } else { items.add(String.format("%s%s%s", key, delimiter, val)); } } if (items.size() > 0) { - params.add(new BasicNameValuePair(queryParamsMetadata.name, String.join(delimiter, items))); + params.add(QueryParameter.of(queryParamsMetadata.name, String.join(delimiter, items), queryParamsMetadata.allowReserved)); } break; } case OBJECT: { if (!Utils.allowIntrospection(value.getClass())) { - params.add(new BasicNameValuePair(queryParamsMetadata.name, Utils.valToString(value))); + params.add(QueryParameter.of(queryParamsMetadata.name, Utils.valToString(value), queryParamsMetadata.allowReserved)); break; } Field[] fields = value.getClass().getDeclaredFields(); @@ -155,29 +152,29 @@ private static List parseDelimitedParams(QueryParamsMetadata quer } if (queryParamsMetadata.explode) { - params.add(new BasicNameValuePair(metadata.name, Utils.valToString(val))); + params.add(QueryParameter.of(metadata.name, Utils.valToString(val), metadata.allowReserved)); } else { items.add(String.format("%s%s%s", metadata.name, delimiter, Utils.valToString(val))); } } if (items.size() > 0) { - params.add(new BasicNameValuePair(queryParamsMetadata.name, String.join(delimiter, items))); + params.add(QueryParameter.of(queryParamsMetadata.name, String.join(delimiter, items), queryParamsMetadata.allowReserved)); } break; } default: - params.add(new BasicNameValuePair(queryParamsMetadata.name, Utils.valToString(value))); + params.add(QueryParameter.of(queryParamsMetadata.name, Utils.valToString(value), queryParamsMetadata.allowReserved)); break; } return params; } - private static List parseDeepObjectParams(QueryParamsMetadata queryParamsMetadata, Object value) + private static List parseDeepObjectParams(QueryParamsMetadata queryParamsMetadata, Object value) throws Exception { - List params = new ArrayList<>(); + List params = new ArrayList<>(); switch (Types.getType(value.getClass())) { case MAP: { @@ -189,12 +186,12 @@ private static List parseDeepObjectParams(QueryParamsMetadata que if (val instanceof List || val.getClass().isArray()) { for (Object v : Utils.toList(val)) { - params.add(new BasicNameValuePair(String.format("%s[%s]", queryParamsMetadata.name, key), - Utils.valToString(v))); + params.add(QueryParameter.of(String.format("%s[%s]", queryParamsMetadata.name, key), + Utils.valToString(v), queryParamsMetadata.allowReserved)); } } else { - params.add(new BasicNameValuePair(String.format("%s[%s]", queryParamsMetadata.name, key), - Utils.valToString(val))); + params.add(QueryParameter.of(String.format("%s[%s]", queryParamsMetadata.name, key), + Utils.valToString(val), queryParamsMetadata.allowReserved)); } } @@ -221,14 +218,14 @@ private static List parseDeepObjectParams(QueryParamsMetadata que if (val instanceof List || val.getClass().isArray()) { for (Object v : Utils.toList(val)) { - params.add(new BasicNameValuePair( + params.add(QueryParameter.of( String.format("%s[%s]", queryParamsMetadata.name, metadata.name), - Utils.valToString(v))); + Utils.valToString(v), metadata.allowReserved)); } } else { params.add( - new BasicNameValuePair(String.format("%s[%s]", queryParamsMetadata.name, metadata.name), - Utils.valToString(val))); + QueryParameter.of(String.format("%s[%s]", queryParamsMetadata.name, metadata.name), + Utils.valToString(val), metadata.allowReserved)); } } diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParamsMetadata.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParamsMetadata.java index 71a801f7..7c41f6f8 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParamsMetadata.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/QueryParamsMetadata.java @@ -8,12 +8,14 @@ class QueryParamsMetadata { + // these parameters set via reflection + String style = "form"; boolean explode = true; String name; String serialization; + boolean allowReserved; - // queryParam:style=simple,explode=false,name=apiID static QueryParamsMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { return Metadata.parse("queryParam", new QueryParamsMetadata(), field); } diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Security.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Security.java index 0cf06123..ed8e568d 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Security.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Security.java @@ -108,7 +108,7 @@ private static void parseSecuritySchemeValue(HTTPRequest request, SecurityMetada break; case "query": request.addQueryParam( - securityMetadata.name, Utils.valToString(value)); + securityMetadata.name, Utils.valToString(value), false); break; case "cookie": request.addHeader("Cookie", diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utf8UrlEncoder.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utf8UrlEncoder.java new file mode 100644 index 00000000..8d34da71 --- /dev/null +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utf8UrlEncoder.java @@ -0,0 +1,117 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package io.codat.sync.payables.utils; + +import java.io.CharArrayWriter; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.BitSet; +import java.util.Objects; + +// Internal use only +// TODO move to an internal package +public final class Utf8UrlEncoder { + + private static final BitSet DO_NOT_ENCODE_CHARS = createDoNotEncodeChars(); + private static final int CASE_DIFF = ('a' - 'A'); + + private final BitSet safeChars; + + public static final Utf8UrlEncoder ALLOW_RESERVED = new Utf8UrlEncoder(":/?#[]@!$&'()*+,;="); + public static final Utf8UrlEncoder DEFAULT = new Utf8UrlEncoder(""); + + public static Utf8UrlEncoder allowReserved(boolean allowReserved) { + return allowReserved ? ALLOW_RESERVED : DEFAULT; + } + + private Utf8UrlEncoder(String safeCharacters) { + Objects.requireNonNull(safeCharacters, "safeCharacters"); + int max = -1; + for (int i = 0; i < safeCharacters.length(); i++) { + char ch = safeCharacters.charAt(i); + max = Math.max(ch, max); + } + BitSet safeChars = new BitSet(max + 1); + for (int i = 0; i < safeCharacters.length(); i++) { + char ch = safeCharacters.charAt(i); + safeChars.set(ch); + } + this.safeChars = safeChars; + } + + public String encode(String s) { + return encode(s, StandardCharsets.UTF_8); + } + + private String encode(String s, Charset charset) { + boolean changed = false; + StringBuilder out = new StringBuilder(s.length()); + CharArrayWriter writer = new CharArrayWriter(); + + for (int i = 0; i < s.length();) { + int c = (int) s.charAt(i); + if (DO_NOT_ENCODE_CHARS.get(c) || safeChars.get(c)) { + out.append((char) c); + i++; + } else { + // convert to external encoding before hex conversion + do { + writer.write(c); + if (c >= 0xD800 && c <= 0xDBFF) { + if ((i + 1) < s.length()) { + int d = (int) s.charAt(i + 1); + if (d >= 0xDC00 && d <= 0xDFFF) { + writer.write(d); + i++; + } + } + } + i++; + } while (i < s.length() && !DO_NOT_ENCODE_CHARS.get((c = (int) s.charAt(i)))); + + writer.flush(); + String str = new String(writer.toCharArray()); + byte[] ba = str.getBytes(charset); + for (int j = 0; j < ba.length; j++) { + out.append('%'); + char ch = Character.forDigit((ba[j] >> 4) & 0xF, 16); + // converting to use uppercase letter as part of + // the hex value if ch is a letter. + if (Character.isLetter(ch)) { + ch -= CASE_DIFF; + } + out.append(ch); + ch = Character.forDigit(ba[j] & 0xF, 16); + if (Character.isLetter(ch)) { + ch -= CASE_DIFF; + } + out.append(ch); + } + writer.reset(); + changed = true; + } + } + + return (changed ? out.toString() : s); + } + + private static BitSet createDoNotEncodeChars() { + BitSet b = new BitSet(256); + for (int i = 'a'; i <= 'z'; i++) { + b.set(i); + } + for (int i = 'A'; i <= 'Z'; i++) { + b.set(i); + } + for (int i = '0'; i <= '9'; i++) { + b.set(i); + } + b.set('-'); + b.set('_'); + b.set('.'); + b.set('*'); + return b; + } +} diff --git a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utils.java b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utils.java index 14942f7f..b0e14d29 100644 --- a/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utils.java +++ b/sync-for-payables/src/main/java/io/codat/sync/payables/utils/Utils.java @@ -15,7 +15,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; -import java.net.URISyntaxException; import java.net.URLEncoder; import java.net.http.HttpClient.Version; import java.net.http.HttpHeaders; @@ -144,7 +143,9 @@ public static String generateURL(Class type, String baseURL, String path, pathParams.put(pathParamsMetadata.name, String.join(",", - array.stream().map(v -> valToString(v)) + array.stream() + .map(v -> valToString(v)) + .map(v -> pathEncode(v, pathParamsMetadata.allowReserved)) .collect(Collectors.toList()))); break; case MAP: @@ -156,17 +157,17 @@ public static String generateURL(Class type, String baseURL, String path, pathParams.put(pathParamsMetadata.name, String.join(",", map.entrySet().stream().map(e -> { if (pathParamsMetadata.explode) { - return String.format("%s=%s", valToString(e.getKey()), - valToString(e.getValue())); + return String.format("%s=%s", pathEncode(valToString(e.getKey()), false), + pathEncode(valToString(e.getValue()), false)); } else { - return String.format("%s,%s", valToString(e.getKey()), - valToString(e.getValue())); + return String.format("%s,%s", pathEncode(valToString(e.getKey()), false), + pathEncode(valToString(e.getValue()), false)); } }).collect(Collectors.toList()))); break; case OBJECT: if (!allowIntrospection(value.getClass())) { - pathParams.put(pathParamsMetadata.name, valToString(value)); + pathParams.put(pathParamsMetadata.name, pathEncode(valToString(value), pathParamsMetadata.allowReserved)); break; } List values = new ArrayList<>(); @@ -187,17 +188,17 @@ public static String generateURL(Class type, String baseURL, String path, if (pathParamsMetadata.explode) { values.add(String.format("%s=%s", valuePathParamsMetadata.name, - valToString(val))); + pathEncode(valToString(val), valuePathParamsMetadata.allowReserved))); } else { values.add(String.format("%s,%s", valuePathParamsMetadata.name, - valToString(val))); + pathEncode(valToString(val), valuePathParamsMetadata.allowReserved))); } } pathParams.put(pathParamsMetadata.name, String.join(",", values)); break; default: - pathParams.put(pathParamsMetadata.name, valToString(value)); + pathParams.put(pathParamsMetadata.name, pathEncode(valToString(value), pathParamsMetadata.allowReserved)); break; } } @@ -206,6 +207,10 @@ public static String generateURL(Class type, String baseURL, String path, return baseURL + templateUrl(path, pathParams); } + + private static String pathEncode(String s, boolean allowReserved) { + return Utf8UrlEncoder.allowReserved(allowReserved).encode(s); + } public static boolean contentTypeMatches(String contentType, String pattern) { if (contentType == null || contentType.isBlank()) { @@ -256,7 +261,7 @@ public static SerializedBody serializeRequestBody(Object request, String request return RequestBody.serialize(request, requestField, serializationMethod, nullable); } - public static List getQueryParams(Class type, Optional params, + public static List getQueryParams(Class type, Optional params, Map>> globals) throws Exception { if (params.isEmpty()) { return Collections.emptyList(); @@ -265,7 +270,7 @@ public static List getQueryParams(Class typ } } - public static List getQueryParams(Class type, JsonNullable params, + public static List getQueryParams(Class type, JsonNullable params, Map>> globals) throws Exception { if (!params.isPresent() || params.get() == null) { return Collections.emptyList(); @@ -274,7 +279,7 @@ public static List getQueryParams(Class typ } } - public static List getQueryParams(Class type, T params, + public static List getQueryParams(Class type, T params, Map>> globals) throws Exception { return QueryParameters.parseQueryParams(type, params, globals); } @@ -282,6 +287,8 @@ public static List getQueryParams(Class typ public static HTTPRequest configureSecurity(HTTPRequest request, Object security) throws Exception { return Security.configureSecurity(request, security); } + + private static final String DOLLAR_MARKER = "D9qPtyhOYzkHGu3c"; public static String templateUrl(String url, Map params) { StringBuilder sb = new StringBuilder(); @@ -294,12 +301,16 @@ public static String templateUrl(String url, Map params) { String key = match.substring(1, match.length() - 1); String value = params.get(key); if (value != null) { - m.appendReplacement(sb, URLEncoder.encode(value, StandardCharsets.UTF_8)); + // note that we replace $ characters in values with a marker + // and then replace the markers at the end with the $ characters + // because the presence of dollar signs can stuff up the next + // regex find + m.appendReplacement(sb, value.replace("$", DOLLAR_MARKER)); } } m.appendTail(sb); - return sb.toString(); + return sb.toString().replace(DOLLAR_MARKER, "$"); } public static Map> getHeadersFromMetadata(Object headers, Map>> globals) throws Exception { @@ -474,7 +485,7 @@ private static Map parseSerializedParams(PathParamsMetadata path case "json": ObjectMapper mapper = JSON.getMapper(); String json = mapper.writeValueAsString(value); - params.put(pathParamsMetadata.name, json); + params.put(pathParamsMetadata.name, pathEncode(json, pathParamsMetadata.allowReserved)); break; default: break; @@ -1167,18 +1178,18 @@ public static boolean isPresentAndNotNull(JsonNullable x) { return x.isPresent() && x.get() != null; } - private static final String OPEN_BRACKET_MARKER = UUID.randomUUID().toString().replace("-", ""); - private static final String CLOSE_BRACKET_MARKER = UUID.randomUUID().toString().replace("-", ""); - - public static String urlEncode(String s) { - // Ensure that complies with RFC 2732 (URLEncoder does not and we don't want to - // encode [, ] chars) - return URLEncoder.encode( // - s.replace("[", OPEN_BRACKET_MARKER) // - .replace("]", CLOSE_BRACKET_MARKER), // - StandardCharsets.UTF_8) // - .replace(OPEN_BRACKET_MARKER, "[") // - .replace(CLOSE_BRACKET_MARKER, "]"); + public static void setSseSentinel(Object o, String value) { + if (o == null || value.isBlank()) { + return; + } else { + try { + Field field = o.getClass().getDeclaredField("_eventSentinel"); + field.setAccessible(true); + field.set(o, Optional.of(value)); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + // ignore + } + } } }