diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3ffd0ebad..d8fd3bb54 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -67,11 +67,12 @@ sources: - 3.0.0 sync-for-commerce-source: sourceNamespace: sync-for-commerce-source - sourceRevisionDigest: sha256:6a62a3d9d65254b83a8e6afa5ea2e9d287076520c057bf8a1b60e42ebbdc815e - sourceBlobDigest: sha256:2e0d6f59d01a5896709430e1e05d725b88ca088e959502f216a39b23ccab77ec + sourceRevisionDigest: sha256:6d5e5550a748f71a9e40dde1c1a69b1719d16b4ba34df3caad9d76471865ed5b + sourceBlobDigest: sha256:1d1592cd53dae647bff1e58e43cb64f19f9da714cfc6f6198c43659b89b05369 tags: - latest - - main + - speakeasy-sdk-regen-1732635208 + - "1.1" sync-for-payables-source: sourceNamespace: sync-for-payables-source sourceRevisionDigest: sha256:9b7390685375f6bb8f444cfdaef0cf211fe30a63abac80c98d441203bd76d654 @@ -141,8 +142,10 @@ targets: sync-for-commerce-library: source: sync-for-commerce-source sourceNamespace: sync-for-commerce-source - sourceRevisionDigest: sha256:6a62a3d9d65254b83a8e6afa5ea2e9d287076520c057bf8a1b60e42ebbdc815e - sourceBlobDigest: sha256:2e0d6f59d01a5896709430e1e05d725b88ca088e959502f216a39b23ccab77ec + sourceRevisionDigest: sha256:6d5e5550a748f71a9e40dde1c1a69b1719d16b4ba34df3caad9d76471865ed5b + sourceBlobDigest: sha256:1d1592cd53dae647bff1e58e43cb64f19f9da714cfc6f6198c43659b89b05369 + codeSamplesNamespace: sync-for-commerce-source-code-samples + codeSamplesRevisionDigest: sha256:3b9ecd425a767a3ec537a2496260b5f66bcc810311faa362630aecb65f6c8367 sync-for-payables-library: source: sync-for-payables-source sourceNamespace: sync-for-payables-source diff --git a/sync-for-commerce/.speakeasy/gen.lock b/sync-for-commerce/.speakeasy/gen.lock index 3b0d5fa56..03438c8e6 100755 --- a/sync-for-commerce/.speakeasy/gen.lock +++ b/sync-for-commerce/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 3b92187c-e150-4a7c-9381-a62db9757019 management: - docChecksum: f31c3950f9bd89b139ffa71259feb7aa + docChecksum: 4dd3691e8d9cbb167c6a1a7bffed41b8 docVersion: "1.1" - speakeasyVersion: 1.399.0 - generationVersion: 2.415.8 - releaseVersion: 5.0.0 - configChecksum: 8edfc7088bba86cb4019185ad158cad6 + speakeasyVersion: 1.446.1 + generationVersion: 2.462.1 + releaseVersion: 6.0.0 + configChecksum: 2a50d118ee0568e3c9e55392665245a1 repoURL: https://github.com/codatio/client-sdk-python.git repoSubDirectory: sync-for-commerce installationURL: https://github.com/codatio/client-sdk-python.git#subdirectory=sync-for-commerce @@ -14,25 +14,27 @@ management: features: python: additionalDependencies: 1.0.0 - constsAndDefaults: 1.0.2 - core: 5.5.3 + constsAndDefaults: 1.0.5 + core: 5.6.8 defaultEnabledRetries: 0.2.0 deprecations: 3.0.0 enumUnions: 0.1.0 - envVarSecurityUsage: 0.3.1 + envVarSecurityUsage: 0.3.2 examples: 3.0.0 globalSecurity: 3.0.2 globalSecurityCallbacks: 1.0.0 globalServerURLs: 3.0.0 + methodArguments: 1.0.2 nameOverrides: 3.0.0 nullables: 1.0.0 - responseFormat: 1.0.0 + responseFormat: 1.0.1 retries: 3.0.2 sdkHooks: 1.0.0 serverEventsSentinels: 0.1.0 webhooks: 2.0.0 generatedFiles: - .gitattributes + - .python-version - .vscode/settings.json - CONTRIBUTING.md - USAGE.md @@ -68,12 +70,16 @@ generatedFiles: - docs/models/shared/commerceconfiguration.md - docs/models/shared/companies.md - docs/models/shared/company.md + - docs/models/shared/companyreference.md + - docs/models/shared/companyreferencelinks.md - docs/models/shared/companysyncstatus.md - docs/models/shared/configuration.md - docs/models/shared/configurationmapsettings.md - docs/models/shared/configurationoption.md - docs/models/shared/connection.md - docs/models/shared/connections.md + - docs/models/shared/connectionwebhook.md + - docs/models/shared/connectionwebhookpayload.md - docs/models/shared/createcompany.md - docs/models/shared/dataconnectionerror.md - docs/models/shared/dataconnectionstatus.md @@ -90,7 +96,6 @@ generatedFiles: - docs/models/shared/grouping.md - docs/models/shared/groupinglevels.md - docs/models/shared/groupingperiod.md - - docs/models/shared/groupreference.md - docs/models/shared/halref.md - docs/models/shared/imagereference.md - docs/models/shared/integration.md @@ -119,7 +124,6 @@ generatedFiles: - docs/models/shared/syncstatus.md - docs/models/shared/syncsummary.md - docs/models/shared/synctolatestargs.md - - docs/models/shared/tags.md - docs/models/shared/taxrateamount.md - docs/models/shared/taxratemapping.md - docs/models/shared/updateconnection.md @@ -135,13 +139,13 @@ generatedFiles: - py.typed - pylintrc - pyproject.toml - - scripts/compile.sh - scripts/prepare-readme.py - scripts/publish.sh - src/codat_sync_for_commerce/__init__.py - src/codat_sync_for_commerce/_hooks/__init__.py - src/codat_sync_for_commerce/_hooks/sdkhooks.py - src/codat_sync_for_commerce/_hooks/types.py + - src/codat_sync_for_commerce/_version.py - src/codat_sync_for_commerce/advanced_controls.py - src/codat_sync_for_commerce/basesdk.py - src/codat_sync_for_commerce/connections.py @@ -182,12 +186,15 @@ generatedFiles: - src/codat_sync_for_commerce/models/shared/commerceconfiguration.py - src/codat_sync_for_commerce/models/shared/companies.py - src/codat_sync_for_commerce/models/shared/company.py + - src/codat_sync_for_commerce/models/shared/companyreference.py - src/codat_sync_for_commerce/models/shared/companysyncstatus.py - src/codat_sync_for_commerce/models/shared/configuration.py - src/codat_sync_for_commerce/models/shared/configurationmapsettings.py - src/codat_sync_for_commerce/models/shared/configurationoption.py - src/codat_sync_for_commerce/models/shared/connection.py - src/codat_sync_for_commerce/models/shared/connections.py + - src/codat_sync_for_commerce/models/shared/connectionwebhook.py + - src/codat_sync_for_commerce/models/shared/connectionwebhookpayload.py - src/codat_sync_for_commerce/models/shared/createcompany.py - src/codat_sync_for_commerce/models/shared/dataconnectionerror.py - src/codat_sync_for_commerce/models/shared/dataconnectionstatus.py @@ -302,14 +309,14 @@ examples: create-company: "": requestBody: - application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "string"} + application/json: {"description": "Requested early access to the new financing scheme.", "name": "string"} 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"} + 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"}} "400": {} Malformed query: requestBody: - application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Bank of Dave"} + application/json: {"description": "Requested early access to the new financing scheme.", "name": "Bank of Dave"} responses: "400": application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} @@ -415,7 +422,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": [], "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: @@ -559,3 +566,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-commerce/.speakeasy/gen.yaml b/sync-for-commerce/.speakeasy/gen.yaml index 5c10421b8..4f319d2b8 100644 --- a/sync-for-commerce/.speakeasy/gen.yaml +++ b/sync-for-commerce/.speakeasy/gen.yaml @@ -9,21 +9,25 @@ generation: requestResponseComponentNamesFeb2024: false auth: oAuth2ClientCredentialsEnabled: false + oAuth2PasswordEnabled: false telemetryEnabled: true python: - version: 5.0.0 + version: 6.0.0 additionalDependencies: dev: {} main: {} author: Codat authors: - - Speakeasy + - Speakeasy clientServerStatusCodesAsErrors: true - description: Push merchants' data from your ecommerce or point-of-sale (POS) platform - into your merchants' accounting software. + defaultErrorName: SDKError + description: Push merchants' data from your ecommerce or point-of-sale (POS) platform into your merchants' accounting software. enumFormat: enum + fixFlags: + responseRequiredSep2024: false flattenGlobalSecurity: false flattenRequests: false + flatteningOrder: parameters-first imports: option: openapi paths: diff --git a/sync-for-commerce/README.md b/sync-for-commerce/README.md index 5e3db6b7f..f293453be 100755 --- a/sync-for-commerce/README.md +++ b/sync-for-commerce/README.md @@ -88,19 +88,18 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ```
@@ -113,17 +112,18 @@ from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared async def main(): - s = CodatSyncCommerce( + async with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), - ) - res = await s.sync_flow_settings.get_config_text_sync_flow_async(request={ - "locale": shared.Locale.EN_US, - }) - if res is not None: - # handle response - pass + ) as s: + res = await s.sync_flow_settings.get_config_text_sync_flow_async(request={ + "locale": shared.Locale.EN_US, + }) + + if res is not None: + # handle response + pass asyncio.run(main()) ``` @@ -189,20 +189,19 @@ from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared from codatsynccommerce.utils import BackoffStrategy, RetryConfig -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}, - RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }, + RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -212,20 +211,19 @@ from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared from codatsynccommerce.utils import BackoffStrategy, RetryConfig -s = CodatSyncCommerce( +with CodatSyncCommerce( retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False), security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -233,12 +231,23 @@ if res is not None: ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type. +Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. + +By default, an API error will raise a errors.SDKError exception, which has the following properties: -| Error Object | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401,402,403,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | +| Property | Type | Description | +|-----------------|------------------|-----------------------| +| `.status_code` | *int* | The HTTP status code | +| `.message` | *str* | The error message | +| `.raw_response` | *httpx.Response* | The raw HTTP response | +| `.body` | *str* | The response content | + +When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `get_config_text_sync_flow_async` method may raise the following exceptions: + +| Error Type | Status Code | Content Type | +| ------------------- | ---------------------------- | ---------------- | +| errors.ErrorMessage | 401, 402, 403, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ### Example @@ -246,66 +255,33 @@ Handling errors in this SDK should largely match your expectations. All operati from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import errors, shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = None -try: - res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, - }) - - if res is not None: - # handle response - pass - -except errors.ErrorMessage as e: - # handle e.data: errors.ErrorMessageData - raise(e) -except errors.SDKError as e: - # handle exception - raise(e) +) as s: + res = None + try: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) + + if res is not None: + # handle response + pass + + except errors.ErrorMessage as e: + # handle e.data: errors.ErrorMessageData + raise(e) + except errors.SDKError as e: + # handle exception + raise(e) ``` ## Server Selection -### Select Server by Index - -You can override the default server globally by passing a server index to the `server_idx: int` optional parameter 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 - -```python -from codat_sync_for_commerce import CodatSyncCommerce -from codat_sync_for_commerce.models import shared - -s = CodatSyncCommerce( - server_idx=0, - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) - -if res is not None: - # handle response - pass - -``` - - ### Override Server URL Per-Client The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: @@ -313,20 +289,19 @@ The default server can also be overridden globally by passing a URL to the `serv from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( server_url="https://api.codat.io", security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -419,28 +394,27 @@ s = CodatSyncCommerce(async_client=CustomClient(httpx.AsyncClient())) This SDK supports the following security scheme globally: -| Name | Type | Scheme | -| ------------- | ------------- | ------------- | -| `auth_header` | apiKey | API key | +| Name | Type | Scheme | +| ------------- | ------ | ------- | +| `auth_header` | apiKey | API key | You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. For example: ```python from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/sync-for-commerce/RELEASES.md b/sync-for-commerce/RELEASES.md index 354ef3ef4..87d56f843 100644 --- a/sync-for-commerce/RELEASES.md +++ b/sync-for-commerce/RELEASES.md @@ -578,4 +578,14 @@ Based on: ### Generated - [python v5.0.0] sync-for-commerce ### Releases -- [PyPI v5.0.0] https://pypi.org/project/codat-sync-for-commerce/5.0.0 - sync-for-commerce \ No newline at end of file +- [PyPI v5.0.0] https://pypi.org/project/codat-sync-for-commerce/5.0.0 - sync-for-commerce + +## 2024-11-26 15:33:19 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.446.1 (2.462.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v6.0.0] sync-for-commerce +### Releases +- [PyPI v6.0.0] https://pypi.org/project/codat-sync-for-commerce/6.0.0 - sync-for-commerce \ No newline at end of file diff --git a/sync-for-commerce/USAGE.md b/sync-for-commerce/USAGE.md index e22ef4998..292d3a976 100644 --- a/sync-for-commerce/USAGE.md +++ b/sync-for-commerce/USAGE.md @@ -4,19 +4,18 @@ from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ```
@@ -29,17 +28,18 @@ from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared async def main(): - s = CodatSyncCommerce( + async with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), - ) - res = await s.sync_flow_settings.get_config_text_sync_flow_async(request={ - "locale": shared.Locale.EN_US, - }) - if res is not None: - # handle response - pass + ) as s: + res = await s.sync_flow_settings.get_config_text_sync_flow_async(request={ + "locale": shared.Locale.EN_US, + }) + + if res is not None: + # handle response + pass asyncio.run(main()) ``` diff --git a/sync-for-commerce/docs/models/errors/errormessage.md b/sync-for-commerce/docs/models/errors/errormessage.md index c24cd9acc..c795816c6 100644 --- a/sync-for-commerce/docs/models/errors/errormessage.md +++ b/sync-for-commerce/docs/models/errors/errormessage.md @@ -1,6 +1,6 @@ # ErrorMessage -Your `query` parameter was not correctly formed +Your API request was not properly authorized. ## Fields diff --git a/sync-for-commerce/docs/models/shared/company.md b/sync-for-commerce/docs/models/shared/company.md index 7f90dddac..d983d3c26 100644 --- a/sync-for-commerce/docs/models/shared/company.md +++ b/sync-for-commerce/docs/models/shared/company.md @@ -20,4 +20,6 @@ When you create a company, you can specify a `name` and we will automatically ge | `description` | *Optional[str]* | :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. | | `last_sync` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `products` | List[*str*] | :heavy_minus_sign: | An array of products that are currently enabled for the company. | | -| `tags` | [Optional[shared.Tags]](../../models/shared/tags.md) | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | \ No newline at end of file +| `reference_parent_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | | +| `reference_subsidiary_companies` | List[[shared.CompanyReference](../../models/shared/companyreference.md)] | :heavy_minus_sign: | A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. | | +| `tags` | Dict[str, *str*] | :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-commerce/docs/models/shared/companyreference.md b/sync-for-commerce/docs/models/shared/companyreference.md new file mode 100644 index 000000000..b651f69d5 --- /dev/null +++ b/sync-for-commerce/docs/models/shared/companyreference.md @@ -0,0 +1,12 @@ +# CompanyReference + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `description` | *Optional[str]* | :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[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `links` | [Optional[shared.CompanyReferenceLinks]](../../models/shared/companyreferencelinks.md) | :heavy_minus_sign: | A collection of links for the company. | | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the company | Codat Ltd. | +| `tags` | Dict[str, *str*] | :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-commerce/docs/models/shared/companyreferencelinks.md b/sync-for-commerce/docs/models/shared/companyreferencelinks.md new file mode 100644 index 000000000..ee01fd320 --- /dev/null +++ b/sync-for-commerce/docs/models/shared/companyreferencelinks.md @@ -0,0 +1,10 @@ +# CompanyReferenceLinks + +A collection of links for the company. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | +| `portal` | *Optional[str]* | :heavy_minus_sign: | Link to the company page in the portal. | \ No newline at end of file diff --git a/sync-for-commerce/docs/models/shared/connection.md b/sync-for-commerce/docs/models/shared/connection.md index 082816294..e6e9196c3 100644 --- a/sync-for-commerce/docs/models/shared/connection.md +++ b/sync-for-commerce/docs/models/shared/connection.md @@ -25,7 +25,6 @@ Before you can use a data connection to pull or push data, the company must gran | `source_id` | *str* | :heavy_check_mark: | A source-specific ID used to distinguish between different sources originating from the same data connection. In general, a data connection is a single data source. However, for TrueLayer, `sourceId` is associated with a specific bank and has a many-to-one relationship with the `integrationId`. | 35b92968-9851-4095-ad60-395c95cbcba4 | | `source_type` | [shared.SourceType](../../models/shared/sourcetype.md) | :heavy_check_mark: | The type of platform of the connection. | Accounting | | `status` | [shared.DataConnectionStatus](../../models/shared/dataconnectionstatus.md) | :heavy_check_mark: | The current authorization status of the data connection. | | -| `additional_properties` | *Optional[Any]* | :heavy_minus_sign: | N/A | | | `connection_info` | Dict[str, *str*] | :heavy_minus_sign: | N/A | | | `data_connection_errors` | List[[shared.DataConnectionError](../../models/shared/dataconnectionerror.md)] | :heavy_minus_sign: | N/A | | | `last_sync` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-commerce/docs/models/shared/connectionwebhook.md b/sync-for-commerce/docs/models/shared/connectionwebhook.md new file mode 100644 index 000000000..b41d3af3d --- /dev/null +++ b/sync-for-commerce/docs/models/shared/connectionwebhook.md @@ -0,0 +1,11 @@ +# ConnectionWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | connection.created | +| `generated_date` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the event. | ba29118f-5406-4e59-b05c-ba307ca38d01 | +| `payload` | [Optional[shared.ConnectionWebhookPayload]](../../models/shared/connectionwebhookpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-commerce/docs/models/shared/connectionwebhookpayload.md b/sync-for-commerce/docs/models/shared/connectionwebhookpayload.md new file mode 100644 index 000000000..6e7a022e7 --- /dev/null +++ b/sync-for-commerce/docs/models/shared/connectionwebhookpayload.md @@ -0,0 +1,9 @@ +# ConnectionWebhookPayload + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | A connection represents a [company's](https://docs.codat.io/sync-for-sync-for-commerce-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source.

A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to:

- [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection.
- [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections.
- [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections.
Any combination of accounting, banking, and commerce data connections is allowed.

Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). | {
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
} | +| `reference_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-commerce/docs/models/shared/createcompany.md b/sync-for-commerce/docs/models/shared/createcompany.md index 0c60dccb6..4029d3c61 100644 --- a/sync-for-commerce/docs/models/shared/createcompany.md +++ b/sync-for-commerce/docs/models/shared/createcompany.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `name` | *str* | :heavy_check_mark: | Name of company being connected. | Bank of Dave | | `description` | *Optional[str]* | :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. | -| `groups` | List[[shared.GroupReference](../../models/shared/groupreference.md)] | :heavy_minus_sign: | Reference to the groups that the company is assigned to. | | \ No newline at end of file +| `tags` | Dict[str, *str*] | :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-commerce/docs/models/shared/groupreference.md b/sync-for-commerce/docs/models/shared/groupreference.md deleted file mode 100644 index 31666edf4..000000000 --- a/sync-for-commerce/docs/models/shared/groupreference.md +++ /dev/null @@ -1,8 +0,0 @@ -# GroupReference - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the group. | 60d2fa12-8a04-11ee-b9d1-0242ac120002 | \ No newline at end of file diff --git a/sync-for-commerce/docs/models/shared/tags.md b/sync-for-commerce/docs/models/shared/tags.md deleted file mode 100644 index 6de993aa8..000000000 --- a/sync-for-commerce/docs/models/shared/tags.md +++ /dev/null @@ -1,9 +0,0 @@ -# Tags - -A collection of user-defined key-value pairs that store custom metadata against the company. - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/sync-for-commerce/docs/sdks/advancedcontrols/README.md b/sync-for-commerce/docs/sdks/advancedcontrols/README.md index dc5690798..e64287815 100644 --- a/sync-for-commerce/docs/sdks/advancedcontrols/README.md +++ b/sync-for-commerce/docs/sdks/advancedcontrols/README.md @@ -22,25 +22,19 @@ Creates a Codat company from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.advanced_controls.create_company(request={ - "name": "string", - "description": "Requested early access to the new financing scheme.", - "groups": [ - { - "id": "60d2fa12-8a04-11ee-b9d1-0242ac120002", - }, - ], -}) - -if res is not None: - # handle response - pass +) as s: + res = s.advanced_controls.create_company(request={ + "name": "string", + "description": "Requested early access to the new financing scheme.", + }) + + if res is not None: + # handle response + pass ``` @@ -57,11 +51,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## get_configuration @@ -73,19 +66,18 @@ Returns a company's commerce sync configuration'. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.advanced_controls.get_configuration(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) -res = s.advanced_controls.get_configuration(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -102,11 +94,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## list_companies @@ -118,22 +109,21 @@ Returns a list of companies. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.advanced_controls.list_companies(request={ - "order_by": "-modifiedDate", - "page": 1, - "page_size": 100, - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.advanced_controls.list_companies(request={ + "order_by": "-modifiedDate", + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + if res is not None: + # handle response + pass ``` @@ -150,11 +140,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## set_configuration @@ -166,19 +155,18 @@ Sets a company's commerce sync configuration. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.advanced_controls.set_configuration(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", -}) +) as s: + res = s.advanced_controls.set_configuration(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -195,7 +183,7 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | +| Error Type | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-commerce/docs/sdks/codatsynccommerce/README.md b/sync-for-commerce/docs/sdks/codatsynccommerce/README.md index e8bb9ba08..dc0d5fcd3 100644 --- a/sync-for-commerce/docs/sdks/codatsynccommerce/README.md +++ b/sync-for-commerce/docs/sdks/codatsynccommerce/README.md @@ -22,4 +22,6 @@ Not seeing the endpoints you're expecting? We've [reorganized our products](http | Sync flow settings | Control text and visibility settings for the Sync Flow. | | Integrations | Get a list of integrations supported by Sync for Commerce and their logos. | | Advanced controls | View and manage mapping configured for a company's commerce sync. | - \ No newline at end of file + + +### Available Operations diff --git a/sync-for-commerce/docs/sdks/connections/README.md b/sync-for-commerce/docs/sdks/connections/README.md index 40a829af5..ebf341fc0 100644 --- a/sync-for-commerce/docs/sdks/connections/README.md +++ b/sync-for-commerce/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-sync-for-commerce-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 @@ -25,22 +25,21 @@ Use the [List Integrations](https://docs.codat.io/sync-for-sync-for-commerce-api from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.connections.create(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "request_body": { - "platform_key": "gbol", - }, -}) - -if res is not None: - # handle response - pass +) as s: + res = s.connections.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "request_body": { + "platform_key": "gbol", + }, + }) + + if res is not None: + # handle response + pass ``` @@ -57,11 +56,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## get_sync_flow_url @@ -73,20 +71,19 @@ Create a new company and connections. Get a URL for Sync Flow, including a one t from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.connections.get_sync_flow_url(request={ + "accounting_key": "", + "commerce_key": "", + }) -res = s.connections.get_sync_flow_url(request={ - "accounting_key": "", - "commerce_key": "", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -103,11 +100,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## list @@ -119,23 +115,22 @@ if res is not None: from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.connections.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "page": 1, - "page_size": 100, - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.connections.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "order_by": "-modifiedDate", + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + if res is not None: + # handle response + pass ``` @@ -152,11 +147,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## update_authorization @@ -168,20 +162,19 @@ Update data connection's authorization. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.connections.update_authorization(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", -}) +) as s: + res = s.connections.update_authorization(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -198,11 +191,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## update_connection @@ -214,20 +206,19 @@ Update a data connection from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.connections.update_connection(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", -}) +) as s: + res = s.connections.update_connection(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -244,7 +235,7 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-commerce/docs/sdks/integrations/README.md b/sync-for-commerce/docs/sdks/integrations/README.md index d3ec86068..39f2c8bcc 100644 --- a/sync-for-commerce/docs/sdks/integrations/README.md +++ b/sync-for-commerce/docs/sdks/integrations/README.md @@ -20,19 +20,18 @@ Retrieve Integration branding assets. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.integrations.get_branding(request={ + "platform_key": "gbol", + }) -res = s.integrations.get_branding(request={ - "platform_key": "gbol", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -49,11 +48,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## list @@ -65,22 +63,21 @@ Retrieve a list of available integrations support by data type and state of rele from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.integrations.list(request={ - "order_by": "-modifiedDate", - "page": 1, - "page_size": 100, - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.integrations.list(request={ + "order_by": "-modifiedDate", + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + if res is not None: + # handle response + pass ``` @@ -97,7 +94,7 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-commerce/docs/sdks/sync/README.md b/sync-for-commerce/docs/sdks/sync/README.md index 42e95b18e..3c4c89673 100644 --- a/sync-for-commerce/docs/sdks/sync/README.md +++ b/sync-for-commerce/docs/sdks/sync/README.md @@ -25,20 +25,19 @@ Get the sync status for a specified sync from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.sync.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "sync_id": "6fb40d5e-b13e-11ed-afa1-0242ac120002", + }) -res = s.sync.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "sync_id": "6fb40d5e-b13e-11ed-afa1-0242ac120002", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -55,11 +54,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## get_last_successful_sync @@ -71,19 +69,18 @@ Gets the status of the last successful sync from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.sync.get_last_successful_sync(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) -res = s.sync.get_last_successful_sync(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -100,11 +97,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## get_latest_sync @@ -116,19 +112,18 @@ Gets the latest sync status from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.sync.get_latest_sync(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) -res = s.sync.get_latest_sync(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -145,11 +140,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## get_status @@ -161,19 +155,18 @@ Gets a list of sync statuses. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync.get_status(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", -}) +) as s: + res = s.sync.get_status(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -190,11 +183,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## list @@ -206,19 +198,18 @@ Gets a list of sync statuses from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", -}) +) as s: + res = s.sync.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -235,11 +226,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## request @@ -251,22 +241,21 @@ Run a Commerce sync from the last successful sync up to the date provided (optio from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync.request(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "sync_to_latest_args": { - "sync_to": "2022-10-23T00:00:00Z", - }, -}) +) as s: + res = s.sync.request(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "sync_to_latest_args": { + "sync_to": "2022-10-23T00:00:00Z", + }, + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -283,11 +272,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## request_for_date_range @@ -299,25 +287,24 @@ Initiate a sync for the specified start date to the specified finish date in the from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync.request_for_date_range(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "sync_range": { - "date_range": { - "finish": "2022-10-23T00:00:00Z", - "start": "2022-10-23T00:00:00Z", +) as s: + res = s.sync.request_for_date_range(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "sync_range": { + "date_range": { + "finish": "2022-10-23T00:00:00Z", + "start": "2022-10-23T00:00:00Z", + }, }, - }, -}) + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -334,7 +321,7 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-commerce/docs/sdks/syncflowsettings/README.md b/sync-for-commerce/docs/sdks/syncflowsettings/README.md index 556b8def0..67cdab94c 100644 --- a/sync-for-commerce/docs/sdks/syncflowsettings/README.md +++ b/sync-for-commerce/docs/sdks/syncflowsettings/README.md @@ -22,19 +22,18 @@ Return preferences set for the text fields on sync flow. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.sync_flow_settings.get_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -res = s.sync_flow_settings.get_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -51,11 +50,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401,402,403,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 401, 402, 403, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## get_visible_accounts @@ -67,20 +65,19 @@ Return accounts which are visible on sync flow. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.sync_flow_settings.get_visible_accounts(request={ + "client_id": "86fe9741-738d-4f2c-8e96-9c3f84156e91", + "platform_key": "gbol", + }) -res = s.sync_flow_settings.get_visible_accounts(request={ - "client_id": "86fe9741-738d-4f2c-8e96-9c3f84156e91", - "platform_key": "gbol", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -97,11 +94,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## update_config_text_sync_flow @@ -113,19 +109,18 @@ Set preferences for the text fields on sync flow. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) +) as s: + res = s.sync_flow_settings.update_config_text_sync_flow(request={ + "locale": shared.Locale.EN_US, + }) -res = s.sync_flow_settings.update_config_text_sync_flow(request={ - "locale": shared.Locale.EN_US, -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -142,11 +137,10 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| errors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | ## update_visible_accounts_sync_flow @@ -158,19 +152,18 @@ Update which accounts are visible on sync flow. from codat_sync_for_commerce import CodatSyncCommerce from codat_sync_for_commerce.models import shared -s = CodatSyncCommerce( +with CodatSyncCommerce( security=shared.Security( auth_header="Basic BASE_64_ENCODED(API_KEY)", ), -) - -res = s.sync_flow_settings.update_visible_accounts_sync_flow(request={ - "platform_key": "gbol", -}) +) as s: + res = s.sync_flow_settings.update_visible_accounts_sync_flow(request={ + "platform_key": "gbol", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -187,7 +180,7 @@ if res is not None: ### Errors -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | -| errors.SDKError | 4xx-5xx | */* | +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-commerce/poetry.lock b/sync-for-commerce/poetry.lock index 9b22df1de..c49719c39 100644 --- a/sync-for-commerce/poetry.lock +++ b/sync-for-commerce/poetry.lock @@ -224,47 +224,53 @@ files = [ [[package]] name = "mypy" -version = "1.10.1" +version = "1.13.0" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e36f229acfe250dc660790840916eb49726c928e8ce10fbdf90715090fe4ae02"}, - {file = "mypy-1.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:51a46974340baaa4145363b9e051812a2446cf583dfaeba124af966fa44593f7"}, - {file = "mypy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:901c89c2d67bba57aaaca91ccdb659aa3a312de67f23b9dfb059727cce2e2e0a"}, - {file = "mypy-1.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0cd62192a4a32b77ceb31272d9e74d23cd88c8060c34d1d3622db3267679a5d9"}, - {file = "mypy-1.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:a2cbc68cb9e943ac0814c13e2452d2046c2f2b23ff0278e26599224cf164e78d"}, - {file = "mypy-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bd6f629b67bb43dc0d9211ee98b96d8dabc97b1ad38b9b25f5e4c4d7569a0c6a"}, - {file = "mypy-1.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a1bbb3a6f5ff319d2b9d40b4080d46cd639abe3516d5a62c070cf0114a457d84"}, - {file = "mypy-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8edd4e9bbbc9d7b79502eb9592cab808585516ae1bcc1446eb9122656c6066f"}, - {file = "mypy-1.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6166a88b15f1759f94a46fa474c7b1b05d134b1b61fca627dd7335454cc9aa6b"}, - {file = "mypy-1.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:5bb9cd11c01c8606a9d0b83ffa91d0b236a0e91bc4126d9ba9ce62906ada868e"}, - {file = "mypy-1.10.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d8681909f7b44d0b7b86e653ca152d6dff0eb5eb41694e163c6092124f8246d7"}, - {file = "mypy-1.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:378c03f53f10bbdd55ca94e46ec3ba255279706a6aacaecac52ad248f98205d3"}, - {file = "mypy-1.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bacf8f3a3d7d849f40ca6caea5c055122efe70e81480c8328ad29c55c69e93e"}, - {file = "mypy-1.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:701b5f71413f1e9855566a34d6e9d12624e9e0a8818a5704d74d6b0402e66c04"}, - {file = "mypy-1.10.1-cp312-cp312-win_amd64.whl", hash = "sha256:3c4c2992f6ea46ff7fce0072642cfb62af7a2484efe69017ed8b095f7b39ef31"}, - {file = "mypy-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:604282c886497645ffb87b8f35a57ec773a4a2721161e709a4422c1636ddde5c"}, - {file = "mypy-1.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37fd87cab83f09842653f08de066ee68f1182b9b5282e4634cdb4b407266bade"}, - {file = "mypy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8addf6313777dbb92e9564c5d32ec122bf2c6c39d683ea64de6a1fd98b90fe37"}, - {file = "mypy-1.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cc3ca0a244eb9a5249c7c583ad9a7e881aa5d7b73c35652296ddcdb33b2b9c7"}, - {file = "mypy-1.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:1b3a2ffce52cc4dbaeee4df762f20a2905aa171ef157b82192f2e2f368eec05d"}, - {file = "mypy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:fe85ed6836165d52ae8b88f99527d3d1b2362e0cb90b005409b8bed90e9059b3"}, - {file = "mypy-1.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c2ae450d60d7d020d67ab440c6e3fae375809988119817214440033f26ddf7bf"}, - {file = "mypy-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6be84c06e6abd72f960ba9a71561c14137a583093ffcf9bbfaf5e613d63fa531"}, - {file = "mypy-1.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:2189ff1e39db399f08205e22a797383613ce1cb0cb3b13d8bcf0170e45b96cc3"}, - {file = "mypy-1.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:97a131ee36ac37ce9581f4220311247ab6cba896b4395b9c87af0675a13a755f"}, - {file = "mypy-1.10.1-py3-none-any.whl", hash = "sha256:71d8ac0b906354ebda8ef1673e5fde785936ac1f29ff6987c7483cfbd5a4235a"}, - {file = "mypy-1.10.1.tar.gz", hash = "sha256:1f8f492d7db9e3593ef42d4f115f04e556130f2819ad33ab84551403e97dd4c0"}, + {file = "mypy-1.13.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a"}, + {file = "mypy-1.13.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80"}, + {file = "mypy-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7"}, + {file = "mypy-1.13.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f"}, + {file = "mypy-1.13.0-cp310-cp310-win_amd64.whl", hash = "sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d"}, + {file = "mypy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b"}, + {file = "mypy-1.13.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73"}, + {file = "mypy-1.13.0-cp311-cp311-win_amd64.whl", hash = "sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e"}, + {file = "mypy-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2"}, + {file = "mypy-1.13.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0"}, + {file = "mypy-1.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62"}, + {file = "mypy-1.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8"}, + {file = "mypy-1.13.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7"}, + {file = "mypy-1.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc"}, + {file = "mypy-1.13.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:100fac22ce82925f676a734af0db922ecfea991e1d7ec0ceb1e115ebe501301a"}, + {file = "mypy-1.13.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7bcb0bb7f42a978bb323a7c88f1081d1b5dee77ca86f4100735a6f541299d8fb"}, + {file = "mypy-1.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bde31fc887c213e223bbfc34328070996061b0833b0a4cfec53745ed61f3519b"}, + {file = "mypy-1.13.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:07de989f89786f62b937851295ed62e51774722e5444a27cecca993fc3f9cd74"}, + {file = "mypy-1.13.0-cp38-cp38-win_amd64.whl", hash = "sha256:4bde84334fbe19bad704b3f5b78c4abd35ff1026f8ba72b29de70dda0916beb6"}, + {file = "mypy-1.13.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc"}, + {file = "mypy-1.13.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732"}, + {file = "mypy-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc"}, + {file = "mypy-1.13.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d"}, + {file = "mypy-1.13.0-cp39-cp39-win_amd64.whl", hash = "sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24"}, + {file = "mypy-1.13.0-py3-none-any.whl", hash = "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a"}, + {file = "mypy-1.13.0.tar.gz", hash = "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e"}, ] [package.dependencies] mypy-extensions = ">=1.0.0" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = ">=4.1.0" +typing-extensions = ">=4.6.0" [package.extras] dmypy = ["psutil (>=4.0)"] +faster-cache = ["orjson"] install-types = ["pip"] mypyc = ["setuptools (>=50)"] reports = ["lxml"] @@ -548,4 +554,4 @@ typing-extensions = ">=3.7.4" [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "6bb5f77afb8fcbe7327ccd1fcc33f5c279c6a2582d43be73b69c2a94b836b85d" +content-hash = "634a1e2581f680cde0149401ee60f1a571cfb482ce541acd8d0fa9a558cadf9d" diff --git a/sync-for-commerce/pyproject.toml b/sync-for-commerce/pyproject.toml index a3070b877..4eebac562 100644 --- a/sync-for-commerce/pyproject.toml +++ b/sync-for-commerce/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "codat-sync-for-commerce" -version = "5.0.0" -description = "Push merchants' data from your ecommerce or point-of-sale (POS) platform into your merchants' accounting platform." +version = "6.0.0" +description = "Push merchants' data from your ecommerce or point-of-sale (POS) platform into your merchants' accounting software." authors = ["Speakeasy",] readme = "README-PYPI.md" repository = "https://github.com/codatio/client-sdk-python.git" @@ -21,12 +21,12 @@ python = "^3.8" eval-type-backport = "^0.2.0" httpx = "^0.27.0" jsonpath-python = "^1.0.6" -pydantic = "~2.9.0" -python-dateutil = "2.8.2" +pydantic = "~2.9.2" +python-dateutil = "^2.8.2" typing-inspect = "^0.9.0" [tool.poetry.group.dev.dependencies] -mypy = "==1.10.1" +mypy = "==1.13.0" pylint = "==3.2.3" types-python-dateutil = "^2.9.0.20240316" diff --git a/sync-for-commerce/scripts/compile.sh b/sync-for-commerce/scripts/compile.sh deleted file mode 100755 index fafe635b2..000000000 --- a/sync-for-commerce/scripts/compile.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail # Ensure pipeline failures are propagated - -# Use temporary files to store outputs and exit statuses -declare -A output_files -declare -A status_files - -# Function to run a command with temporary output and status files -run_command() { - local cmd="$1" - local key="$2" - local output_file="$3" - local status_file="$4" - - # Run the command and store output and exit status - { - eval "$cmd" - echo $? > "$status_file" - } &> "$output_file" & -} - -poetry run python scripts/prepare-readme.py - -# Create temporary files for outputs and statuses -for cmd in compileall pylint mypy pyright; do - output_files[$cmd]=$(mktemp) - status_files[$cmd]=$(mktemp) -done - -# Collect PIDs for background processes -declare -a pids - -# Run commands in parallel using temporary files -echo "Running python -m compileall" -run_command 'poetry run python -m compileall -q . && echo "Success"' 'compileall' "${output_files[compileall]}" "${status_files[compileall]}" -pids+=($!) - -echo "Running pylint" -run_command 'poetry run pylint src' 'pylint' "${output_files[pylint]}" "${status_files[pylint]}" -pids+=($!) - -echo "Running mypy" -run_command 'poetry run mypy src' 'mypy' "${output_files[mypy]}" "${status_files[mypy]}" -pids+=($!) - -echo "Running pyright (optional)" -run_command 'if command -v pyright > /dev/null 2>&1; then pyright src; else echo "pyright not found, skipping"; fi' 'pyright' "${output_files[pyright]}" "${status_files[pyright]}" -pids+=($!) - -# Wait for all processes to complete -echo "Waiting for processes to complete" -for pid in "${pids[@]}"; do - wait "$pid" -done - -# Print output sequentially and check for failures -failed=false -for key in "${!output_files[@]}"; do - echo "--- Output from Command: $key ---" - echo - cat "${output_files[$key]}" - echo # Empty line for separation - echo "--- End of Output from Command: $key ---" - echo - - exit_status=$(cat "${status_files[$key]}") - if [ "$exit_status" -ne 0 ]; then - echo "Command $key failed with exit status $exit_status" >&2 - failed=true - fi -done - -# Clean up temporary files -for tmp_file in "${output_files[@]}" "${status_files[@]}"; do - rm -f "$tmp_file" -done - -if $failed; then - echo "One or more commands failed." >&2 - exit 1 -else - echo "All commands completed successfully." - exit 0 -fi diff --git a/sync-for-commerce/src/codat_sync_for_commerce/__init__.py b/sync-for-commerce/src/codat_sync_for_commerce/__init__.py index d8d60c471..5c3491793 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/__init__.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/__init__.py @@ -1,4 +1,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from ._version import __title__, __version__ from .sdk import * from .sdkconfiguration import * + + +VERSION: str = __version__ diff --git a/sync-for-commerce/src/codat_sync_for_commerce/_version.py b/sync-for-commerce/src/codat_sync_for_commerce/_version.py new file mode 100644 index 000000000..b2c003a53 --- /dev/null +++ b/sync-for-commerce/src/codat_sync_for_commerce/_version.py @@ -0,0 +1,12 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import importlib.metadata + +__title__: str = "codat-sync-for-commerce" +__version__: str = "6.0.0" + +try: + if __package__ is not None: + __version__ = importlib.metadata.version(__package__) +except importlib.metadata.PackageNotFoundError: + pass diff --git a/sync-for-commerce/src/codat_sync_for_commerce/advanced_controls.py b/sync-for-commerce/src/codat_sync_for_commerce/advanced_controls.py index 99c27a75b..7f90f43df 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/advanced_controls.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/advanced_controls.py @@ -38,9 +38,9 @@ def create_company( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel) and request is not None: - request = utils.unmarshal(request, shared.CreateCompany) - request = cast(shared.CreateCompany, request) + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, Optional[shared.CreateCompany]) + request = cast(Optional[shared.CreateCompany], request) req = self.build_request( method="POST", @@ -104,15 +104,17 @@ def create_company( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -143,9 +145,9 @@ async def create_company_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel) and request is not None: - request = utils.unmarshal(request, shared.CreateCompany) - request = cast(shared.CreateCompany, request) + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, Optional[shared.CreateCompany]) + request = cast(Optional[shared.CreateCompany], request) req = self.build_request_async( method="POST", @@ -209,15 +211,17 @@ async def create_company_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -312,15 +316,17 @@ def get_configuration( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -415,15 +421,17 @@ async def get_configuration_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -432,7 +440,7 @@ def list_companies( *, request: Union[ operations.ListCompaniesRequest, operations.ListCompaniesRequestTypedDict - ], + ] = operations.ListCompaniesRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -518,15 +526,17 @@ def list_companies( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -535,7 +545,7 @@ async def list_companies_async( *, request: Union[ operations.ListCompaniesRequest, operations.ListCompaniesRequestTypedDict - ], + ] = operations.ListCompaniesRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -621,15 +631,17 @@ async def list_companies_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -726,15 +738,17 @@ def set_configuration( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -831,14 +845,16 @@ async def set_configuration_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) diff --git a/sync-for-commerce/src/codat_sync_for_commerce/connections.py b/sync-for-commerce/src/codat_sync_for_commerce/connections.py index aee093035..c442cec16 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/connections.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/connections.py @@ -26,7 +26,7 @@ def create( Creates a connection for the company by providing a valid `platformKey`. - Use the [List Integrations](https://docs.codat.io/sync-for-sync-for-commerce-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 to send. :param retries: Override the default retry configuration for this method @@ -111,15 +111,17 @@ def create( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -138,7 +140,7 @@ async def create_async( Creates a connection for the company by providing a valid `platformKey`. - Use the [List Integrations](https://docs.codat.io/sync-for-sync-for-commerce-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 to send. :param retries: Override the default retry configuration for this method @@ -223,15 +225,17 @@ async def create_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -326,15 +330,17 @@ def get_sync_flow_url( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -429,15 +435,17 @@ async def get_sync_flow_url_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -533,15 +541,17 @@ def list( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -637,15 +647,17 @@ async def list_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -745,15 +757,17 @@ def update_authorization( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -853,15 +867,17 @@ async def update_authorization_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -963,15 +979,17 @@ def update_connection( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -1073,14 +1091,16 @@ async def update_connection_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) diff --git a/sync-for-commerce/src/codat_sync_for_commerce/httpclient.py b/sync-for-commerce/src/codat_sync_for_commerce/httpclient.py index 36b642a0e..167cea4ef 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/httpclient.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/httpclient.py @@ -41,6 +41,9 @@ def build_request( ) -> httpx.Request: pass + def close(self) -> None: + pass + @runtime_checkable class AsyncHttpClient(Protocol): @@ -76,3 +79,6 @@ def build_request( extensions: Optional[httpx._types.RequestExtensions] = None, ) -> httpx.Request: pass + + async def aclose(self) -> None: + pass diff --git a/sync-for-commerce/src/codat_sync_for_commerce/integrations.py b/sync-for-commerce/src/codat_sync_for_commerce/integrations.py index b39fa9d91..7ef36a75c 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/integrations.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/integrations.py @@ -102,15 +102,17 @@ def get_branding( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -205,15 +207,17 @@ async def get_branding_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -223,7 +227,7 @@ def list( request: Union[ operations.ListIntegrationsRequest, operations.ListIntegrationsRequestTypedDict, - ], + ] = operations.ListIntegrationsRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -308,15 +312,17 @@ def list( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -326,7 +332,7 @@ async def list_async( request: Union[ operations.ListIntegrationsRequest, operations.ListIntegrationsRequestTypedDict, - ], + ] = operations.ListIntegrationsRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -411,14 +417,16 @@ async def list_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/errors/errormessage.py b/sync-for-commerce/src/codat_sync_for_commerce/models/errors/errormessage.py index ba9d76eb8..acda9a267 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/errors/errormessage.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/errors/errormessage.py @@ -41,7 +41,7 @@ class ErrorMessageData(BaseModel): class ErrorMessage(Exception): - r"""Your `query` parameter was not correctly formed""" + r"""Your API request was not properly authorized.""" data: ErrorMessageData diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/create_connection.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/create_connection.py index c53863ed2..5e5a4d1b1 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/create_connection.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/create_connection.py @@ -8,8 +8,8 @@ RequestMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class CreateConnectionRequestBodyTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_config_text_sync_flow.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_config_text_sync_flow.py index 955ef3c15..2360ad606 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_config_text_sync_flow.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_config_text_sync_flow.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.models.shared import locale as shared_locale from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, QueryParamMetadata -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetConfigTextSyncFlowRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_configuration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_configuration.py index db2650e28..38500bc19 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_configuration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_configuration.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetConfigurationRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_integration_branding.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_integration_branding.py index a9c09e1ca..767ab814b 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_integration_branding.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_integration_branding.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetIntegrationBrandingRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_last_successful_sync.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_last_successful_sync.py index 4808a550d..0b4c57be2 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_last_successful_sync.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_last_successful_sync.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetLastSuccessfulSyncRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_latest_sync.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_latest_sync.py index 629925b08..ad815166c 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_latest_sync.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_latest_sync.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetLatestSyncRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_by_id.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_by_id.py index 40203344b..a7aa1e53d 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_by_id.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_by_id.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetSyncByIDRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_flow_url.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_flow_url.py index 4f8a0d886..4fafa0809 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_flow_url.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_flow_url.py @@ -8,8 +8,8 @@ QueryParamMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class GetSyncFlowURLRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_status.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_status.py index b41bc7a93..532c72221 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_status.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_sync_status.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetSyncStatusRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_visible_accounts.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_visible_accounts.py index 659f307ad..c6abc70a3 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_visible_accounts.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/get_visible_accounts.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class GetVisibleAccountsRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_companies.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_companies.py index 657eb1f99..27c3eb07c 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_companies.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_companies.py @@ -4,8 +4,8 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, QueryParamMetadata import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ListCompaniesRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_connections.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_connections.py index b8906b44c..d23cde728 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_connections.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_connections.py @@ -8,8 +8,8 @@ QueryParamMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ListConnectionsRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_integrations.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_integrations.py index f91c1f1b0..ef17955c5 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_integrations.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_integrations.py @@ -4,8 +4,8 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, QueryParamMetadata import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ListIntegrationsRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_syncs.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_syncs.py index 34e631769..25dd506a2 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_syncs.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/list_syncs.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class ListSyncsRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync.py index 19ac02650..c5d693c00 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync.py @@ -11,8 +11,8 @@ RequestMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class RequestSyncRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync_for_date_range.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync_for_date_range.py index b638ba125..226aa2f45 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync_for_date_range.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/request_sync_for_date_range.py @@ -9,8 +9,8 @@ RequestMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class RequestSyncForDateRangeRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/set_configuration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/set_configuration.py index afb01c7f2..34011c771 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/set_configuration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/set_configuration.py @@ -4,8 +4,7 @@ from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, PathParamMetadata import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class SetConfigurationRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_config_text_sync_flow.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_config_text_sync_flow.py index f2209f78e..b31e70685 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_config_text_sync_flow.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_config_text_sync_flow.py @@ -11,8 +11,8 @@ QueryParamMetadata, RequestMetadata, ) -from typing import Dict, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class UpdateConfigTextSyncFlowRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection.py index 1d7e0625d..133330489 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection.py @@ -11,8 +11,8 @@ RequestMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class UpdateConnectionRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection_authorization.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection_authorization.py index e3cc8f589..c68272782 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection_authorization.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_connection_authorization.py @@ -8,8 +8,8 @@ RequestMetadata, ) import pydantic -from typing import Dict, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class UpdateConnectionAuthorizationRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_visible_accounts_sync_flow.py b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_visible_accounts_sync_flow.py index 23cc1f650..3cfc7158b 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_visible_accounts_sync_flow.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/operations/update_visible_accounts_sync_flow.py @@ -11,8 +11,8 @@ RequestMetadata, ) import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class UpdateVisibleAccountsSyncFlowRequestTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/__init__.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/__init__.py index 4e9cc8b48..502024fd2 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/__init__.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/__init__.py @@ -11,7 +11,13 @@ from .brandinglogo import BrandingLogo, BrandingLogoTypedDict from .commerceconfiguration import CommerceConfiguration, CommerceConfigurationTypedDict from .companies import Companies, CompaniesTypedDict -from .company import Company, CompanyTypedDict, Tags, TagsTypedDict +from .company import Company, CompanyTypedDict +from .companyreference import ( + CompanyReference, + CompanyReferenceLinks, + CompanyReferenceLinksTypedDict, + CompanyReferenceTypedDict, +) from .companysyncstatus import CompanySyncStatus, CompanySyncStatusTypedDict from .configuration import Configuration, ConfigurationTypedDict from .configurationmapsettings import ( @@ -22,12 +28,12 @@ from .configurationoption import ConfigurationOption, ConfigurationOptionTypedDict from .connection import Connection, ConnectionTypedDict from .connections import Connections, ConnectionsTypedDict -from .createcompany import ( - CreateCompany, - CreateCompanyTypedDict, - GroupReference, - GroupReferenceTypedDict, +from .connectionwebhook import ConnectionWebhook, ConnectionWebhookTypedDict +from .connectionwebhookpayload import ( + ConnectionWebhookPayload, + ConnectionWebhookPayloadTypedDict, ) +from .createcompany import CreateCompany, CreateCompanyTypedDict from .dataconnectionerror import ( DataConnectionError, DataConnectionErrorTypedDict, @@ -107,6 +113,10 @@ "Companies", "CompaniesTypedDict", "Company", + "CompanyReference", + "CompanyReferenceLinks", + "CompanyReferenceLinksTypedDict", + "CompanyReferenceTypedDict", "CompanySyncStatus", "CompanySyncStatusTypedDict", "CompanyTypedDict", @@ -118,6 +128,10 @@ "ConfigurationTypedDict", "Connection", "ConnectionTypedDict", + "ConnectionWebhook", + "ConnectionWebhookPayload", + "ConnectionWebhookPayloadTypedDict", + "ConnectionWebhookTypedDict", "Connections", "ConnectionsTypedDict", "CreateCompany", @@ -141,8 +155,6 @@ "FeesConfigurationTypedDict", "FeesSupplier", "FeesSupplierTypedDict", - "GroupReference", - "GroupReferenceTypedDict", "Grouping", "GroupingLevels", "GroupingLevelsTypedDict", @@ -201,8 +213,6 @@ "SyncSummaryTypedDict", "SyncToLatestArgs", "SyncToLatestArgsTypedDict", - "Tags", - "TagsTypedDict", "TaxRateAmount", "TaxRateAmountTypedDict", "TaxRateMapping", diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfiguration.py index 3bdbe95df..aea37f848 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfiguration.py @@ -14,8 +14,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class AccountConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfigurationoption.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfigurationoption.py index d4130daa9..7ea938ca5 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfigurationoption.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/accountconfigurationoption.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class AccountConfigurationOptionTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/branding.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/branding.py index 46e90f88b..31efe3381 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/branding.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/branding.py @@ -5,8 +5,8 @@ from .brandinglogo import BrandingLogo, BrandingLogoTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class BrandingTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingbutton.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingbutton.py index 492502ec4..77d6a968a 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingbutton.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingbutton.py @@ -3,8 +3,8 @@ from __future__ import annotations from .brandingimage import BrandingImage, BrandingImageTypedDict from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class BrandingButtonTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingimage.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingimage.py index 41ca72eb9..976365759 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingimage.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandingimage.py @@ -3,8 +3,8 @@ from __future__ import annotations from .imagereference import ImageReference, ImageReferenceTypedDict from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class BrandingImageTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandinglogo.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandinglogo.py index 57721968b..8088288c3 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandinglogo.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/brandinglogo.py @@ -3,8 +3,8 @@ from __future__ import annotations from .brandingimage import BrandingImage, BrandingImageTypedDict from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class BrandingLogoTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/commerceconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/commerceconfiguration.py index 7104df11c..dacefd917 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/commerceconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/commerceconfiguration.py @@ -14,8 +14,8 @@ from .salesconfiguration import SalesConfiguration, SalesConfigurationTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class CommerceConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companies.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companies.py index e9724dafa..254110b5e 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companies.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companies.py @@ -5,8 +5,8 @@ from .links import Links, LinksTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class CompaniesTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/company.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/company.py index e13dcb73f..a21def520 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/company.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/company.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .companyreference import CompanyReference, CompanyReferenceTypedDict from .connection import Connection, ConnectionTypedDict from codat_sync_for_commerce.types import ( BaseModel, @@ -11,16 +12,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired - - -class TagsTypedDict(TypedDict): - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" - - -class Tags(BaseModel): - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" +from typing import Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class CompanyTypedDict(TypedDict): @@ -86,7 +79,10 @@ class CompanyTypedDict(TypedDict): """ products: NotRequired[List[str]] r"""An array of products that are currently enabled for the company.""" - tags: NotRequired[TagsTypedDict] + reference_parent_company: NotRequired[CompanyReferenceTypedDict] + reference_subsidiary_companies: NotRequired[List[CompanyReferenceTypedDict]] + r"""A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children.""" + tags: NotRequired[Dict[str, str]] r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" @@ -166,7 +162,17 @@ class Company(BaseModel): products: Optional[List[str]] = None r"""An array of products that are currently enabled for the company.""" - tags: Optional[Tags] = None + reference_parent_company: Annotated[ + Optional[CompanyReference], pydantic.Field(alias="referenceParentCompany") + ] = None + + reference_subsidiary_companies: Annotated[ + Optional[List[CompanyReference]], + pydantic.Field(alias="referenceSubsidiaryCompanies"), + ] = None + r"""A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children.""" + + tags: Optional[Dict[str, str]] = None r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" @model_serializer(mode="wrap") @@ -178,6 +184,8 @@ def serialize_model(self, handler): "description", "lastSync", "products", + "referenceParentCompany", + "referenceSubsidiaryCompanies", "tags", ] nullable_fields = ["createdByUserName"] diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companyreference.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companyreference.py new file mode 100644 index 000000000..45d17c883 --- /dev/null +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companyreference.py @@ -0,0 +1,50 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_commerce.types import BaseModel +from typing import Dict, Optional +from typing_extensions import NotRequired, TypedDict + + +class CompanyReferenceLinksTypedDict(TypedDict): + r"""A collection of links for the company.""" + + portal: NotRequired[str] + r"""Link to the company page in the portal.""" + + +class CompanyReferenceLinks(BaseModel): + r"""A collection of links for the company.""" + + portal: Optional[str] = None + r"""Link to the company page in the portal.""" + + +class CompanyReferenceTypedDict(TypedDict): + description: NotRequired[str] + r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + id: NotRequired[str] + r"""Unique identifier for your SMB in Codat.""" + links: NotRequired[CompanyReferenceLinksTypedDict] + r"""A collection of links for the company.""" + name: NotRequired[str] + r"""The name of the company""" + tags: NotRequired[Dict[str, str]] + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + + +class CompanyReference(BaseModel): + description: Optional[str] = None + r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + + id: Optional[str] = None + r"""Unique identifier for your SMB in Codat.""" + + links: Optional[CompanyReferenceLinks] = None + r"""A collection of links for the company.""" + + name: Optional[str] = None + r"""The name of the company""" + + tags: Optional[Dict[str, str]] = None + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companysyncstatus.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companysyncstatus.py index 178091fd9..e03205523 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companysyncstatus.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/companysyncstatus.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class CompanySyncStatusTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configuration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configuration.py index 9d3c10a61..cad7d654b 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configuration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configuration.py @@ -5,8 +5,8 @@ from .syncschedule import SyncSchedule, SyncScheduleTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Any, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Any, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationmapsettings.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationmapsettings.py index d97140640..18b7b9b08 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationmapsettings.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationmapsettings.py @@ -4,8 +4,8 @@ from codat_sync_for_commerce.types import BaseModel from enum import Enum import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class OutputFormat(str, Enum): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationoption.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationoption.py index 57a01f66c..605f390cb 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationoption.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/configurationoption.py @@ -9,8 +9,8 @@ UNSET_SENTINEL, ) from pydantic import model_serializer -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class ConfigurationOptionTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connection.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connection.py index 9af1a3bf1..00d9e558e 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connection.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connection.py @@ -4,10 +4,17 @@ from .dataconnectionerror import DataConnectionError, DataConnectionErrorTypedDict from .dataconnectionstatus import DataConnectionStatus from .sourcetype import SourceType -from codat_sync_for_commerce.types import BaseModel +from codat_sync_for_commerce.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) import pydantic -from typing import Any, Dict, List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from pydantic import model_serializer +from typing import Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ConnectionTypedDict(TypedDict): @@ -60,9 +67,8 @@ class ConnectionTypedDict(TypedDict): r"""The type of platform of the connection.""" status: DataConnectionStatus r"""The current authorization status of the data connection.""" - additional_properties: NotRequired[Any] - connection_info: NotRequired[Dict[str, str]] - data_connection_errors: NotRequired[List[DataConnectionErrorTypedDict]] + connection_info: NotRequired[Nullable[Dict[str, str]]] + data_connection_errors: NotRequired[Nullable[List[DataConnectionErrorTypedDict]]] last_sync: NotRequired[str] r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: @@ -145,18 +151,14 @@ class Connection(BaseModel): status: DataConnectionStatus r"""The current authorization status of the data connection.""" - additional_properties: Annotated[ - Optional[Any], pydantic.Field(alias="additionalProperties") - ] = None - connection_info: Annotated[ - Optional[Dict[str, str]], pydantic.Field(alias="connectionInfo") - ] = None + OptionalNullable[Dict[str, str]], pydantic.Field(alias="connectionInfo") + ] = UNSET data_connection_errors: Annotated[ - Optional[List[DataConnectionError]], + OptionalNullable[List[DataConnectionError]], pydantic.Field(alias="dataConnectionErrors"), - ] = None + ] = UNSET last_sync: Annotated[Optional[str], pydantic.Field(alias="lastSync")] = None r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: @@ -179,3 +181,33 @@ class Connection(BaseModel): > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["connectionInfo", "dataConnectionErrors", "lastSync"] + nullable_fields = ["connectionInfo", "dataConnectionErrors"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connections.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connections.py index 1e3102364..7b09cd003 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connections.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connections.py @@ -5,8 +5,8 @@ from .links import Links, LinksTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ConnectionsTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connectionwebhook.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connectionwebhook.py new file mode 100644 index 000000000..909fa6670 --- /dev/null +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connectionwebhook.py @@ -0,0 +1,74 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .connectionwebhookpayload import ( + ConnectionWebhookPayload, + ConnectionWebhookPayloadTypedDict, +) +from codat_sync_for_commerce.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ConnectionWebhookTypedDict(TypedDict): + event_type: NotRequired[str] + r"""The type of event.""" + generated_date: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + id: NotRequired[str] + r"""Unique identifier of the event.""" + payload: NotRequired[ConnectionWebhookPayloadTypedDict] + + +class ConnectionWebhook(BaseModel): + event_type: Annotated[Optional[str], pydantic.Field(alias="eventType")] = None + r"""The type of event.""" + + generated_date: Annotated[Optional[str], pydantic.Field(alias="generatedDate")] = ( + None + ) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + id: Optional[str] = None + r"""Unique identifier of the event.""" + + payload: Optional[ConnectionWebhookPayload] = None diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connectionwebhookpayload.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connectionwebhookpayload.py new file mode 100644 index 000000000..86fb5007d --- /dev/null +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/connectionwebhookpayload.py @@ -0,0 +1,44 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .companyreference import CompanyReference, CompanyReferenceTypedDict +from .connection import Connection, ConnectionTypedDict +from codat_sync_for_commerce.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ConnectionWebhookPayloadTypedDict(TypedDict): + connection: NotRequired[ConnectionTypedDict] + r"""A connection represents a [company's](https://docs.codat.io/sync-for-sync-for-commerce-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. + + A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: + + - [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection. + - [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections. + - [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections. + Any combination of accounting, banking, and commerce data connections is allowed. + + Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). + """ + reference_company: NotRequired[CompanyReferenceTypedDict] + + +class ConnectionWebhookPayload(BaseModel): + connection: Optional[Connection] = None + r"""A connection represents a [company's](https://docs.codat.io/sync-for-sync-for-commerce-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. + + A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: + + - [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection. + - [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections. + - [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections. + Any combination of accounting, banking, and commerce data connections is allowed. + + Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). + """ + + reference_company: Annotated[ + Optional[CompanyReference], pydantic.Field(alias="referenceCompany") + ] = None diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/createcompany.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/createcompany.py index 5233c74a7..2a88a6717 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/createcompany.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/createcompany.py @@ -2,18 +2,8 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel -from typing import List, Optional, TypedDict -from typing_extensions import NotRequired - - -class GroupReferenceTypedDict(TypedDict): - id: NotRequired[str] - r"""Unique identifier for the group.""" - - -class GroupReference(BaseModel): - id: Optional[str] = None - r"""Unique identifier for the group.""" +from typing import Dict, Optional +from typing_extensions import NotRequired, TypedDict class CreateCompanyTypedDict(TypedDict): @@ -21,8 +11,8 @@ class CreateCompanyTypedDict(TypedDict): r"""Name of company being connected.""" description: NotRequired[str] r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" - groups: NotRequired[List[GroupReferenceTypedDict]] - r"""Reference to the groups that the company is assigned to.""" + tags: NotRequired[Dict[str, str]] + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" class CreateCompany(BaseModel): @@ -32,5 +22,5 @@ class CreateCompany(BaseModel): description: Optional[str] = None r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" - groups: Optional[List[GroupReference]] = None - r"""Reference to the groups that the company is assigned to.""" + tags: Optional[Dict[str, str]] = None + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/dataconnectionerror.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/dataconnectionerror.py index 412b0e143..da80c16ac 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/dataconnectionerror.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/dataconnectionerror.py @@ -11,8 +11,8 @@ from enum import Enum import pydantic from pydantic import model_serializer -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class ErrorStatus(str, Enum): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/datatypefeature.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/datatypefeature.py index 3c531a772..00a3f81ea 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/datatypefeature.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/datatypefeature.py @@ -5,8 +5,8 @@ from codat_sync_for_commerce.types import BaseModel from enum import Enum import pydantic -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class DataTypes(str, Enum): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidation.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidation.py index d5aa4b19c..f5594e94e 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidation.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidation.py @@ -10,8 +10,8 @@ UNSET_SENTINEL, ) from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import NotRequired +from typing import List +from typing_extensions import NotRequired, TypedDict class ErrorValidationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidationitem.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidationitem.py index 46c6e6954..2b05155b5 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidationitem.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/errorvalidationitem.py @@ -10,8 +10,7 @@ ) import pydantic from pydantic import model_serializer -from typing import TypedDict -from typing_extensions import Annotated, NotRequired +from typing_extensions import Annotated, NotRequired, TypedDict class ErrorValidationItemTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feesconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feesconfiguration.py index 33ad672a4..b32c66609 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feesconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feesconfiguration.py @@ -12,8 +12,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Dict, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class FeesConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feessupplier.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feessupplier.py index 0a4afdb03..c9950978e 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feessupplier.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/feessupplier.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class FeesSupplierTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/grouping.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/grouping.py index 64cf87646..c1799e11a 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/grouping.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/grouping.py @@ -5,8 +5,8 @@ from .groupingperiod import GroupingPeriod, GroupingPeriodTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class GroupingTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupinglevels.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupinglevels.py index 83755e62c..87b534bc4 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupinglevels.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupinglevels.py @@ -8,8 +8,8 @@ ) from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class GroupingLevelsTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupingperiod.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupingperiod.py index 6b6633822..51f5f404c 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupingperiod.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/groupingperiod.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class GroupingPeriodTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/halref.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/halref.py index 12292239e..6b6dc3d39 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/halref.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/halref.py @@ -2,8 +2,8 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class HalRefTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/imagereference.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/imagereference.py index 22b54846a..339e94cb6 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/imagereference.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/imagereference.py @@ -2,8 +2,8 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class ImageReferenceTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integration.py index cff76e4da..578ca2fc6 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integration.py @@ -5,8 +5,8 @@ from .sourcetype import SourceType from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class IntegrationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integrations.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integrations.py index 24afd5466..819cbcd6f 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integrations.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/integrations.py @@ -5,8 +5,8 @@ from .links import Links, LinksTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class IntegrationsTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelevelselection.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelevelselection.py index 4b7d039b4..1b53fbcdd 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelevelselection.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelevelselection.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class InvoiceLevelSelectionTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelinelevelselection.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelinelevelselection.py index 162279f44..332408cd7 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelinelevelselection.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicelinelevelselection.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class InvoiceLineLevelSelectionTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicestatus.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicestatus.py index 90db1bce2..c4149a0af 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicestatus.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/invoicestatus.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class InvoiceStatusTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/links.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/links.py index fefb8b710..f8a2f6964 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/links.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/links.py @@ -4,8 +4,8 @@ from .halref import HalRef, HalRefTypedDict from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class LinksTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/localization.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/localization.py index 748b2cdbd..291395753 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/localization.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/localization.py @@ -9,8 +9,8 @@ UNSET_SENTINEL, ) from pydantic import model_serializer -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class LocalizationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newpaymentsconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newpaymentsconfiguration.py index d65613f0d..e59a3f342 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newpaymentsconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newpaymentsconfiguration.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Dict, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class NewPaymentsConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newtaxrates.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newtaxrates.py index d1aebb8f6..81b311008 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newtaxrates.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/newtaxrates.py @@ -12,8 +12,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class NewTaxRatesTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/paymentsconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/paymentsconfiguration.py index baf993d1a..c6bd20f20 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/paymentsconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/paymentsconfiguration.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Dict, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class PaymentsConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salesconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salesconfiguration.py index 000b87998..1630cc998 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salesconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salesconfiguration.py @@ -16,8 +16,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Dict, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SalesConfigurationTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salescustomer.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salescustomer.py index fa4991902..a7dbc2ce6 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salescustomer.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/salescustomer.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class SalesCustomerTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/security.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/security.py index e73644fa6..3cb638b6c 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/security.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/security.py @@ -3,8 +3,7 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel from codat_sync_for_commerce.utils import FieldMetadata, SecurityMetadata -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class SecurityTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/supportedfeature.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/supportedfeature.py index 79402db9a..965d26598 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/supportedfeature.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/supportedfeature.py @@ -5,8 +5,7 @@ from .featuretype import FeatureType from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class SupportedFeatureTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncconnectiondeletedwebhook.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncconnectiondeletedwebhook.py index 5bfd9ad42..397a0735d 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncconnectiondeletedwebhook.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncconnectiondeletedwebhook.py @@ -3,8 +3,8 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SyncConnectionDeletedWebhookTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncflowurl.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncflowurl.py index fe6d240f8..d85d9d50a 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncflowurl.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncflowurl.py @@ -2,8 +2,8 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class SyncFlowURLTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncrange.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncrange.py index 5c557e5cb..25293c2c2 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncrange.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncrange.py @@ -3,8 +3,7 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import TypedDict -from typing_extensions import Annotated +from typing_extensions import Annotated, TypedDict class DateRangeTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncschedule.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncschedule.py index b69d5c079..cb8d6e39d 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncschedule.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncschedule.py @@ -4,8 +4,8 @@ from .syncfrequency import SyncFrequency from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SyncScheduleTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncstatus.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncstatus.py index 5cceec05e..3ebb6633f 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncstatus.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncstatus.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import Any, List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Any, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SyncStatusTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncsummary.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncsummary.py index d19a6e166..424a74c93 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncsummary.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/syncsummary.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SyncDateRangeUtcTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/synctolatestargs.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/synctolatestargs.py index a61322d81..670df973c 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/synctolatestargs.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/synctolatestargs.py @@ -3,8 +3,8 @@ from __future__ import annotations from codat_sync_for_commerce.types import BaseModel import pydantic -from typing import Optional, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict class SyncToLatestArgsTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxrateamount.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxrateamount.py index 509c9f1e8..2a55e0395 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxrateamount.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxrateamount.py @@ -11,8 +11,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class TaxRateAmountTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxratemapping.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxratemapping.py index 373030926..8c87ae7f7 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxratemapping.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/taxratemapping.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class TaxRateMappingTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/updateconnection.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/updateconnection.py index 26b97a349..b86f13812 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/updateconnection.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/updateconnection.py @@ -3,8 +3,8 @@ from __future__ import annotations from .dataconnectionstatus import DataConnectionStatus from codat_sync_for_commerce.types import BaseModel -from typing import Optional, TypedDict -from typing_extensions import NotRequired +from typing import Optional +from typing_extensions import NotRequired, TypedDict class UpdateConnectionTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/visibleaccounts.py b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/visibleaccounts.py index 8c1f4d453..8d466ba19 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/models/shared/visibleaccounts.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/models/shared/visibleaccounts.py @@ -10,8 +10,8 @@ ) import pydantic from pydantic import model_serializer -from typing import List, TypedDict -from typing_extensions import Annotated, NotRequired +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class VisibleAccountsTypedDict(TypedDict): diff --git a/sync-for-commerce/src/codat_sync_for_commerce/sdk.py b/sync-for-commerce/src/codat_sync_for_commerce/sdk.py index 7832f8915..04bca0e08 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/sdk.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/sdk.py @@ -131,3 +131,17 @@ def _init_sdks(self): self.connections = Connections(self.sdk_configuration) self.sync = Sync(self.sdk_configuration) self.integrations = Integrations(self.sdk_configuration) + + def __enter__(self): + return self + + async def __aenter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.sdk_configuration.client is not None: + self.sdk_configuration.client.close() + + async def __aexit__(self, exc_type, exc_val, exc_tb): + if self.sdk_configuration.async_client is not None: + await self.sdk_configuration.async_client.aclose() diff --git a/sync-for-commerce/src/codat_sync_for_commerce/sdkconfiguration.py b/sync-for-commerce/src/codat_sync_for_commerce/sdkconfiguration.py index cc45cd5ac..540a76010 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/sdkconfiguration.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/sdkconfiguration.py @@ -27,9 +27,9 @@ class SDKConfiguration: server_idx: Optional[int] = 0 language: str = "python" openapi_doc_version: str = "1.1" - sdk_version: str = "5.0.0" - gen_version: str = "2.415.8" - user_agent: str = "speakeasy-sdk/python 5.0.0 2.415.8 1.1 codat-sync-for-commerce" + sdk_version: str = "6.0.0" + gen_version: str = "2.462.1" + user_agent: str = "speakeasy-sdk/python 6.0.0 2.462.1 1.1 codat-sync-for-commerce" retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET) timeout_ms: Optional[int] = None diff --git a/sync-for-commerce/src/codat_sync_for_commerce/sync.py b/sync-for-commerce/src/codat_sync_for_commerce/sync.py index c9b44b73d..b593e87e8 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/sync.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/sync.py @@ -103,15 +103,17 @@ def get( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -207,15 +209,17 @@ async def get_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -312,15 +316,17 @@ def get_last_successful_sync( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -417,15 +423,17 @@ async def get_last_successful_sync_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -521,15 +529,17 @@ def get_latest_sync( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -625,15 +635,17 @@ async def get_latest_sync_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -727,15 +739,17 @@ def get_status( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -829,15 +843,17 @@ async def get_status_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -933,15 +949,17 @@ def list( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -1037,15 +1055,17 @@ async def list_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -1147,15 +1167,17 @@ def request( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -1257,15 +1279,17 @@ async def request_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -1366,15 +1390,17 @@ def request_for_date_range( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -1475,14 +1501,16 @@ async def request_for_date_range_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) diff --git a/sync-for-commerce/src/codat_sync_for_commerce/sync_flow_settings.py b/sync-for-commerce/src/codat_sync_for_commerce/sync_flow_settings.py index cfa28b117..d5316fabe 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/sync_flow_settings.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/sync_flow_settings.py @@ -92,15 +92,17 @@ def get_config_text_sync_flow( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -185,15 +187,17 @@ async def get_config_text_sync_flow_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -288,15 +292,17 @@ def get_visible_accounts( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -391,15 +397,17 @@ async def get_visible_accounts_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -505,15 +513,17 @@ def update_config_text_sync_flow( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -619,15 +629,17 @@ async def update_config_text_sync_flow_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -732,15 +744,17 @@ def update_visible_accounts_sync_flow( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) @@ -845,14 +859,16 @@ async def update_visible_accounts_sync_flow_async( data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) raise errors.ErrorMessage(data=data) if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( - "API error occurred", http_res.status_code, http_res.text, http_res + "API error occurred", http_res.status_code, http_res_text, http_res ) content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) raise errors.SDKError( f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", http_res.status_code, - http_res.text, + http_res_text, http_res, ) diff --git a/sync-for-commerce/src/codat_sync_for_commerce/utils/__init__.py b/sync-for-commerce/src/codat_sync_for_commerce/utils/__init__.py index 6c26aeb9c..26d51ae8f 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/utils/__init__.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/utils/__init__.py @@ -27,6 +27,10 @@ serialize_float, serialize_int, stream_to_text, + stream_to_text_async, + stream_to_bytes, + stream_to_bytes_async, + validate_const, validate_decimal, validate_float, validate_int, @@ -79,10 +83,14 @@ "serialize_request_body", "SerializedRequestBody", "stream_to_text", + "stream_to_text_async", + "stream_to_bytes", + "stream_to_bytes_async", "template_url", "unmarshal", "unmarshal_json", "validate_decimal", + "validate_const", "validate_float", "validate_int", "validate_open_enum", diff --git a/sync-for-commerce/src/codat_sync_for_commerce/utils/annotations.py b/sync-for-commerce/src/codat_sync_for_commerce/utils/annotations.py index 0d17472b3..387874edd 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/utils/annotations.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/utils/annotations.py @@ -1,19 +1,55 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from typing import Any +from enum import Enum +from typing import Any, Optional def get_discriminator(model: Any, fieldname: str, key: str) -> str: - if isinstance(model, dict): - try: - return f'{model.get(key)}' - except AttributeError as e: - raise ValueError(f'Could not find discriminator key {key} in {model}') from e - - if hasattr(model, fieldname): - return f'{getattr(model, fieldname)}' - - fieldname = fieldname.upper() - if hasattr(model, fieldname): - return f'{getattr(model, fieldname)}' + """ + Recursively search for the discriminator attribute in a model. + + Args: + model (Any): The model to search within. + fieldname (str): The name of the field to search for. + key (str): The key to search for in dictionaries. + + Returns: + str: The name of the discriminator attribute. + + Raises: + ValueError: If the discriminator attribute is not found. + """ + upper_fieldname = fieldname.upper() + + def get_field_discriminator(field: Any) -> Optional[str]: + """Search for the discriminator attribute in a given field.""" + + if isinstance(field, dict): + if key in field: + return f'{field[key]}' + + if hasattr(field, fieldname): + attr = getattr(field, fieldname) + if isinstance(attr, Enum): + return f'{attr.value}' + return f'{attr}' + + if hasattr(field, upper_fieldname): + attr = getattr(field, upper_fieldname) + if isinstance(attr, Enum): + return f'{attr.value}' + return f'{attr}' + + return None + + + if isinstance(model, list): + for field in model: + discriminator = get_field_discriminator(field) + if discriminator is not None: + return discriminator + + discriminator = get_field_discriminator(model) + if discriminator is not None: + return discriminator raise ValueError(f'Could not find discriminator field {fieldname} in {model}') diff --git a/sync-for-commerce/src/codat_sync_for_commerce/utils/eventstreaming.py b/sync-for-commerce/src/codat_sync_for_commerce/utils/eventstreaming.py index 553b386b3..74a63f757 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/utils/eventstreaming.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/utils/eventstreaming.py @@ -2,12 +2,72 @@ import re import json -from typing import Callable, TypeVar, Optional, Generator, AsyncGenerator, Tuple +from typing import ( + Callable, + Generic, + TypeVar, + Optional, + Generator, + AsyncGenerator, + Tuple, +) import httpx T = TypeVar("T") +class EventStream(Generic[T]): + response: httpx.Response + generator: Generator[T, None, None] + + def __init__( + self, + response: httpx.Response, + decoder: Callable[[str], T], + sentinel: Optional[str] = None, + ): + self.response = response + self.generator = stream_events(response, decoder, sentinel) + + def __iter__(self): + return self + + def __next__(self): + return next(self.generator) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.response.close() + + +class EventStreamAsync(Generic[T]): + response: httpx.Response + generator: AsyncGenerator[T, None] + + def __init__( + self, + response: httpx.Response, + decoder: Callable[[str], T], + sentinel: Optional[str] = None, + ): + self.response = response + self.generator = stream_events_async(response, decoder, sentinel) + + def __aiter__(self): + return self + + async def __anext__(self): + return await self.generator.__anext__() + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_val, exc_tb): + await self.response.aclose() + + class ServerEvent: id: Optional[str] = None event: Optional[str] = None diff --git a/sync-for-commerce/src/codat_sync_for_commerce/utils/serializers.py b/sync-for-commerce/src/codat_sync_for_commerce/utils/serializers.py index 85d57f436..c5eb36597 100644 --- a/sync-for-commerce/src/codat_sync_for_commerce/utils/serializers.py +++ b/sync-for-commerce/src/codat_sync_for_commerce/utils/serializers.py @@ -116,6 +116,19 @@ def validate(e): return validate +def validate_const(v): + def validate(c): + if is_optional_type(type(c)) and c is None: + return None + + if v != c: + raise ValueError(f"Expected {v}") + + return c + + return validate + + def unmarshal_json(raw, typ: Any) -> Any: return unmarshal(from_json(raw), typ) @@ -172,6 +185,18 @@ def stream_to_text(stream: httpx.Response) -> str: return "".join(stream.iter_text()) +async def stream_to_text_async(stream: httpx.Response) -> str: + return "".join([chunk async for chunk in stream.aiter_text()]) + + +def stream_to_bytes(stream: httpx.Response) -> bytes: + return stream.content + + +async def stream_to_bytes_async(stream: httpx.Response) -> bytes: + return await stream.aread() + + def get_pydantic_model(data: Any, typ: Any) -> Any: if not _contains_pydantic_model(data): return unmarshal(data, typ)