diff --git a/sync-for-expenses/.speakeasy/gen.lock b/sync-for-expenses/.speakeasy/gen.lock
index 7d2378632..532691b45 100755
--- a/sync-for-expenses/.speakeasy/gen.lock
+++ b/sync-for-expenses/.speakeasy/gen.lock
@@ -1,27 +1,30 @@
lockVersion: 2.0.0
id: a2c830ee-4f93-4e8e-8f01-48d0991317f5
management:
- docChecksum: cd6fa6671764b38bed9a8592c0f117ad
+ docChecksum: f7909a451d1597b90dec569f16a52c39
docVersion: prealpha
- speakeasyVersion: internal
- generationVersion: 2.257.2
- releaseVersion: 6.0.1
- configChecksum: 8408f3e353fbd3cd90617a531d65c958
+ speakeasyVersion: 1.214.0
+ generationVersion: 2.286.2
+ releaseVersion: 6.1.0
+ configChecksum: e79911b643cf0af7980744493efc5dad
repoURL: https://github.com/codatio/client-sdk-python.git
repoSubDirectory: sync-for-expenses
installationURL: https://github.com/codatio/client-sdk-python.git#subdirectory=sync-for-expenses
published: true
features:
python:
- constsAndDefaults: 0.1.2
- core: 4.4.6
+ constsAndDefaults: 0.1.3
+ core: 4.5.1
+ decimal: 0.1.0
deprecations: 2.81.1
examples: 2.81.3
- globalSecurity: 2.83.2
- globalServerURLs: 2.82.1
+ globalSecurity: 2.83.5
+ globalServerURLs: 2.82.2
inputOutputModels: 2.83.1
nameOverrides: 2.81.1
+ responseFormat: 0.1.0
retries: 2.82.1
+ webhooks: 1.0.0
generatedFiles:
- src/codatsyncexpenses/sdkconfiguration.py
- src/codatsyncexpenses/companies.py
@@ -36,6 +39,7 @@ generatedFiles:
- src/codatsyncexpenses/sync.py
- src/codatsyncexpenses/transaction_status.py
- src/codatsyncexpenses/sdk.py
+ - py.typed
- pylintrc
- setup.py
- src/codatsyncexpenses/__init__.py
@@ -404,3 +408,6 @@ generatedFiles:
- docs/sdks/transactionstatus/README.md
- USAGE.md
- .gitattributes
+ - src/codatsyncexpenses/_hooks/sdkhooks.py
+ - src/codatsyncexpenses/_hooks/types.py
+ - src/codatsyncexpenses/_hooks/__init__.py
diff --git a/sync-for-expenses/README.md b/sync-for-expenses/README.md
index 7de8ffc77..f7093ae96 100755
--- a/sync-for-expenses/README.md
+++ b/sync-for-expenses/README.md
@@ -38,6 +38,7 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
@@ -102,7 +103,7 @@ if res.company is not None:
### [expenses](docs/sdks/expenses/README.md)
* [create](docs/sdks/expenses/README.md#create) - Create expense transaction
-* [update](docs/sdks/expenses/README.md#update) - Update expense-transactions
+* [update](docs/sdks/expenses/README.md#update) - Update expense transactions
* [upload_attachment](docs/sdks/expenses/README.md#upload_attachment) - Upload attachment
### [sync](docs/sdks/sync/README.md)
@@ -149,6 +150,7 @@ res = s.companies.create(req,
if res.company is not None:
# handle response
pass
+
```
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
@@ -174,6 +176,7 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
@@ -217,6 +220,7 @@ except errors.SDKError as e:
if res.company is not None:
# handle response
pass
+
```
@@ -254,6 +258,7 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
@@ -281,6 +286,7 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
@@ -332,6 +338,7 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
diff --git a/sync-for-expenses/RELEASES.md b/sync-for-expenses/RELEASES.md
index 6f29ea72b..8f8aad673 100644
--- a/sync-for-expenses/RELEASES.md
+++ b/sync-for-expenses/RELEASES.md
@@ -706,4 +706,14 @@ Based on:
### Generated
- [python v6.0.1] sync-for-expenses
### Releases
-- [PyPI v6.0.1] https://pypi.org/project/codat-sync-for-expenses/6.0.1 - sync-for-expenses
\ No newline at end of file
+- [PyPI v6.0.1] https://pypi.org/project/codat-sync-for-expenses/6.0.1 - sync-for-expenses
+
+## 2024-03-20 17:20:56
+### Changes
+Based on:
+- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses.yaml
+- Speakeasy CLI 1.214.0 (2.286.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [python v6.1.0] sync-for-expenses
+### Releases
+- [PyPI v6.1.0] https://pypi.org/project/codat-sync-for-expenses/6.1.0 - sync-for-expenses
\ No newline at end of file
diff --git a/sync-for-expenses/USAGE.md b/sync-for-expenses/USAGE.md
index e34fe6b8d..123790a39 100644
--- a/sync-for-expenses/USAGE.md
+++ b/sync-for-expenses/USAGE.md
@@ -19,5 +19,6 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/createcompanyresponse.md b/sync-for-expenses/docs/models/operations/createcompanyresponse.md
index faee951b5..2687774f3 100644
--- a/sync-for-expenses/docs/models/operations/createcompanyresponse.md
+++ b/sync-for-expenses/docs/models/operations/createcompanyresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `company` | [Optional[shared.Company]](../../models/shared/company.md) | :heavy_minus_sign: | OK | {"id":"0498e921-9b53-4396-a412-4f2f5983b0a2","name":"string","platform":"string","redirect":"https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739","lastSync":"2022-01-01T12:00:00.000Z","created":"2022-01-01T12:00:00.000Z","createdByUserName":"string","dataConnections":[{"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"}],"groups":[{"id":"d7a6c4b4-dc87-45f6-b803-62f466398680"}]} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `company` | [Optional[shared.Company]](../../models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"platform": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"dataConnections": [
{
"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"
}
],
"groups": [
{
"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"
}
]
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/createconnectionresponse.md b/sync-for-expenses/docs/models/operations/createconnectionresponse.md
index 4d113122e..5bafc316c 100644
--- a/sync-for-expenses/docs/models/operations/createconnectionresponse.md
+++ b/sync-for-expenses/docs/models/operations/createconnectionresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | OK | {"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"} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | OK | {
"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"
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md b/sync-for-expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md
index 9698402c8..8cd462a51 100644
--- a/sync-for-expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md
+++ b/sync-for-expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | Success | {"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"} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | Success | {
"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"
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/createsupplierrequest.md b/sync-for-expenses/docs/models/operations/createsupplierrequest.md
index 72cfe4315..1b020e666 100644
--- a/sync-for-expenses/docs/models/operations/createsupplierrequest.md
+++ b/sync-for-expenses/docs/models/operations/createsupplierrequest.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
-| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 |
-| `supplier` | [Optional[shared.Supplier]](../../models/shared/supplier.md) | :heavy_minus_sign: | N/A | {"id":"C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F","supplierName":"Kelly's Industrial Supplies","contactName":"Kelly's Industrial Supplies","emailAddress":"sales@kellysupplies.com","phone":"07999 999999","addresses":[{"type":"Billing","line1":"Unit 51","line2":"Bakersfield Industrial Estate","city":"Bakersfield","region":"California","country":"USA","postalcode":"93308"}],"registrationNumber":"string","taxNumber":"string","status":"Unknown","defaultCurrency":"string","metadata":{"isDeleted":true},"supplementalData":{"content":{"property1":{"property1":null,"property2":null},"property2":{"property1":null,"property2":null}}},"modifiedDate":"2022-10-23T00:00:00Z","sourceModifiedDate":"2022-10-23T00:00:00Z"} |
-| `allow_sync_on_push_complete` | *Optional[bool]* | :heavy_minus_sign: | Allow a sync upon push completion. | |
-| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
+| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 |
+| `supplier` | [Optional[shared.Supplier]](../../models/shared/supplier.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} |
+| `allow_sync_on_push_complete` | *Optional[bool]* | :heavy_minus_sign: | Allow a sync upon push completion. | |
+| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/getcompanyresponse.md b/sync-for-expenses/docs/models/operations/getcompanyresponse.md
index 9b44863d2..a64f3c90c 100644
--- a/sync-for-expenses/docs/models/operations/getcompanyresponse.md
+++ b/sync-for-expenses/docs/models/operations/getcompanyresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `company` | [Optional[shared.Company]](../../models/shared/company.md) | :heavy_minus_sign: | OK | {"id":"0498e921-9b53-4396-a412-4f2f5983b0a2","name":"string","platform":"string","redirect":"https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739","lastSync":"2022-01-01T12:00:00.000Z","created":"2022-01-01T12:00:00.000Z","createdByUserName":"string","dataConnections":[{"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"}],"groups":[{"id":"d7a6c4b4-dc87-45f6-b803-62f466398680"}]} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `company` | [Optional[shared.Company]](../../models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"platform": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"dataConnections": [
{
"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"
}
],
"groups": [
{
"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"
}
]
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/getconnectionresponse.md b/sync-for-expenses/docs/models/operations/getconnectionresponse.md
index 66e3f65f1..f1358ac2e 100644
--- a/sync-for-expenses/docs/models/operations/getconnectionresponse.md
+++ b/sync-for-expenses/docs/models/operations/getconnectionresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | OK | {"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"} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | OK | {
"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"
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/getpulloperationresponse.md b/sync-for-expenses/docs/models/operations/getpulloperationresponse.md
index 1ee27f4e4..2223df457 100644
--- a/sync-for-expenses/docs/models/operations/getpulloperationresponse.md
+++ b/sync-for-expenses/docs/models/operations/getpulloperationresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `pull_operation` | [Optional[shared.PullOperation]](../../models/shared/pulloperation.md) | :heavy_minus_sign: | OK | {"id":"97d60846-f07a-4d42-b5a0-0bdcc6ebf56b","companyId":"4645bd78-8988-45bc-ac9e-67ba5df6e4e5","connectionId":"51baa045-4836-4317-a42e-3542e991e581","dataType":"invoices","status":"Initial","statusDescription":"Paused until 2022-10-23T00:00:00.000Z","requested":"2022-11-14T11:18:37.2798351Z","progress":10,"isCompleted":false,"isErrored":false} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `pull_operation` | [Optional[shared.PullOperation]](../../models/shared/pulloperation.md) | :heavy_minus_sign: | OK | {
"id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b",
"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5",
"connectionId": "51baa045-4836-4317-a42e-3542e991e581",
"dataType": "invoices",
"status": "Initial",
"statusDescription": "Paused until 2022-10-23T00:00:00.000Z",
"requested": "2022-11-14T11:18:37.2798351Z",
"progress": 10,
"isCompleted": false,
"isErrored": false
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/getsupplierresponse.md b/sync-for-expenses/docs/models/operations/getsupplierresponse.md
index feeab839e..5cf12b136 100644
--- a/sync-for-expenses/docs/models/operations/getsupplierresponse.md
+++ b/sync-for-expenses/docs/models/operations/getsupplierresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `supplier` | [Optional[shared.Supplier]](../../models/shared/supplier.md) | :heavy_minus_sign: | Success | {"id":"C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F","supplierName":"Kelly's Industrial Supplies","contactName":"Kelly's Industrial Supplies","emailAddress":"sales@kellysupplies.com","phone":"07999 999999","addresses":[{"type":"Billing","line1":"Unit 51","line2":"Bakersfield Industrial Estate","city":"Bakersfield","region":"California","country":"USA","postalcode":"93308"}],"registrationNumber":"string","taxNumber":"string","status":"Unknown","defaultCurrency":"string","metadata":{"isDeleted":true},"supplementalData":{"content":{"property1":{"property1":null,"property2":null},"property2":{"property1":null,"property2":null}}},"modifiedDate":"2022-10-23T00:00:00Z","sourceModifiedDate":"2022-10-23T00:00:00Z"} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `supplier` | [Optional[shared.Supplier]](../../models/shared/supplier.md) | :heavy_minus_sign: | Success | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/getsynctransactionresponse.md b/sync-for-expenses/docs/models/operations/getsynctransactionresponse.md
index 210390a21..c6ec7e336 100644
--- a/sync-for-expenses/docs/models/operations/getsynctransactionresponse.md
+++ b/sync-for-expenses/docs/models/operations/getsynctransactionresponse.md
@@ -8,4 +8,4 @@
| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation |
| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
-| `transaction` | [Optional[shared.Transaction]](../../models/shared/transaction.md) | :heavy_minus_sign: | Success |
\ No newline at end of file
+| `transaction_response` | List[[shared.Transaction](../../models/shared/transaction.md)] | :heavy_minus_sign: | Success |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listcompaniesresponse.md b/sync-for-expenses/docs/models/operations/listcompaniesresponse.md
index 7abc40ecd..634d146a1 100644
--- a/sync-for-expenses/docs/models/operations/listcompaniesresponse.md
+++ b/sync-for-expenses/docs/models/operations/listcompaniesresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `companies` | [Optional[shared.Companies]](../../models/shared/companies.md) | :heavy_minus_sign: | OK | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `companies` | [Optional[shared.Companies]](../../models/shared/companies.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listconnectionsresponse.md b/sync-for-expenses/docs/models/operations/listconnectionsresponse.md
index 78b8ddd89..bf806ddc5 100644
--- a/sync-for-expenses/docs/models/operations/listconnectionsresponse.md
+++ b/sync-for-expenses/docs/models/operations/listconnectionsresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `connections` | [Optional[shared.Connections]](../../models/shared/connections.md) | :heavy_minus_sign: | OK | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `connections` | [Optional[shared.Connections]](../../models/shared/connections.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listcustomersresponse.md b/sync-for-expenses/docs/models/operations/listcustomersresponse.md
index caf030417..a5145c0c7 100644
--- a/sync-for-expenses/docs/models/operations/listcustomersresponse.md
+++ b/sync-for-expenses/docs/models/operations/listcustomersresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `customers` | [Optional[shared.Customers]](../../models/shared/customers.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `customers` | [Optional[shared.Customers]](../../models/shared/customers.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listpulloperationsresponse.md b/sync-for-expenses/docs/models/operations/listpulloperationsresponse.md
index b51df770a..45665c995 100644
--- a/sync-for-expenses/docs/models/operations/listpulloperationsresponse.md
+++ b/sync-for-expenses/docs/models/operations/listpulloperationsresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `pull_operations` | [Optional[shared.PullOperations]](../../models/shared/pulloperations.md) | :heavy_minus_sign: | OK | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `pull_operations` | [Optional[shared.PullOperations]](../../models/shared/pulloperations.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listpushoperationsresponse.md b/sync-for-expenses/docs/models/operations/listpushoperationsresponse.md
index b2097f793..7ee262c4c 100644
--- a/sync-for-expenses/docs/models/operations/listpushoperationsresponse.md
+++ b/sync-for-expenses/docs/models/operations/listpushoperationsresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `push_operations` | [Optional[shared.PushOperations]](../../models/shared/pushoperations.md) | :heavy_minus_sign: | OK | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `push_operations` | [Optional[shared.PushOperations]](../../models/shared/pushoperations.md) | :heavy_minus_sign: | OK | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listsuppliersresponse.md b/sync-for-expenses/docs/models/operations/listsuppliersresponse.md
index 93cef3bf5..e6e2c8267 100644
--- a/sync-for-expenses/docs/models/operations/listsuppliersresponse.md
+++ b/sync-for-expenses/docs/models/operations/listsuppliersresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `suppliers` | [Optional[shared.Suppliers]](../../models/shared/suppliers.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `suppliers` | [Optional[shared.Suppliers]](../../models/shared/suppliers.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/listsynctransactionsresponse.md b/sync-for-expenses/docs/models/operations/listsynctransactionsresponse.md
index 7f38e0079..b14152f3f 100644
--- a/sync-for-expenses/docs/models/operations/listsynctransactionsresponse.md
+++ b/sync-for-expenses/docs/models/operations/listsynctransactionsresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `transactions` | [Optional[shared.Transactions]](../../models/shared/transactions.md) | :heavy_minus_sign: | Success | {"_links":{"pageNumber":1,"pageSize":10,"totalResults":1,"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `transactions` | [Optional[shared.Transactions]](../../models/shared/transactions.md) | :heavy_minus_sign: | Success | {
"pageNumber": 1,
"pageSize": 10,
"totalResults": 1,
"_links": {
"self": {
"href": "/companies/{id}/data/{dataType}"
},
"current": {
"href": "/companies/{id}/data/{dataType}?page=1\u0026pageSize=10"
}
}
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/refreshdatatyperesponse.md b/sync-for-expenses/docs/models/operations/refreshdatatyperesponse.md
index 7ec003a19..79184cefc 100644
--- a/sync-for-expenses/docs/models/operations/refreshdatatyperesponse.md
+++ b/sync-for-expenses/docs/models/operations/refreshdatatyperesponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `pull_operation` | [Optional[shared.PullOperation]](../../models/shared/pulloperation.md) | :heavy_minus_sign: | OK | {"id":"97d60846-f07a-4d42-b5a0-0bdcc6ebf56b","companyId":"4645bd78-8988-45bc-ac9e-67ba5df6e4e5","connectionId":"51baa045-4836-4317-a42e-3542e991e581","dataType":"invoices","status":"Initial","statusDescription":"Paused until 2022-10-23T00:00:00.000Z","requested":"2022-11-14T11:18:37.2798351Z","progress":10,"isCompleted":false,"isErrored":false} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `pull_operation` | [Optional[shared.PullOperation]](../../models/shared/pulloperation.md) | :heavy_minus_sign: | OK | {
"id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b",
"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5",
"connectionId": "51baa045-4836-4317-a42e-3542e991e581",
"dataType": "invoices",
"status": "Initial",
"statusDescription": "Paused until 2022-10-23T00:00:00.000Z",
"requested": "2022-11-14T11:18:37.2798351Z",
"progress": 10,
"isCompleted": false,
"isErrored": false
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/unlinkconnectionresponse.md b/sync-for-expenses/docs/models/operations/unlinkconnectionresponse.md
index 08eb976b5..927c8dae6 100644
--- a/sync-for-expenses/docs/models/operations/unlinkconnectionresponse.md
+++ b/sync-for-expenses/docs/models/operations/unlinkconnectionresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | OK | {"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"} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `connection` | [Optional[shared.Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | OK | {
"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"
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/updatecompanyresponse.md b/sync-for-expenses/docs/models/operations/updatecompanyresponse.md
index 3005c9e88..13e3f91ea 100644
--- a/sync-for-expenses/docs/models/operations/updatecompanyresponse.md
+++ b/sync-for-expenses/docs/models/operations/updatecompanyresponse.md
@@ -3,9 +3,9 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
-| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
-| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
-| `company` | [Optional[shared.Company]](../../models/shared/company.md) | :heavy_minus_sign: | OK | {"id":"0498e921-9b53-4396-a412-4f2f5983b0a2","name":"string","platform":"string","redirect":"https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739","lastSync":"2022-01-01T12:00:00.000Z","created":"2022-01-01T12:00:00.000Z","createdByUserName":"string","dataConnections":[{"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"}],"groups":[{"id":"d7a6c4b4-dc87-45f6-b803-62f466398680"}]} |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | |
+| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | |
+| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | |
+| `company` | [Optional[shared.Company]](../../models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"platform": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"dataConnections": [
{
"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"
}
],
"groups": [
{
"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"
}
]
} |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/operations/updatesupplierrequest.md b/sync-for-expenses/docs/models/operations/updatesupplierrequest.md
index 110fbde5b..f8a8afd4b 100644
--- a/sync-for-expenses/docs/models/operations/updatesupplierrequest.md
+++ b/sync-for-expenses/docs/models/operations/updatesupplierrequest.md
@@ -3,12 +3,12 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
-| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 |
-| `supplier_id` | *str* | :heavy_check_mark: | Unique identifier for a supplier. | 13d946f0-c5d5-42bc-b092-97ece17923ab |
-| `supplier` | [Optional[shared.Supplier]](../../models/shared/supplier.md) | :heavy_minus_sign: | N/A | {"id":"C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F","supplierName":"Kelly's Industrial Supplies","contactName":"Kelly's Industrial Supplies","emailAddress":"sales@kellysupplies.com","phone":"07999 999999","addresses":[{"type":"Billing","line1":"Unit 51","line2":"Bakersfield Industrial Estate","city":"Bakersfield","region":"California","country":"USA","postalcode":"93308"}],"registrationNumber":"string","taxNumber":"string","status":"Unknown","defaultCurrency":"string","metadata":{"isDeleted":true},"supplementalData":{"content":{"property1":{"property1":null,"property2":null},"property2":{"property1":null,"property2":null}}},"modifiedDate":"2022-10-23T00:00:00Z","sourceModifiedDate":"2022-10-23T00:00:00Z"} |
-| `allow_sync_on_push_complete` | *Optional[bool]* | :heavy_minus_sign: | Allow a sync upon push completion. | |
-| `force_update` | *Optional[bool]* | :heavy_minus_sign: | When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. | |
-| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
+| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 |
+| `supplier_id` | *str* | :heavy_check_mark: | Unique identifier for a supplier. | 13d946f0-c5d5-42bc-b092-97ece17923ab |
+| `supplier` | [Optional[shared.Supplier]](../../models/shared/supplier.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} |
+| `allow_sync_on_push_complete` | *Optional[bool]* | :heavy_minus_sign: | Allow a sync upon push completion. | |
+| `force_update` | *Optional[bool]* | :heavy_minus_sign: | When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. | |
+| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/clientratelimitreachedwebhook.md b/sync-for-expenses/docs/models/shared/clientratelimitreachedwebhook.md
index 0e1855429..7e8db4c18 100644
--- a/sync-for-expenses/docs/models/shared/clientratelimitreachedwebhook.md
+++ b/sync-for-expenses/docs/models/shared/clientratelimitreachedwebhook.md
@@ -5,12 +5,12 @@ Webhook request body for a client that has reached their rate limit.
## Fields
-| Field | Type | Required | Description |
-| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
-| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. |
-| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. |
-| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. |
-| `data` | [Optional[shared.ClientRateLimitReachedWebhookData]](../../models/shared/clientratelimitreachedwebhookdata.md) | :heavy_minus_sign: | N/A |
-| `message` | *Optional[str]* | :heavy_minus_sign: | A human readable message about the webhook. |
-| `rule_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the rule. |
-| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. |
\ No newline at end of file
+| Field | Type | Required | Description |
+| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. |
+| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. |
+| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. |
+| `data` | [Optional[shared.ClientRateLimitReachedWebhookData]](../../models/shared/clientratelimitreachedwebhookdata.md) | :heavy_minus_sign: | N/A |
+| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. |
+| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Unique identifier for the rule. |
+| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/clientratelimitresetwebhook.md b/sync-for-expenses/docs/models/shared/clientratelimitresetwebhook.md
index de4352761..4b69731e8 100644
--- a/sync-for-expenses/docs/models/shared/clientratelimitresetwebhook.md
+++ b/sync-for-expenses/docs/models/shared/clientratelimitresetwebhook.md
@@ -5,12 +5,12 @@ Webhook request body for a client that has had their rate limit reset.
## Fields
-| Field | Type | Required | Description |
-| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
-| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. |
-| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. |
-| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. |
-| `data` | [Optional[shared.ClientRateLimitResetWebhookData]](../../models/shared/clientratelimitresetwebhookdata.md) | :heavy_minus_sign: | N/A |
-| `message` | *Optional[str]* | :heavy_minus_sign: | A human readable message about the webhook. |
-| `rule_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the rule. |
-| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. |
\ No newline at end of file
+| Field | Type | Required | Description |
+| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. |
+| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. |
+| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. |
+| `data` | [Optional[shared.ClientRateLimitResetWebhookData]](../../models/shared/clientratelimitresetwebhookdata.md) | :heavy_minus_sign: | N/A |
+| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. |
+| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Unique identifier for the rule. |
+| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/clientratelimitresetwebhookdata.md b/sync-for-expenses/docs/models/shared/clientratelimitresetwebhookdata.md
index e62b34279..efbbe87f9 100644
--- a/sync-for-expenses/docs/models/shared/clientratelimitresetwebhookdata.md
+++ b/sync-for-expenses/docs/models/shared/clientratelimitresetwebhookdata.md
@@ -7,5 +7,5 @@
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `daily_quota` | *Optional[int]* | :heavy_minus_sign: | The number of available requests per day. | |
| `expires_utc` | *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 |
-| `quota_remaining` | *Optional[int]* | :heavy_minus_sign: | Total number of request remaining for your client. | |
+| `quota_remaining` | *Optional[int]* | :heavy_minus_sign: | Total number of requests remaining for your client. | |
| `reset_reason` | *Optional[str]* | :heavy_minus_sign: | The reason for your rate limit quota being reset. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/companies.md b/sync-for-expenses/docs/models/shared/companies.md
index c19c46de5..d6b5a8ea8 100644
--- a/sync-for-expenses/docs/models/shared/companies.md
+++ b/sync-for-expenses/docs/models/shared/companies.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.Company](../../models/shared/company.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.Company](../../models/shared/company.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/connections.md b/sync-for-expenses/docs/models/shared/connections.md
index b2e15bef0..1323c74a1 100644
--- a/sync-for-expenses/docs/models/shared/connections.md
+++ b/sync-for-expenses/docs/models/shared/connections.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/createaccountresponse.md b/sync-for-expenses/docs/models/shared/createaccountresponse.md
index e1b4f0bf7..013b7787a 100644
--- a/sync-for-expenses/docs/models/shared/createaccountresponse.md
+++ b/sync-for-expenses/docs/models/shared/createaccountresponse.md
@@ -14,7 +14,7 @@
| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | |
| `completed_on_utc` | *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 |
| `data` | [Optional[shared.AccountingAccount]](../../models/shared/accountingaccount.md) | :heavy_minus_sign: | N/A | |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about the error. | |
| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | |
| ~~`timeout_in_seconds`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Number of seconds the push operation must complete within before it times out. | |
diff --git a/sync-for-expenses/docs/models/shared/createcustomerresponse.md b/sync-for-expenses/docs/models/shared/createcustomerresponse.md
index 91e9efc62..31276c18f 100644
--- a/sync-for-expenses/docs/models/shared/createcustomerresponse.md
+++ b/sync-for-expenses/docs/models/shared/createcustomerresponse.md
@@ -14,7 +14,7 @@
| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | |
| `completed_on_utc` | *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 |
| `data` | [Optional[shared.AccountingCustomer]](../../models/shared/accountingcustomer.md) | :heavy_minus_sign: | N/A | |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about the error. | |
| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | |
| ~~`timeout_in_seconds`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Number of seconds the push operation must complete within before it times out. | |
diff --git a/sync-for-expenses/docs/models/shared/createsupplierresponse.md b/sync-for-expenses/docs/models/shared/createsupplierresponse.md
index 56effea05..c372cb5ba 100644
--- a/sync-for-expenses/docs/models/shared/createsupplierresponse.md
+++ b/sync-for-expenses/docs/models/shared/createsupplierresponse.md
@@ -13,8 +13,8 @@
| `status_code` | *int* | :heavy_check_mark: | Push status code. | |
| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | |
| `completed_on_utc` | *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 |
-| `data` | [Optional[shared.AccountingSupplier]](../../models/shared/accountingsupplier.md) | :heavy_minus_sign: | N/A | {"id":"C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F","supplierName":"Kelly's Industrial Supplies","contactName":"Kelly's Industrial Supplies","emailAddress":"sales@kellysupplies.com","phone":"07999 999999","addresses":[{"type":"Billing","line1":"Unit 51","line2":"Bakersfield Industrial Estate","city":"Bakersfield","region":"California","country":"USA","postalcode":"93308"}],"registrationNumber":"string","taxNumber":"string","status":"Unknown","defaultCurrency":"string","metadata":{"isDeleted":true},"supplementalData":{"content":{"property1":{"property1":null,"property2":null},"property2":{"property1":null,"property2":null}}},"modifiedDate":"2022-10-23T00:00:00Z","sourceModifiedDate":"2022-10-23T00:00:00Z"} |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data` | [Optional[shared.AccountingSupplier]](../../models/shared/accountingsupplier.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about the error. | |
| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | |
| ~~`timeout_in_seconds`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Number of seconds the push operation must complete within before it times out. | |
diff --git a/sync-for-expenses/docs/models/shared/customers.md b/sync-for-expenses/docs/models/shared/customers.md
index d334764d1..73c695b56 100644
--- a/sync-for-expenses/docs/models/shared/customers.md
+++ b/sync-for-expenses/docs/models/shared/customers.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.Customer](../../models/shared/customer.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.Customer](../../models/shared/customer.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/datastatus.md b/sync-for-expenses/docs/models/shared/datastatus.md
index 3f72f0ed6..6d6e94948 100644
--- a/sync-for-expenses/docs/models/shared/datastatus.md
+++ b/sync-for-expenses/docs/models/shared/datastatus.md
@@ -8,7 +8,7 @@ Describes the state of data in the Codat cache for a company and data type
| Field | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `current_status` | *str* | :heavy_check_mark: | The current status of the dataset in Codat's cache. | |
-| `data_type` | [shared.DataTypes](../../models/shared/datatypes.md) | :heavy_check_mark: | Available Data types | invoices |
+| `data_type` | [shared.DataTypes](../../models/shared/datatypes.md) | :heavy_check_mark: | Available data types | invoices |
| `last_successful_sync` | *str* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:
```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```
When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:
- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`
> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC |
| `latest_successful_sync_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the most recent successful sync of data type. | 8220fc90-55b6-47bc-9417-48ac6ea93101 |
| `latest_sync_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for most recent sync of data type. | ad474a37-2003-478e-baee-9af9f1ec2fe3 |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/datatype.md b/sync-for-expenses/docs/models/shared/datatype.md
index 7a5f16172..593192d4b 100644
--- a/sync-for-expenses/docs/models/shared/datatype.md
+++ b/sync-for-expenses/docs/models/shared/datatype.md
@@ -1,6 +1,6 @@
# DataType
-Available Data types
+Available data types
## Values
diff --git a/sync-for-expenses/docs/models/shared/datatypes.md b/sync-for-expenses/docs/models/shared/datatypes.md
index ddabcb78f..a102001d1 100644
--- a/sync-for-expenses/docs/models/shared/datatypes.md
+++ b/sync-for-expenses/docs/models/shared/datatypes.md
@@ -1,6 +1,6 @@
# DataTypes
-Available Data types
+Available data types
## Values
diff --git a/sync-for-expenses/docs/models/shared/expensetransactionline.md b/sync-for-expenses/docs/models/shared/expensetransactionline.md
index 2efaaacee..307868ec1 100644
--- a/sync-for-expenses/docs/models/shared/expensetransactionline.md
+++ b/sync-for-expenses/docs/models/shared/expensetransactionline.md
@@ -7,7 +7,7 @@
| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `account_ref` | [shared.RecordRef](../../models/shared/recordref.md) | :heavy_check_mark: | N/A | |
| `net_amount` | *Decimal* | :heavy_check_mark: | Amount of the line, exclusive of tax. | 110.42 |
-| `tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax for the line. | 14.43 |
| `invoice_to` | [Optional[shared.InvoiceTo]](../../models/shared/invoiceto.md) | :heavy_minus_sign: | Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. | |
+| `tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | 14.43 |
| `tax_rate_ref` | [Optional[shared.RecordRef]](../../models/shared/recordref.md) | :heavy_minus_sign: | N/A | |
| `tracking_refs` | List[[shared.TrackingRef](../../models/shared/trackingref.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/phone.md b/sync-for-expenses/docs/models/shared/phone.md
index c7eac7219..e9af373f5 100644
--- a/sync-for-expenses/docs/models/shared/phone.md
+++ b/sync-for-expenses/docs/models/shared/phone.md
@@ -5,5 +5,5 @@
| Field | Type | Required | Description | Example |
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
-| `number` | *Optional[str]* | :heavy_check_mark: | A phone number. | +44 25691 154789 |
-| `type` | [shared.PhoneNumberType](../../models/shared/phonenumbertype.md) | :heavy_check_mark: | The type of phone number | |
\ No newline at end of file
+| `type` | [shared.PhoneNumberType](../../models/shared/phonenumbertype.md) | :heavy_check_mark: | The type of phone number | |
+| `number` | *Optional[str]* | :heavy_minus_sign: | A phone number. | +44 25691 154789 |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/pulloperations.md b/sync-for-expenses/docs/models/shared/pulloperations.md
index 75bc96de7..69df81c54 100644
--- a/sync-for-expenses/docs/models/shared/pulloperations.md
+++ b/sync-for-expenses/docs/models/shared/pulloperations.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.PullOperation](../../models/shared/pulloperation.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.PullOperation](../../models/shared/pulloperation.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/pushoperation.md b/sync-for-expenses/docs/models/shared/pushoperation.md
index 8ceefbf7f..bcf668d10 100644
--- a/sync-for-expenses/docs/models/shared/pushoperation.md
+++ b/sync-for-expenses/docs/models/shared/pushoperation.md
@@ -13,7 +13,7 @@
| `status_code` | *int* | :heavy_check_mark: | Push status code. | |
| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | |
| `completed_on_utc` | *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 |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about the error. | |
| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | |
| ~~`timeout_in_seconds`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Number of seconds the push operation must complete within before it times out. | |
diff --git a/sync-for-expenses/docs/models/shared/pushoperationref.md b/sync-for-expenses/docs/models/shared/pushoperationref.md
index 44929acb0..7c26e1c4f 100644
--- a/sync-for-expenses/docs/models/shared/pushoperationref.md
+++ b/sync-for-expenses/docs/models/shared/pushoperationref.md
@@ -5,5 +5,5 @@
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a push operation. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/pushoperations.md b/sync-for-expenses/docs/models/shared/pushoperations.md
index fbdf79507..91dea4734 100644
--- a/sync-for-expenses/docs/models/shared/pushoperations.md
+++ b/sync-for-expenses/docs/models/shared/pushoperations.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.PushOperation](../../models/shared/pushoperation.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.PushOperation](../../models/shared/pushoperation.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/schemadatatype.md b/sync-for-expenses/docs/models/shared/schemadatatype.md
index 6f6f50a0c..a7b7e6ae3 100644
--- a/sync-for-expenses/docs/models/shared/schemadatatype.md
+++ b/sync-for-expenses/docs/models/shared/schemadatatype.md
@@ -1,6 +1,6 @@
# SchemaDataType
-Available Data types
+Available data types
## Values
diff --git a/sync-for-expenses/docs/models/shared/suppliers.md b/sync-for-expenses/docs/models/shared/suppliers.md
index c9a9079d6..3374dc9b4 100644
--- a/sync-for-expenses/docs/models/shared/suppliers.md
+++ b/sync-for-expenses/docs/models/shared/suppliers.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.Supplier](../../models/shared/supplier.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.Supplier](../../models/shared/supplier.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/synccompletewebhook.md b/sync-for-expenses/docs/models/shared/synccompletewebhook.md
index 83f2d41d9..cd87c20ba 100644
--- a/sync-for-expenses/docs/models/shared/synccompletewebhook.md
+++ b/sync-for-expenses/docs/models/shared/synccompletewebhook.md
@@ -5,13 +5,13 @@ Webhook request body used to notify that a sync has completed.
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
-| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | |
-| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | |
-| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | |
-| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
-| `data` | [Optional[shared.SyncCompleteWebhookData]](../../models/shared/synccompletewebhookdata.md) | :heavy_minus_sign: | N/A | |
-| `message` | *Optional[str]* | :heavy_minus_sign: | A human readable message about the webhook. | |
-| `rule_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the rule. | |
-| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | |
+| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | |
+| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | |
+| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
+| `data` | [Optional[shared.SyncCompleteWebhookData]](../../models/shared/synccompletewebhookdata.md) | :heavy_minus_sign: | N/A | |
+| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | |
+| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Unique identifier for the rule. | |
+| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/syncfailedwebhook.md b/sync-for-expenses/docs/models/shared/syncfailedwebhook.md
index 3d9768522..af3e34457 100644
--- a/sync-for-expenses/docs/models/shared/syncfailedwebhook.md
+++ b/sync-for-expenses/docs/models/shared/syncfailedwebhook.md
@@ -5,13 +5,13 @@ Webhook request body used to notify that a sync has failed.
## Fields
-| Field | Type | Required | Description | Example |
-| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
-| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | |
-| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | |
-| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | |
-| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
-| `data` | [Optional[shared.SyncFailedWebhookData]](../../models/shared/syncfailedwebhookdata.md) | :heavy_minus_sign: | N/A | |
-| `message` | *Optional[str]* | :heavy_minus_sign: | A human readable message about the webhook. | |
-| `rule_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the rule. | |
-| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | |
+| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | |
+| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | |
+| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
+| `data` | [Optional[shared.SyncFailedWebhookData]](../../models/shared/syncfailedwebhookdata.md) | :heavy_minus_sign: | N/A | |
+| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | |
+| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Unique identifier for the rule. | |
+| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/syncstartedwebhook.md b/sync-for-expenses/docs/models/shared/syncstartedwebhook.md
index 5c4d7a6db..53800da82 100644
--- a/sync-for-expenses/docs/models/shared/syncstartedwebhook.md
+++ b/sync-for-expenses/docs/models/shared/syncstartedwebhook.md
@@ -5,13 +5,13 @@ Webhook request body used to notify that a sync has started.
## Fields
-| Field | Type | Required | Description | Example |
-| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
-| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | |
-| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | |
-| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | |
-| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
-| `data` | [Optional[shared.Data]](../../models/shared/data.md) | :heavy_minus_sign: | N/A | |
-| `message` | *Optional[str]* | :heavy_minus_sign: | A human readable message about the webhook. | |
-| `rule_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the rule. | |
-| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | |
+| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | |
+| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | |
+| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
+| `data` | [Optional[shared.Data]](../../models/shared/data.md) | :heavy_minus_sign: | N/A | |
+| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | |
+| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Unique identifier for the rule. | |
+| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/transactions.md b/sync-for-expenses/docs/models/shared/transactions.md
index 7af32a396..374d23df5 100644
--- a/sync-for-expenses/docs/models/shared/transactions.md
+++ b/sync-for-expenses/docs/models/shared/transactions.md
@@ -3,10 +3,10 @@
## Fields
-| Field | Type | Required | Description | Example |
-| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {"self":{"href":"/companies/{id}/data/{dataType}"},"current":{"href":"/companies/{id}/data/{dataType}?page=1&pageSize=10"}} |
-| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
-| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
-| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
-| `results` | List[[shared.Transaction](../../models/shared/transaction.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} |
+| `page_number` | *int* | :heavy_check_mark: | Current page number. | |
+| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | |
+| `total_results` | *int* | :heavy_check_mark: | Total number of items. | |
+| `results` | List[[shared.Transaction](../../models/shared/transaction.md)] | :heavy_minus_sign: | N/A | |
\ No newline at end of file
diff --git a/sync-for-expenses/docs/models/shared/updatecustomerresponse.md b/sync-for-expenses/docs/models/shared/updatecustomerresponse.md
index aa815d737..b6ec24c36 100644
--- a/sync-for-expenses/docs/models/shared/updatecustomerresponse.md
+++ b/sync-for-expenses/docs/models/shared/updatecustomerresponse.md
@@ -14,7 +14,7 @@
| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | |
| `completed_on_utc` | *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 |
| `data` | [Optional[shared.UpdateCustomerResponseAccountingCustomer]](../../models/shared/updatecustomerresponseaccountingcustomer.md) | :heavy_minus_sign: | N/A | |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about the error. | |
| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | |
| ~~`timeout_in_seconds`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Number of seconds the push operation must complete within before it times out. | |
diff --git a/sync-for-expenses/docs/models/shared/updatesupplierresponse.md b/sync-for-expenses/docs/models/shared/updatesupplierresponse.md
index f90e6589f..aefc237bc 100644
--- a/sync-for-expenses/docs/models/shared/updatesupplierresponse.md
+++ b/sync-for-expenses/docs/models/shared/updatesupplierresponse.md
@@ -13,8 +13,8 @@
| `status_code` | *int* | :heavy_check_mark: | Push status code. | |
| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | |
| `completed_on_utc` | *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 |
-| `data` | [Optional[shared.UpdateSupplierResponseAccountingSupplier]](../../models/shared/updatesupplierresponseaccountingsupplier.md) | :heavy_minus_sign: | N/A | {"id":"C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F","supplierName":"Kelly's Industrial Supplies","contactName":"Kelly's Industrial Supplies","emailAddress":"sales@kellysupplies.com","phone":"07999 999999","addresses":[{"type":"Billing","line1":"Unit 51","line2":"Bakersfield Industrial Estate","city":"Bakersfield","region":"California","country":"USA","postalcode":"93308"}],"registrationNumber":"string","taxNumber":"string","status":"Unknown","defaultCurrency":"string","metadata":{"isDeleted":true},"supplementalData":{"content":{"property1":{"property1":null,"property2":null},"property2":{"property1":null,"property2":null}}},"modifiedDate":"2022-10-23T00:00:00Z","sourceModifiedDate":"2022-10-23T00:00:00Z"} |
-| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available Data types | invoices |
+| `data` | [Optional[shared.UpdateSupplierResponseAccountingSupplier]](../../models/shared/updatesupplierresponseaccountingsupplier.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} |
+| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices |
| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about the error. | |
| `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | |
| ~~`timeout_in_seconds`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Number of seconds the push operation must complete within before it times out. | |
diff --git a/sync-for-expenses/docs/sdks/accounts/README.md b/sync-for-expenses/docs/sdks/accounts/README.md
index 5aa34e8dd..b095e1805 100644
--- a/sync-for-expenses/docs/sdks/accounts/README.md
+++ b/sync-for-expenses/docs/sdks/accounts/README.md
@@ -45,6 +45,7 @@ res = s.accounts.create(req)
if res.create_account_response is not None:
# handle response
pass
+
```
### Parameters
@@ -100,6 +101,7 @@ res = s.accounts.get_create_model(req)
if res.push_option is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/companies/README.md b/sync-for-expenses/docs/sdks/companies/README.md
index b072d414f..15d5c0ac4 100644
--- a/sync-for-expenses/docs/sdks/companies/README.md
+++ b/sync-for-expenses/docs/sdks/companies/README.md
@@ -44,6 +44,7 @@ res = s.companies.create(req)
if res.company is not None:
# handle response
pass
+
```
### Parameters
@@ -90,9 +91,10 @@ req = operations.DeleteCompanyRequest(
res = s.companies.delete(req)
-if res.status_code == 200:
+if res is not None:
# handle response
pass
+
```
### Parameters
@@ -142,6 +144,7 @@ res = s.companies.get(req)
if res.company is not None:
# handle response
pass
+
```
### Parameters
@@ -192,6 +195,7 @@ res = s.companies.list(req)
if res.companies is not None:
# handle response
pass
+
```
### Parameters
@@ -241,6 +245,7 @@ res = s.companies.update(req)
if res.company is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/configuration/README.md b/sync-for-expenses/docs/sdks/configuration/README.md
index 3fab5ea58..d7ab63158 100644
--- a/sync-for-expenses/docs/sdks/configuration/README.md
+++ b/sync-for-expenses/docs/sdks/configuration/README.md
@@ -36,6 +36,7 @@ res = s.configuration.get(req)
if res.company_configuration is not None:
# handle response
pass
+
```
### Parameters
@@ -81,6 +82,7 @@ res = s.configuration.get_mapping_options(req)
if res.mapping_options is not None:
# handle response
pass
+
```
### Parameters
@@ -126,6 +128,7 @@ res = s.configuration.set(req)
if res.company_configuration is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/connections/README.md b/sync-for-expenses/docs/sdks/connections/README.md
index dbf903bc0..00b3687bf 100644
--- a/sync-for-expenses/docs/sdks/connections/README.md
+++ b/sync-for-expenses/docs/sdks/connections/README.md
@@ -41,6 +41,7 @@ res = s.connections.create(req)
if res.connection is not None:
# handle response
pass
+
```
### Parameters
@@ -86,6 +87,7 @@ res = s.connections.create_partner_expense_connection(req)
if res.connection is not None:
# handle response
pass
+
```
### Parameters
@@ -130,9 +132,10 @@ req = operations.DeleteConnectionRequest(
res = s.connections.delete(req)
-if res.status_code == 200:
+if res is not None:
# handle response
pass
+
```
### Parameters
@@ -179,6 +182,7 @@ res = s.connections.get(req)
if res.connection is not None:
# handle response
pass
+
```
### Parameters
@@ -227,6 +231,7 @@ res = s.connections.list(req)
if res.connections is not None:
# handle response
pass
+
```
### Parameters
@@ -273,6 +278,7 @@ res = s.connections.unlink(req)
if res.connection is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/customers/README.md b/sync-for-expenses/docs/sdks/customers/README.md
index 7a41675f9..3497595c2 100644
--- a/sync-for-expenses/docs/sdks/customers/README.md
+++ b/sync-for-expenses/docs/sdks/customers/README.md
@@ -47,6 +47,7 @@ res = s.customers.create(req)
if res.create_customer_response is not None:
# handle response
pass
+
```
### Parameters
@@ -100,6 +101,7 @@ res = s.customers.get(req)
if res.customer is not None:
# handle response
pass
+
```
### Parameters
@@ -153,6 +155,7 @@ res = s.customers.list(req)
if res.customers is not None:
# handle response
pass
+
```
### Parameters
@@ -209,6 +212,7 @@ res = s.customers.update(req)
if res.update_customer_response is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/expenses/README.md b/sync-for-expenses/docs/sdks/expenses/README.md
index 4e2edfb51..60be82e7d 100644
--- a/sync-for-expenses/docs/sdks/expenses/README.md
+++ b/sync-for-expenses/docs/sdks/expenses/README.md
@@ -8,7 +8,7 @@ Create expense datasets and upload receipts.
### Available Operations
* [create](#create) - Create expense transaction
-* [update](#update) - Update expense-transactions
+* [update](#update) - Update expense transactions
* [upload_attachment](#upload_attachment) - Upload attachment
## create
@@ -50,6 +50,7 @@ res = s.expenses.create(req)
if res.create_expense_response is not None:
# handle response
pass
+
```
### Parameters
@@ -103,6 +104,7 @@ res = s.expenses.update(req)
if res.update_expense_response is not None:
# handle response
pass
+
```
### Parameters
@@ -163,6 +165,7 @@ res = s.expenses.upload_attachment(req)
if res.attachment is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/managedata/README.md b/sync-for-expenses/docs/sdks/managedata/README.md
index 16bf2cb10..8b16e0602 100644
--- a/sync-for-expenses/docs/sdks/managedata/README.md
+++ b/sync-for-expenses/docs/sdks/managedata/README.md
@@ -38,6 +38,7 @@ res = s.manage_data.get(req)
if res.data_statuses is not None:
# handle response
pass
+
```
### Parameters
@@ -84,6 +85,7 @@ res = s.manage_data.get_pull_operation(req)
if res.pull_operation is not None:
# handle response
pass
+
```
### Parameters
@@ -132,6 +134,7 @@ res = s.manage_data.list_pull_operations(req)
if res.pull_operations is not None:
# handle response
pass
+
```
### Parameters
@@ -178,9 +181,10 @@ req = operations.RefreshAllDataTypesRequest(
res = s.manage_data.refresh_all_data_types(req)
-if res.status_code == 200:
+if res is not None:
# handle response
pass
+
```
### Parameters
@@ -229,6 +233,7 @@ res = s.manage_data.refresh_data_type(req)
if res.pull_operation is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/pushoperations/README.md b/sync-for-expenses/docs/sdks/pushoperations/README.md
index 2a9c8cd9b..2aedad000 100644
--- a/sync-for-expenses/docs/sdks/pushoperations/README.md
+++ b/sync-for-expenses/docs/sdks/pushoperations/README.md
@@ -36,6 +36,7 @@ res = s.push_operations.get(req)
if res.push_operation is not None:
# handle response
pass
+
```
### Parameters
@@ -84,6 +85,7 @@ res = s.push_operations.list(req)
if res.push_operations is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/suppliers/README.md b/sync-for-expenses/docs/sdks/suppliers/README.md
index 6ef547cc6..9aa71cfb0 100644
--- a/sync-for-expenses/docs/sdks/suppliers/README.md
+++ b/sync-for-expenses/docs/sdks/suppliers/README.md
@@ -85,6 +85,7 @@ res = s.suppliers.create(req)
if res.create_supplier_response is not None:
# handle response
pass
+
```
### Parameters
@@ -138,6 +139,7 @@ res = s.suppliers.get(req)
if res.supplier is not None:
# handle response
pass
+
```
### Parameters
@@ -191,6 +193,7 @@ res = s.suppliers.list(req)
if res.suppliers is not None:
# handle response
pass
+
```
### Parameters
@@ -285,6 +288,7 @@ res = s.suppliers.update(req)
if res.update_supplier_response is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/sync/README.md b/sync-for-expenses/docs/sdks/sync/README.md
index 78b835e28..adda37077 100644
--- a/sync-for-expenses/docs/sdks/sync/README.md
+++ b/sync-for-expenses/docs/sdks/sync/README.md
@@ -39,6 +39,7 @@ res = s.sync.get(req)
if res.company_sync_status is not None:
# handle response
pass
+
```
### Parameters
@@ -84,6 +85,7 @@ res = s.sync.get_last_successful_sync(req)
if res.company_sync_status is not None:
# handle response
pass
+
```
### Parameters
@@ -129,6 +131,7 @@ res = s.sync.get_latest_sync(req)
if res.company_sync_status is not None:
# handle response
pass
+
```
### Parameters
@@ -174,6 +177,7 @@ res = s.sync.initiate_sync(req)
if res.sync_initiated is not None:
# handle response
pass
+
```
### Parameters
@@ -219,6 +223,7 @@ res = s.sync.list(req)
if res.classes is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/docs/sdks/transactionstatus/README.md b/sync-for-expenses/docs/sdks/transactionstatus/README.md
index 1ae05e7c8..deb9e8bae 100644
--- a/sync-for-expenses/docs/sdks/transactionstatus/README.md
+++ b/sync-for-expenses/docs/sdks/transactionstatus/README.md
@@ -34,9 +34,10 @@ req = operations.GetSyncTransactionRequest(
res = s.transaction_status.get(req)
-if res.transaction is not None:
+if res.transaction_response is not None:
# handle response
pass
+
```
### Parameters
@@ -85,6 +86,7 @@ res = s.transaction_status.list(req)
if res.transactions is not None:
# handle response
pass
+
```
### Parameters
diff --git a/sync-for-expenses/gen.yaml b/sync-for-expenses/gen.yaml
index f9f485239..770df1274 100644
--- a/sync-for-expenses/gen.yaml
+++ b/sync-for-expenses/gen.yaml
@@ -7,9 +7,15 @@ generation:
nameResolutionDec2023: false
parameterOrderingFeb2024: false
requestResponseComponentNamesFeb2024: false
+ auth:
+ oAuth2ClientCredentialsEnabled: false
telemetryEnabled: true
python:
- version: 6.0.1
+ version: 6.1.0
+ additionalDependencies:
+ dependencies: {}
+ extraDependencies:
+ dev: {}
author: Codat
clientServerStatusCodesAsErrors: true
description: Push expenses to accounting platforms.
@@ -26,3 +32,4 @@ python:
maxMethodParams: 0
outputModelSuffix: output
packageName: codat-sync-for-expenses
+ responseFormat: envelope
diff --git a/sync-for-expenses/py.typed b/sync-for-expenses/py.typed
new file mode 100644
index 000000000..3e38f1a92
--- /dev/null
+++ b/sync-for-expenses/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561. The package enables type hints.
diff --git a/sync-for-expenses/pylintrc b/sync-for-expenses/pylintrc
index cebe76d49..0690edafd 100644
--- a/sync-for-expenses/pylintrc
+++ b/sync-for-expenses/pylintrc
@@ -180,6 +180,7 @@ good-names=i,
ex,
Run,
_,
+ e,
id
# Good variable names regexes, separated by a comma. If names match any regex,
diff --git a/sync-for-expenses/setup.py b/sync-for-expenses/setup.py
index 4211ef41a..2ce78bfb4 100644
--- a/sync-for-expenses/setup.py
+++ b/sync-for-expenses/setup.py
@@ -10,7 +10,7 @@
setuptools.setup(
name="codat-sync-for-expenses",
- version="6.0.1",
+ version="6.1.0",
author="Codat",
description="Push expenses to accounting platforms.",
long_description=long_description,
@@ -19,9 +19,9 @@
install_requires=[
"certifi>=2023.7.22",
"charset-normalizer>=3.2.0",
- "dataclasses-json-speakeasy>=0.5.11",
+ "dataclasses-json>=0.6.4",
"idna>=3.4",
- "jsonpath-python>=1.0.6 ",
+ "jsonpath-python>=1.0.6",
"marshmallow>=3.19.0",
"mypy-extensions>=1.0.0",
"packaging>=23.1",
@@ -33,7 +33,9 @@
"urllib3>=1.26.18",
],
extras_require={
- "dev":["pylint==2.16.2"]
+ "dev": [
+ "pylint==2.16.2",
+ ],
},
package_dir={'': 'src'},
python_requires='>=3.8',
diff --git a/sync-for-expenses/src/codatsyncexpenses/_hooks/__init__.py b/sync-for-expenses/src/codatsyncexpenses/_hooks/__init__.py
new file mode 100644
index 000000000..5fd985a8a
--- /dev/null
+++ b/sync-for-expenses/src/codatsyncexpenses/_hooks/__init__.py
@@ -0,0 +1,5 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+from .sdkhooks import *
+from .types import *
+from .registration import *
diff --git a/sync-for-expenses/src/codatsyncexpenses/_hooks/registration.py b/sync-for-expenses/src/codatsyncexpenses/_hooks/registration.py
new file mode 100644
index 000000000..1db6a5293
--- /dev/null
+++ b/sync-for-expenses/src/codatsyncexpenses/_hooks/registration.py
@@ -0,0 +1,13 @@
+from .types import Hooks
+
+
+# This file is only ever generated once on the first generation and then is free to be modified.
+# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them
+# in this file or in separate files in the hooks folder.
+
+
+def init_hooks(hooks: Hooks):
+ # pylint: disable=unused-argument
+ """Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook
+ with an instance of a hook that implements that specific Hook interface
+ Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance"""
diff --git a/sync-for-expenses/src/codatsyncexpenses/_hooks/sdkhooks.py b/sync-for-expenses/src/codatsyncexpenses/_hooks/sdkhooks.py
new file mode 100644
index 000000000..867a07412
--- /dev/null
+++ b/sync-for-expenses/src/codatsyncexpenses/_hooks/sdkhooks.py
@@ -0,0 +1,55 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+import requests
+from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks
+from .registration import init_hooks
+from typing import List, Optional, Tuple, Union
+
+
+class SDKHooks(Hooks):
+ def __init__(self):
+ self.sdk_init_hooks: List[SDKInitHook] = []
+ self.before_request_hooks: List[BeforeRequestHook] = []
+ self.after_success_hooks: List[AfterSuccessHook] = []
+ self.after_error_hooks: List[AfterErrorHook] = []
+ init_hooks(self)
+
+ def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
+ self.sdk_init_hooks.append(hook)
+
+ def register_before_request_hook(self, hook: BeforeRequestHook) -> None:
+ self.before_request_hooks.append(hook)
+
+ def register_after_success_hook(self, hook: AfterSuccessHook) -> None:
+ self.after_success_hooks.append(hook)
+
+ def register_after_error_hook(self, hook: AfterErrorHook) -> None:
+ self.after_error_hooks.append(hook)
+
+ def sdk_init(self, base_url: str, client: requests.Session) -> Tuple[str, requests.Session]:
+ for hook in self.sdk_init_hooks:
+ base_url, client = hook.sdk_init(base_url, client)
+ return base_url, client
+
+ def before_request(self, hook_ctx: BeforeRequestContext, request: requests.PreparedRequest) -> Union[requests.PreparedRequest, Exception]:
+ for hook in self.before_request_hooks:
+ request = hook.before_request(hook_ctx, request)
+ if isinstance(request, Exception):
+ raise request
+
+ return request
+
+ def after_success(self, hook_ctx: AfterSuccessContext, response: requests.Response) -> requests.Response:
+ for hook in self.after_success_hooks:
+ response = hook.after_success(hook_ctx, response)
+ if isinstance(response, Exception):
+ raise response
+ return response
+
+ def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests.Response], error: Optional[Exception]) -> Tuple[Optional[requests.Response], Optional[Exception]]:
+ for hook in self.after_error_hooks:
+ result = hook.after_error(hook_ctx, response, error)
+ if isinstance(result, Exception):
+ raise result
+ response, error = result
+ return response, error
diff --git a/sync-for-expenses/src/codatsyncexpenses/_hooks/types.py b/sync-for-expenses/src/codatsyncexpenses/_hooks/types.py
new file mode 100644
index 000000000..d2fa8629f
--- /dev/null
+++ b/sync-for-expenses/src/codatsyncexpenses/_hooks/types.py
@@ -0,0 +1,70 @@
+"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+
+import requests as requests_http
+from abc import ABC, abstractmethod
+from typing import Any, Callable, List, Optional, Tuple, Union
+
+
+class HookContext:
+ operation_id: str
+ oauth2_scopes: Optional[List[str]] = None
+ security_source: Optional[Union[Any, Callable[[], Any]]] = None
+
+ def __init__(self, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]]):
+ self.operation_id = operation_id
+ self.oauth2_scopes = oauth2_scopes
+ self.security_source = security_source
+
+
+class BeforeRequestContext(HookContext):
+ pass
+
+
+class AfterSuccessContext(HookContext):
+ pass
+
+
+class AfterErrorContext(HookContext):
+ pass
+
+
+class SDKInitHook(ABC):
+ @abstractmethod
+ def sdk_init(self, base_url: str, client: requests_http.Session) -> Tuple[str, requests_http.Session]:
+ pass
+
+
+class BeforeRequestHook(ABC):
+ @abstractmethod
+ def before_request(self, hook_ctx: BeforeRequestContext, request: requests_http.PreparedRequest) -> Union[requests_http.PreparedRequest, Exception]:
+ pass
+
+
+class AfterSuccessHook(ABC):
+ @abstractmethod
+ def after_success(self, hook_ctx: AfterSuccessContext, response: requests_http.Response) -> Union[requests_http.PreparedRequest, Exception]:
+ pass
+
+
+class AfterErrorHook(ABC):
+ @abstractmethod
+ def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests_http.Response], error: Optional[Exception]) -> Union[Tuple[Optional[requests_http.PreparedRequest], Optional[Exception]], Exception]:
+ pass
+
+
+class Hooks(ABC):
+ @abstractmethod
+ def register_sdk_init_hook(self, hook: SDKInitHook):
+ pass
+
+ @abstractmethod
+ def register_before_request_hook(self, hook: BeforeRequestHook):
+ pass
+
+ @abstractmethod
+ def register_after_success_hook(self, hook: AfterSuccessHook):
+ pass
+
+ @abstractmethod
+ def register_after_error_hook(self, hook: AfterErrorHook):
+ pass
diff --git a/sync-for-expenses/src/codatsyncexpenses/accounts.py b/sync-for-expenses/src/codatsyncexpenses/accounts.py
index 361987542..e5be38ccf 100644
--- a/sync-for-expenses/src/codatsyncexpenses/accounts.py
+++ b/sync-for-expenses/src/codatsyncexpenses/accounts.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -26,21 +28,23 @@ def create(self, request: operations.CreateAccountRequest, retries: Optional[uti
Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=chartOfAccounts) for integrations that support creating an account.
"""
+ hook_ctx = HookContext(operation_id='create-account', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CreateAccountRequest, base_url, '/companies/{companyId}/connections/{connectionId}/push/accounts', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.CreateAccountRequest, "account_prototype", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
- query_params = utils.get_query_params(operations.CreateAccountRequest, request)
+ query_params = { **utils.get_query_params(operations.CreateAccountRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -50,33 +54,58 @@ def create(self, request: operations.CreateAccountRequest, retries: Optional[uti
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, params=query_params, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreateAccountResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreateAccountResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CreateAccountResponse])
res.create_account_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -94,17 +123,19 @@ def get_create_model(self, request: operations.GetCreateChartOfAccountsModelRequ
Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=chartOfAccounts) for integrations that support creating an account.
"""
+ hook_ctx = HookContext(operation_id='get-create-chartOfAccounts-model', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetCreateChartOfAccountsModelRequest, base_url, '/companies/{companyId}/connections/{connectionId}/options/chartOfAccounts', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -114,33 +145,58 @@ def get_create_model(self, request: operations.GetCreateChartOfAccountsModelRequ
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetCreateChartOfAccountsModelResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetCreateChartOfAccountsModelResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.PushOption])
res.push_option = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/companies.py b/sync-for-expenses/src/codatsyncexpenses/companies.py
index ef227f1ce..6f78de06c 100644
--- a/sync-for-expenses/src/codatsyncexpenses/companies.py
+++ b/sync-for-expenses/src/codatsyncexpenses/companies.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -23,20 +25,22 @@ def create(self, request: Optional[shared.CompanyRequestBody], retries: Optional
If forbidden characters (see `name` pattern) are present in the request, a company will be created with the forbidden characters removed. For example, `Company (Codat[1])` with be created as `Company Codat1`.
"""
+ hook_ctx = HookContext(operation_id='create-company', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/companies'
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, Optional[shared.CompanyRequestBody], "request", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -46,33 +50,58 @@ def create(self, request: Optional[shared.CompanyRequestBody], retries: Optional
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreateCompanyResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreateCompanyResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Company])
res.company = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -85,17 +114,19 @@ def delete(self, request: operations.DeleteCompanyRequest, retries: Optional[uti
A [company](https://docs.codat.io/sync-for-expenses-api#/schemas/Company) represents a business sharing access to their data.
Each company can have multiple [connections](https://docs.codat.io/sync-for-expenses-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
"""
+ hook_ctx = HookContext(operation_id='delete-company', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.DeleteCompanyRequest, base_url, '/companies/{companyId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -105,29 +136,53 @@ def delete(self, request: operations.DeleteCompanyRequest, retries: Optional[uti
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('DELETE', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.DeleteCompanyResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.DeleteCompanyResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 204:
pass
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -140,17 +195,19 @@ def get(self, request: operations.GetCompanyRequest, retries: Optional[utils.Ret
A [company](https://docs.codat.io/sync-for-expenses-api#/schemas/Company) represents a business sharing access to their data.
Each company can have multiple [connections](https://docs.codat.io/sync-for-expenses-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
"""
+ hook_ctx = HookContext(operation_id='get-company', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetCompanyRequest, base_url, '/companies/{companyId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -160,33 +217,58 @@ def get(self, request: operations.GetCompanyRequest, retries: Optional[utils.Ret
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetCompanyResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetCompanyResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Company])
res.company = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -199,18 +281,20 @@ def list(self, request: operations.ListCompaniesRequest, retries: Optional[utils
A [company](https://docs.codat.io/sync-for-expenses-api#/schemas/Company) represents a business sharing access to their data.
Each company can have multiple [connections](https://docs.codat.io/sync-for-expenses-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
"""
+ hook_ctx = HookContext(operation_id='list-companies', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = base_url + '/companies'
- headers = {}
- query_params = utils.get_query_params(operations.ListCompaniesRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListCompaniesRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -220,33 +304,58 @@ def list(self, request: operations.ListCompaniesRequest, retries: Optional[utils
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListCompaniesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListCompaniesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Companies])
res.companies = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -260,20 +369,22 @@ def update(self, request: operations.UpdateCompanyRequest, retries: Optional[uti
A [company](https://docs.codat.io/sync-for-expenses-api#/schemas/Company) represents a business sharing access to their data.
Each company can have multiple [connections](https://docs.codat.io/sync-for-expenses-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
"""
+ hook_ctx = HookContext(operation_id='update-company', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UpdateCompanyRequest, base_url, '/companies/{companyId}', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.UpdateCompanyRequest, "company_request_body", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -283,33 +394,58 @@ def update(self, request: operations.UpdateCompanyRequest, retries: Optional[uti
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('PUT', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('PUT', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.UpdateCompanyResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.UpdateCompanyResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Company])
res.company = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/configuration.py b/sync-for-expenses/src/codatsyncexpenses/configuration.py
index 4426e34a9..0ac182dee 100644
--- a/sync-for-expenses/src/codatsyncexpenses/configuration.py
+++ b/sync-for-expenses/src/codatsyncexpenses/configuration.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -18,17 +20,19 @@ def get(self, request: operations.GetCompanyConfigurationRequest, retries: Optio
r"""Get company configuration
Gets a companies expense sync configuration
"""
+ hook_ctx = HookContext(operation_id='get-company-configuration', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetCompanyConfigurationRequest, base_url, '/companies/{companyId}/sync/expenses/config', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -38,33 +42,58 @@ def get(self, request: operations.GetCompanyConfigurationRequest, retries: Optio
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetCompanyConfigurationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetCompanyConfigurationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CompanyConfiguration])
res.company_configuration = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -74,17 +103,19 @@ def get_mapping_options(self, request: operations.GetMappingOptionsRequest, retr
r"""Mapping options
Gets the expense mapping options for a companies accounting software
"""
+ hook_ctx = HookContext(operation_id='get-mapping-options', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetMappingOptionsRequest, base_url, '/companies/{companyId}/sync/expenses/mappingOptions', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -94,33 +125,58 @@ def get_mapping_options(self, request: operations.GetMappingOptionsRequest, retr
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetMappingOptionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetMappingOptionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.MappingOptions])
res.mapping_options = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -130,20 +186,22 @@ def set(self, request: operations.SetCompanyConfigurationRequest, retries: Optio
r"""Set company configuration
Sets a companies expense sync configuration
"""
+ hook_ctx = HookContext(operation_id='set-company-configuration', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.SetCompanyConfigurationRequest, base_url, '/companies/{companyId}/sync/expenses/config', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.SetCompanyConfigurationRequest, "company_configuration", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -153,33 +211,58 @@ def set(self, request: operations.SetCompanyConfigurationRequest, retries: Optio
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.SetCompanyConfigurationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.SetCompanyConfigurationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CompanyConfiguration])
res.company_configuration = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/connections.py b/sync-for-expenses/src/codatsyncexpenses/connections.py
index 18baf5320..a80fc0cc7 100644
--- a/sync-for-expenses/src/codatsyncexpenses/connections.py
+++ b/sync-for-expenses/src/codatsyncexpenses/connections.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -20,20 +22,22 @@ def create(self, request: operations.CreateConnectionRequest, retries: Optional[
Use the [List Integrations](https://docs.codat.io/sync-for-expenses-api#/operations/list-integrations) endpoint to access valid platform keys.
"""
+ hook_ctx = HookContext(operation_id='create-connection', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CreateConnectionRequest, base_url, '/companies/{companyId}/connections', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.CreateConnectionRequest, "request_body", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -43,33 +47,58 @@ def create(self, request: operations.CreateConnectionRequest, retries: Optional[
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreateConnectionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreateConnectionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Connection])
res.connection = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -79,17 +108,19 @@ def create_partner_expense_connection(self, request: operations.CreatePartnerExp
r"""Create partner expense connection
Creates a partner expense data connection
"""
+ hook_ctx = HookContext(operation_id='create-partner-expense-connection', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CreatePartnerExpenseConnectionRequest, base_url, '/companies/{companyId}/sync/expenses/connections/partnerExpense', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -99,33 +130,58 @@ def create_partner_expense_connection(self, request: operations.CreatePartnerExp
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreatePartnerExpenseConnectionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreatePartnerExpenseConnectionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Connection])
res.connection = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -136,17 +192,19 @@ def delete(self, request: operations.DeleteConnectionRequest, retries: Optional[
Revoke and remove a connection from a company.
This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company.
"""
+ hook_ctx = HookContext(operation_id='delete-connection', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.DeleteConnectionRequest, base_url, '/companies/{companyId}/connections/{connectionId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -156,29 +214,53 @@ def delete(self, request: operations.DeleteConnectionRequest, retries: Optional[
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('DELETE', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.DeleteConnectionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.DeleteConnectionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
pass
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -188,17 +270,19 @@ def get(self, request: operations.GetConnectionRequest, retries: Optional[utils.
r"""Get connection
Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned.
"""
+ hook_ctx = HookContext(operation_id='get-connection', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetConnectionRequest, base_url, '/companies/{companyId}/connections/{connectionId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -208,33 +292,58 @@ def get(self, request: operations.GetConnectionRequest, retries: Optional[utils.
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetConnectionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetConnectionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Connection])
res.connection = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -244,18 +353,20 @@ def list(self, request: operations.ListConnectionsRequest, retries: Optional[uti
r"""List connections
List the connections for a company.
"""
+ hook_ctx = HookContext(operation_id='list-connections', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListConnectionsRequest, base_url, '/companies/{companyId}/connections', request)
- headers = {}
- query_params = utils.get_query_params(operations.ListConnectionsRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListConnectionsRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -265,33 +376,58 @@ def list(self, request: operations.ListConnectionsRequest, retries: Optional[uti
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListConnectionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListConnectionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Connections])
res.connections = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -301,20 +437,22 @@ def unlink(self, request: operations.UnlinkConnectionRequest, retries: Optional[
r"""Unlink connection
This allows you to deauthorize a connection, without deleting it from Codat. This means you can still view any data that has previously been pulled into Codat, and also lets you re-authorize in future if your customer wishes to resume sharing their data.
"""
+ hook_ctx = HookContext(operation_id='unlink-connection', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UnlinkConnectionRequest, base_url, '/companies/{companyId}/connections/{connectionId}', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.UnlinkConnectionRequest, "request_body", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -324,33 +462,58 @@ def unlink(self, request: operations.UnlinkConnectionRequest, retries: Optional[
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('PATCH', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('PATCH', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.UnlinkConnectionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.UnlinkConnectionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Connection])
res.connection = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/customers.py b/sync-for-expenses/src/codatsyncexpenses/customers.py
index 1341c8430..5c8c2b67e 100644
--- a/sync-for-expenses/src/codatsyncexpenses/customers.py
+++ b/sync-for-expenses/src/codatsyncexpenses/customers.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -26,21 +28,23 @@ def create(self, request: operations.CreateCustomerRequest, retries: Optional[ut
Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support creating an account.
"""
+ hook_ctx = HookContext(operation_id='create-customer', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CreateCustomerRequest, base_url, '/companies/{companyId}/connections/{connectionId}/push/customers', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.CreateCustomerRequest, "customer", True, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
- query_params = utils.get_query_params(operations.CreateCustomerRequest, request)
+ query_params = { **utils.get_query_params(operations.CreateCustomerRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -50,33 +54,58 @@ def create(self, request: operations.CreateCustomerRequest, retries: Optional[ut
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, params=query_params, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreateCustomerResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreateCustomerResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CreateCustomerResponse])
res.create_customer_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -92,17 +121,19 @@ def get(self, request: operations.GetCustomerRequest, retries: Optional[utils.Re
Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-expenses-api#/operations/refresh-company-data).
"""
+ hook_ctx = HookContext(operation_id='get-customer', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetCustomerRequest, base_url, '/companies/{companyId}/data/customers/{customerId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -112,33 +143,58 @@ def get(self, request: operations.GetCustomerRequest, retries: Optional[utils.Re
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','409','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetCustomerResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetCustomerResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Customer])
res.customer = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 409, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -152,18 +208,20 @@ def list(self, request: operations.ListCustomersRequest, retries: Optional[utils
Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-expenses-api#/operations/refresh-company-data).
"""
+ hook_ctx = HookContext(operation_id='list-customers', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListCustomersRequest, base_url, '/companies/{companyId}/data/customers', request)
- headers = {}
- query_params = utils.get_query_params(operations.ListCustomersRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListCustomersRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -173,33 +231,58 @@ def list(self, request: operations.ListCustomersRequest, retries: Optional[utils
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','409','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListCustomersResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListCustomersResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Customers])
res.customers = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 409, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -217,21 +300,23 @@ def update(self, request: operations.UpdateCustomerRequest, retries: Optional[ut
Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support creating an account.
"""
+ hook_ctx = HookContext(operation_id='update-customer', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UpdateCustomerRequest, base_url, '/companies/{companyId}/connections/{connectionId}/push/customers/{customerId}', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.UpdateCustomerRequest, "customer", True, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
- query_params = utils.get_query_params(operations.UpdateCustomerRequest, request)
+ query_params = { **utils.get_query_params(operations.UpdateCustomerRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -241,33 +326,58 @@ def update(self, request: operations.UpdateCustomerRequest, retries: Optional[ut
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('PUT', url, params=query_params, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('PUT', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.UpdateCustomerResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.UpdateCustomerResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.UpdateCustomerResponse])
res.update_customer_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/expenses.py b/sync-for-expenses/src/codatsyncexpenses/expenses.py
index de8082b6f..3b55b64fe 100644
--- a/sync-for-expenses/src/codatsyncexpenses/expenses.py
+++ b/sync-for-expenses/src/codatsyncexpenses/expenses.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -32,20 +34,22 @@ def create(self, request: operations.CreateExpenseTransactionRequest, retries: O
| Xero | No | - |
| NetSuite | No | - |
"""
+ hook_ctx = HookContext(operation_id='create-expense-transaction', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CreateExpenseTransactionRequest, base_url, '/companies/{companyId}/sync/expenses/data/expense-transactions', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.CreateExpenseTransactionRequest, "create_expense_request", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -55,40 +59,65 @@ def create(self, request: operations.CreateExpenseTransactionRequest, retries: O
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreateExpenseTransactionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreateExpenseTransactionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CreateExpenseResponse])
res.create_expense_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
def update(self, request: operations.UpdateExpenseTransactionRequest, retries: Optional[utils.RetryConfig] = None) -> operations.UpdateExpenseTransactionResponse:
- r"""Update expense-transactions
+ r"""Update expense transactions
The *Update expense* endpoint updates an existing [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting platform for a given company's connection.
[Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card.
@@ -98,20 +127,22 @@ def update(self, request: operations.UpdateExpenseTransactionRequest, retries: O
At the moment you can update expenses only for Xero ([Payment](https://docs.codat.io/expenses/sync-process/expense-transactions#transaction-types) transaction type only).
"""
+ hook_ctx = HookContext(operation_id='update-expense-transaction', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UpdateExpenseTransactionRequest, base_url, '/companies/{companyId}/sync/expenses/expense-transactions/{transactionId}', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.UpdateExpenseTransactionRequest, "update_expense_request", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -121,33 +152,58 @@ def update(self, request: operations.UpdateExpenseTransactionRequest, retries: O
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('PUT', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('PUT', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','422','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.UpdateExpenseTransactionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.UpdateExpenseTransactionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 202:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.UpdateExpenseResponse])
res.update_expense_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 422, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -170,20 +226,22 @@ def upload_attachment(self, request: operations.UploadExpenseAttachmentRequest,
| NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP |
| Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that \"You can attach any type of file, such as text, image, or video files\". |
"""
+ hook_ctx = HookContext(operation_id='upload-expense-attachment', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UploadExpenseAttachmentRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}/attachments', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.UploadExpenseAttachmentRequest, "attachment_upload", False, True, 'multipart')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -193,33 +251,58 @@ def upload_attachment(self, request: operations.UploadExpenseAttachmentRequest,
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.UploadExpenseAttachmentResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.UploadExpenseAttachmentResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Attachment])
res.attachment = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/manage_data.py b/sync-for-expenses/src/codatsyncexpenses/manage_data.py
index f45ff0d2d..0faee83d7 100644
--- a/sync-for-expenses/src/codatsyncexpenses/manage_data.py
+++ b/sync-for-expenses/src/codatsyncexpenses/manage_data.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Dict, Optional
@@ -18,17 +20,19 @@ def get(self, request: operations.GetDataStatusRequest, retries: Optional[utils.
r"""Get data status
Get the state of each data type for a company
"""
+ hook_ctx = HookContext(operation_id='get-data-status', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetDataStatusRequest, base_url, '/companies/{companyId}/dataStatus', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -38,33 +42,58 @@ def get(self, request: operations.GetDataStatusRequest, retries: Optional[utils.
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetDataStatusResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetDataStatusResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[Dict[str, shared.DataStatus]])
res.data_statuses = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -74,17 +103,19 @@ def get_pull_operation(self, request: operations.GetPullOperationRequest, retrie
r"""Get pull operation
Retrieve information about a single dataset or pull operation.
"""
+ hook_ctx = HookContext(operation_id='get-pull-operation', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetPullOperationRequest, base_url, '/companies/{companyId}/data/history/{datasetId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -94,33 +125,58 @@ def get_pull_operation(self, request: operations.GetPullOperationRequest, retrie
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetPullOperationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetPullOperationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.PullOperation])
res.pull_operation = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -130,18 +186,20 @@ def list_pull_operations(self, request: operations.ListPullOperationsRequest, re
r"""List pull operations
Gets the pull operation history (datasets) for a given company.
"""
+ hook_ctx = HookContext(operation_id='list-pull-operations', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListPullOperationsRequest, base_url, '/companies/{companyId}/data/history', request)
- headers = {}
- query_params = utils.get_query_params(operations.ListPullOperationsRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListPullOperationsRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -151,33 +209,58 @@ def list_pull_operations(self, request: operations.ListPullOperationsRequest, re
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListPullOperationsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListPullOperationsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.PullOperations])
res.pull_operations = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -191,17 +274,19 @@ def refresh_all_data_types(self, request: operations.RefreshAllDataTypesRequest,
[Read more](https://docs.codat.io/core-concepts/data-type-settings) about data type settings and `fetch on first link`.
"""
+ hook_ctx = HookContext(operation_id='refresh-all-data-types', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.RefreshAllDataTypesRequest, base_url, '/companies/{companyId}/data/all', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -211,29 +296,53 @@ def refresh_all_data_types(self, request: operations.RefreshAllDataTypesRequest,
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.RefreshAllDataTypesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.RefreshAllDataTypesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 204:
pass
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -245,18 +354,20 @@ def refresh_data_type(self, request: operations.RefreshDataTypeRequest, retries:
This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view.
"""
+ hook_ctx = HookContext(operation_id='refresh-data-type', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.RefreshDataTypeRequest, base_url, '/companies/{companyId}/data/queue/{dataType}', request)
- headers = {}
- query_params = utils.get_query_params(operations.RefreshDataTypeRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.RefreshDataTypeRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -266,33 +377,58 @@ def refresh_data_type(self, request: operations.RefreshDataTypeRequest, retries:
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.RefreshDataTypeResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.RefreshDataTypeResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.PullOperation])
res.pull_operation = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py b/sync-for-expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py
index ac6252673..c8559d9bc 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py
@@ -4,7 +4,7 @@
import dataclasses
import requests as requests_http
from ...models.shared import transaction as shared_transaction
-from typing import Optional
+from typing import List, Optional
@dataclasses.dataclass
@@ -27,7 +27,7 @@ class GetSyncTransactionResponse:
r"""HTTP response status code for this operation"""
raw_response: requests_http.Response = dataclasses.field()
r"""Raw HTTP response; suitable for custom response parsing"""
- transaction: Optional[shared_transaction.Transaction] = dataclasses.field(default=None)
+ transaction_response: Optional[List[shared_transaction.Transaction]] = dataclasses.field(default=None)
r"""Success"""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitreachedwebhook.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitreachedwebhook.py
index 41772ea8e..ae0fc1fc7 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitreachedwebhook.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitreachedwebhook.py
@@ -20,9 +20,12 @@ class ClientRateLimitReachedWebhook:
r"""Name of your client in Codat."""
data: Optional[ClientRateLimitReachedWebhookData] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Data'), 'exclude': lambda f: f is None }})
message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Message'), 'exclude': lambda f: f is None }})
- r"""A human readable message about the webhook."""
+ r"""A human-readable message about the webhook."""
rule_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleId'), 'exclude': lambda f: f is None }})
- r"""Unique identifier for the rule."""
+ r"""Unique identifier for the rule.
+
+ Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ """
rule_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleType'), 'exclude': lambda f: f is None }})
r"""The type of rule."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhook.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhook.py
index fe52b7e68..28acbe5ff 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhook.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhook.py
@@ -20,9 +20,12 @@ class ClientRateLimitResetWebhook:
r"""Name of your client in Codat."""
data: Optional[ClientRateLimitResetWebhookData] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Data'), 'exclude': lambda f: f is None }})
message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Message'), 'exclude': lambda f: f is None }})
- r"""A human readable message about the webhook."""
+ r"""A human-readable message about the webhook."""
rule_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleId'), 'exclude': lambda f: f is None }})
- r"""Unique identifier for the rule."""
+ r"""Unique identifier for the rule.
+
+ Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ """
rule_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleType'), 'exclude': lambda f: f is None }})
r"""The type of rule."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhookdata.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhookdata.py
index 12df09270..735f8dc1b 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhookdata.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/clientratelimitresetwebhookdata.py
@@ -35,7 +35,7 @@ class ClientRateLimitResetWebhookData:
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
"""
quota_remaining: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('QuotaRemaining'), 'exclude': lambda f: f is ClientRateLimitResetWebhookData.UNSET }})
- r"""Total number of request remaining for your client."""
+ r"""Total number of requests remaining for your client."""
reset_reason: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ResetReason'), 'exclude': lambda f: f is None }})
r"""The reason for your rate limit quota being reset."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/contact.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/contact.py
index 7d7f8b977..9b95c5519 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/contact.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/contact.py
@@ -13,10 +13,11 @@
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class Phone:
- number: Optional[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('number') }})
- r"""A phone number."""
+ UNSET='__SPEAKEASY_UNSET__'
type: PhoneNumberType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type') }})
r"""The type of phone number"""
+ number: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('number'), 'exclude': lambda f: f is Phone.UNSET }})
+ r"""A phone number."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/createaccountresponse.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/createaccountresponse.py
index 83e9a3da8..3a22ba516 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/createaccountresponse.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/createaccountresponse.py
@@ -223,7 +223,7 @@ class CreateAccountResponse:
"""
data: Optional[AccountingAccount] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('data'), 'exclude': lambda f: f is CreateAccountResponse.UNSET }})
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
error_message: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('errorMessage'), 'exclude': lambda f: f is CreateAccountResponse.UNSET }})
r"""A message about the error."""
timeout_in_minutes: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('timeoutInMinutes'), 'exclude': lambda f: f is CreateAccountResponse.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/createcustomerresponse.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/createcustomerresponse.py
index b00cefbfa..7499ea1ad 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/createcustomerresponse.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/createcustomerresponse.py
@@ -153,7 +153,7 @@ class CreateCustomerResponse:
"""
data: Optional[AccountingCustomer] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('data'), 'exclude': lambda f: f is CreateCustomerResponse.UNSET }})
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
error_message: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('errorMessage'), 'exclude': lambda f: f is CreateCustomerResponse.UNSET }})
r"""A message about the error."""
timeout_in_minutes: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('timeoutInMinutes'), 'exclude': lambda f: f is CreateCustomerResponse.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/createsupplierresponse.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/createsupplierresponse.py
index fe6a6a51d..bc3ed6c88 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/createsupplierresponse.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/createsupplierresponse.py
@@ -119,7 +119,7 @@ class CreateSupplierResponse:
"""
data: Optional[AccountingSupplier] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('data'), 'exclude': lambda f: f is CreateSupplierResponse.UNSET }})
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
error_message: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('errorMessage'), 'exclude': lambda f: f is CreateSupplierResponse.UNSET }})
r"""A message about the error."""
timeout_in_minutes: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('timeoutInMinutes'), 'exclude': lambda f: f is CreateSupplierResponse.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/datastatus.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/datastatus.py
index ef2e3a05d..136aa029f 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/datastatus.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/datastatus.py
@@ -8,7 +8,7 @@
from typing import Optional
class DataTypes(str, Enum):
- r"""Available Data types"""
+ r"""Available data types"""
ACCOUNT_TRANSACTIONS = 'accountTransactions'
BALANCE_SHEET = 'balanceSheet'
BANK_ACCOUNTS = 'bankAccounts'
@@ -61,7 +61,7 @@ class DataStatus:
current_status: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currentStatus') }})
r"""The current status of the dataset in Codat's cache."""
data_type: DataTypes = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType') }})
- r"""Available Data types"""
+ r"""Available data types"""
last_successful_sync: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lastSuccessfulSync') }})
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:
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/datatype.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/datatype.py
index df149bcf0..76eee21a3 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/datatype.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/datatype.py
@@ -4,7 +4,7 @@
from enum import Enum
class DataType(str, Enum):
- r"""Available Data types"""
+ r"""Available data types"""
ACCOUNT_TRANSACTIONS = 'accountTransactions'
BALANCE_SHEET = 'balanceSheet'
BANK_ACCOUNTS = 'bankAccounts'
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/expensetransactionline.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/expensetransactionline.py
index 2dafe7a03..1ceafc082 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/expensetransactionline.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/expensetransactionline.py
@@ -18,10 +18,10 @@ class ExpenseTransactionLine:
account_ref: RecordRef = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('accountRef') }})
net_amount: Decimal = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('netAmount'), 'encoder': utils.decimalencoder(False, False), 'decoder': utils.decimaldecoder }})
r"""Amount of the line, exclusive of tax."""
- tax_amount: Decimal = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('taxAmount'), 'encoder': utils.decimalencoder(False, False), 'decoder': utils.decimaldecoder }})
- r"""Amount of tax for the line."""
invoice_to: Optional[InvoiceTo] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoiceTo'), 'exclude': lambda f: f is ExpenseTransactionLine.UNSET }})
r"""Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO."""
+ tax_amount: Optional[Decimal] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('taxAmount'), 'encoder': utils.decimalencoder(True, False), 'decoder': utils.decimaldecoder, 'exclude': lambda f: f is None }})
+ r"""Amount of tax for the line."""
tax_rate_ref: Optional[RecordRef] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('taxRateRef'), 'exclude': lambda f: f is None }})
tracking_refs: Optional[List[TrackingRef]] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('trackingRefs'), 'exclude': lambda f: f is ExpenseTransactionLine.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperation.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperation.py
index 9171dc7da..b76c6b38d 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperation.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperation.py
@@ -70,7 +70,7 @@ class PushOperation:
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
"""
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
error_message: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('errorMessage'), 'exclude': lambda f: f is PushOperation.UNSET }})
r"""A message about the error."""
timeout_in_minutes: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('timeoutInMinutes'), 'exclude': lambda f: f is PushOperation.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperationref.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperationref.py
index c0c1c3349..7f00006bf 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperationref.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/pushoperationref.py
@@ -12,7 +12,7 @@
@dataclasses.dataclass
class PushOperationRef:
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }})
r"""Unique identifier for a push operation."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/schema_datatype.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/schema_datatype.py
index c6811c63c..38faff212 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/schema_datatype.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/schema_datatype.py
@@ -4,7 +4,7 @@
from enum import Enum
class SchemaDataType(str, Enum):
- r"""Available Data types"""
+ r"""Available data types"""
ACCOUNT_TRANSACTIONS = 'accountTransactions'
BALANCE_SHEET = 'balanceSheet'
BANK_ACCOUNTS = 'bankAccounts'
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py
index 65a08ea16..9957235eb 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py
@@ -22,9 +22,12 @@ class SyncCompleteWebhook:
r"""Unique identifier for your SMB in Codat."""
data: Optional[SyncCompleteWebhookData] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Data'), 'exclude': lambda f: f is None }})
message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Message'), 'exclude': lambda f: f is None }})
- r"""A human readable message about the webhook."""
+ r"""A human-readable message about the webhook."""
rule_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleId'), 'exclude': lambda f: f is None }})
- r"""Unique identifier for the rule."""
+ r"""Unique identifier for the rule.
+
+ Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ """
rule_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleType'), 'exclude': lambda f: f is None }})
r"""The type of rule."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py
index f4175f3c6..61e5a090c 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py
@@ -22,9 +22,12 @@ class SyncFailedWebhook:
r"""Unique identifier for your SMB in Codat."""
data: Optional[SyncFailedWebhookData] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Data'), 'exclude': lambda f: f is None }})
message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Message'), 'exclude': lambda f: f is None }})
- r"""A human readable message about the webhook."""
+ r"""A human-readable message about the webhook."""
rule_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleId'), 'exclude': lambda f: f is None }})
- r"""Unique identifier for the rule."""
+ r"""Unique identifier for the rule.
+
+ Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ """
rule_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleType'), 'exclude': lambda f: f is None }})
r"""The type of rule."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py
index e96a5796f..1a0aa5d59 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py
@@ -32,9 +32,12 @@ class SyncStartedWebhook:
r"""Unique identifier for your SMB in Codat."""
data: Optional[Data] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Data'), 'exclude': lambda f: f is None }})
message: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('Message'), 'exclude': lambda f: f is None }})
- r"""A human readable message about the webhook."""
+ r"""A human-readable message about the webhook."""
rule_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleId'), 'exclude': lambda f: f is None }})
- r"""Unique identifier for the rule."""
+ r"""Unique identifier for the rule.
+
+ Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ """
rule_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('RuleType'), 'exclude': lambda f: f is None }})
r"""The type of rule."""
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/updatecustomerresponse.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/updatecustomerresponse.py
index e895ac1aa..e39b20a32 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/updatecustomerresponse.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/updatecustomerresponse.py
@@ -153,7 +153,7 @@ class UpdateCustomerResponse:
"""
data: Optional[UpdateCustomerResponseAccountingCustomer] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('data'), 'exclude': lambda f: f is UpdateCustomerResponse.UNSET }})
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
error_message: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('errorMessage'), 'exclude': lambda f: f is UpdateCustomerResponse.UNSET }})
r"""A message about the error."""
timeout_in_minutes: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('timeoutInMinutes'), 'exclude': lambda f: f is UpdateCustomerResponse.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/models/shared/updatesupplierresponse.py b/sync-for-expenses/src/codatsyncexpenses/models/shared/updatesupplierresponse.py
index ff3928568..25fdf892f 100644
--- a/sync-for-expenses/src/codatsyncexpenses/models/shared/updatesupplierresponse.py
+++ b/sync-for-expenses/src/codatsyncexpenses/models/shared/updatesupplierresponse.py
@@ -119,7 +119,7 @@ class UpdateSupplierResponse:
"""
data: Optional[UpdateSupplierResponseAccountingSupplier] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('data'), 'exclude': lambda f: f is UpdateSupplierResponse.UNSET }})
data_type: Optional[DataType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataType'), 'exclude': lambda f: f is None }})
- r"""Available Data types"""
+ r"""Available data types"""
error_message: Optional[str] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('errorMessage'), 'exclude': lambda f: f is UpdateSupplierResponse.UNSET }})
r"""A message about the error."""
timeout_in_minutes: Optional[int] = dataclasses.field(default=UNSET, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('timeoutInMinutes'), 'exclude': lambda f: f is UpdateSupplierResponse.UNSET }})
diff --git a/sync-for-expenses/src/codatsyncexpenses/push_operations.py b/sync-for-expenses/src/codatsyncexpenses/push_operations.py
index 961ebaa62..287d2dd33 100644
--- a/sync-for-expenses/src/codatsyncexpenses/push_operations.py
+++ b/sync-for-expenses/src/codatsyncexpenses/push_operations.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -18,17 +20,19 @@ def get(self, request: operations.GetPushOperationRequest, retries: Optional[uti
r"""Get push operation
Retrieve push operation.
"""
+ hook_ctx = HookContext(operation_id='get-push-operation', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetPushOperationRequest, base_url, '/companies/{companyId}/push/{pushOperationKey}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -38,33 +42,58 @@ def get(self, request: operations.GetPushOperationRequest, retries: Optional[uti
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetPushOperationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetPushOperationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.PushOperation])
res.push_operation = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -74,18 +103,20 @@ def list(self, request: operations.ListPushOperationsRequest, retries: Optional[
r"""List push operations
List push operation records.
"""
+ hook_ctx = HookContext(operation_id='list-push-operations', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListPushOperationsRequest, base_url, '/companies/{companyId}/push', request)
- headers = {}
- query_params = utils.get_query_params(operations.ListPushOperationsRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListPushOperationsRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -95,33 +126,58 @@ def list(self, request: operations.ListPushOperationsRequest, retries: Optional[
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListPushOperationsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListPushOperationsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.PushOperations])
res.push_operations = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/sdk.py b/sync-for-expenses/src/codatsyncexpenses/sdk.py
index 530b8cbe4..506c7bd10 100644
--- a/sync-for-expenses/src/codatsyncexpenses/sdk.py
+++ b/sync-for-expenses/src/codatsyncexpenses/sdk.py
@@ -14,8 +14,9 @@
from .sync import Sync
from .transaction_status import TransactionStatus
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import SDKHooks
from codatsyncexpenses.models import shared
-from typing import Callable, Dict, Union
+from typing import Callable, Dict, Optional, Union
class CodatSyncExpenses:
r"""Sync for Expenses: The API for Sync for Expenses.
@@ -57,14 +58,14 @@ class CodatSyncExpenses:
def __init__(self,
security: Union[shared.Security,Callable[[], shared.Security]] = None,
- server_idx: int = None,
- server_url: str = None,
- url_params: Dict[str, str] = None,
- client: requests_http.Session = None,
- retry_config: utils.RetryConfig = None
+ server_idx: Optional[int] = None,
+ server_url: Optional[str] = None,
+ url_params: Optional[Dict[str, str]] = None,
+ client: Optional[requests_http.Session] = None,
+ retry_config: Optional[utils.RetryConfig] = None
) -> None:
"""Instantiates the SDK configuring it with the provided parameters.
-
+
:param security: The security details required for authentication
:type security: Union[shared.Security,Callable[[], shared.Security]]
:param server_idx: The index of the server to use for all operations
@@ -80,15 +81,32 @@ def __init__(self,
"""
if client is None:
client = requests_http.Session()
-
+
if server_url is not None:
if url_params is not None:
server_url = utils.template_url(server_url, url_params)
- self.sdk_configuration = SDKConfiguration(client, security, server_url, server_idx, retry_config=retry_config)
-
+ self.sdk_configuration = SDKConfiguration(
+ client,
+ security,
+ server_url,
+ server_idx,
+ retry_config=retry_config
+ )
+
+ hooks = SDKHooks()
+
+ current_server_url, *_ = self.sdk_configuration.get_server_details()
+ server_url, self.sdk_configuration.client = hooks.sdk_init(current_server_url, self.sdk_configuration.client)
+ if current_server_url != server_url:
+ self.sdk_configuration.server_url = server_url
+
+ # pylint: disable=protected-access
+ self.sdk_configuration._hooks = hooks
+
self._init_sdks()
-
+
+
def _init_sdks(self):
self.companies = Companies(self.sdk_configuration)
self.connections = Connections(self.sdk_configuration)
@@ -101,4 +119,3 @@ def _init_sdks(self):
self.expenses = Expenses(self.sdk_configuration)
self.sync = Sync(self.sdk_configuration)
self.transaction_status = TransactionStatus(self.sdk_configuration)
-
\ No newline at end of file
diff --git a/sync-for-expenses/src/codatsyncexpenses/sdkconfiguration.py b/sync-for-expenses/src/codatsyncexpenses/sdkconfiguration.py
index 0d58d0b67..6cdf5e0e0 100644
--- a/sync-for-expenses/src/codatsyncexpenses/sdkconfiguration.py
+++ b/sync-for-expenses/src/codatsyncexpenses/sdkconfiguration.py
@@ -2,6 +2,7 @@
import requests as requests_http
+from ._hooks import SDKHooks
from .utils import utils
from .utils.retries import RetryConfig
from codatsyncexpenses.models import shared
@@ -22,10 +23,11 @@ class SDKConfiguration:
server_idx: int = 0
language: str = 'python'
openapi_doc_version: str = 'prealpha'
- sdk_version: str = '6.0.1'
- gen_version: str = '2.257.2'
- user_agent: str = 'speakeasy-sdk/python 6.0.1 2.257.2 prealpha codat-sync-for-expenses'
+ sdk_version: str = '6.1.0'
+ gen_version: str = '2.286.2'
+ user_agent: str = 'speakeasy-sdk/python 6.1.0 2.286.2 prealpha codat-sync-for-expenses'
retry_config: RetryConfig = None
+ _hooks: SDKHooks = None
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
if self.server_url:
@@ -34,3 +36,7 @@ def get_server_details(self) -> Tuple[str, Dict[str, str]]:
self.server_idx = 0
return SERVERS[self.server_idx], {}
+
+
+ def get_hooks(self) -> SDKHooks:
+ return self._hooks
diff --git a/sync-for-expenses/src/codatsyncexpenses/suppliers.py b/sync-for-expenses/src/codatsyncexpenses/suppliers.py
index a698e4fe8..e67e39b98 100644
--- a/sync-for-expenses/src/codatsyncexpenses/suppliers.py
+++ b/sync-for-expenses/src/codatsyncexpenses/suppliers.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import Optional
@@ -26,21 +28,23 @@ def create(self, request: operations.CreateSupplierRequest, retries: Optional[ut
Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=suppliers) for integrations that support creating an account.
"""
+ hook_ctx = HookContext(operation_id='create-supplier', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.CreateSupplierRequest, base_url, '/companies/{companyId}/connections/{connectionId}/push/suppliers', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.CreateSupplierRequest, "supplier", True, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
- query_params = utils.get_query_params(operations.CreateSupplierRequest, request)
+ query_params = { **utils.get_query_params(operations.CreateSupplierRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -50,33 +54,58 @@ def create(self, request: operations.CreateSupplierRequest, retries: Optional[ut
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, params=query_params, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.CreateSupplierResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.CreateSupplierResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CreateSupplierResponse])
res.create_supplier_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -92,17 +121,19 @@ def get(self, request: operations.GetSupplierRequest, retries: Optional[utils.Re
Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-expenses-api#/operations/refresh-company-data).
"""
+ hook_ctx = HookContext(operation_id='get-supplier', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetSupplierRequest, base_url, '/companies/{companyId}/data/suppliers/{supplierId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -112,33 +143,58 @@ def get(self, request: operations.GetSupplierRequest, retries: Optional[utils.Re
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','409','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetSupplierResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetSupplierResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Supplier])
res.supplier = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 409, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -152,18 +208,20 @@ def list(self, request: operations.ListSuppliersRequest, retries: Optional[utils
Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/sync-for-expenses-api#/operations/refresh-company-data).
"""
+ hook_ctx = HookContext(operation_id='list-suppliers', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListSuppliersRequest, base_url, '/companies/{companyId}/data/suppliers', request)
- headers = {}
- query_params = utils.get_query_params(operations.ListSuppliersRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListSuppliersRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -173,33 +231,58 @@ def list(self, request: operations.ListSuppliersRequest, retries: Optional[utils
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','409','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListSuppliersResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListSuppliersResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Suppliers])
res.suppliers = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 409, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -217,21 +300,23 @@ def update(self, request: operations.UpdateSupplierRequest, retries: Optional[ut
Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=suppliers) for integrations that support creating an account.
"""
+ hook_ctx = HookContext(operation_id='update-supplier', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.UpdateSupplierRequest, base_url, '/companies/{companyId}/connections/{connectionId}/push/suppliers/{supplierId}', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.UpdateSupplierRequest, "supplier", True, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
- query_params = utils.get_query_params(operations.UpdateSupplierRequest, request)
+ query_params = { **utils.get_query_params(operations.UpdateSupplierRequest, request), **query_params }
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -241,33 +326,58 @@ def update(self, request: operations.UpdateSupplierRequest, retries: Optional[ut
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('PUT', url, params=query_params, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('PUT', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.UpdateSupplierResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.UpdateSupplierResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.UpdateSupplierResponse])
res.update_supplier_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/sync.py b/sync-for-expenses/src/codatsyncexpenses/sync.py
index 50e334888..f201923c3 100644
--- a/sync-for-expenses/src/codatsyncexpenses/sync.py
+++ b/sync-for-expenses/src/codatsyncexpenses/sync.py
@@ -1,7 +1,9 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
from typing import List, Optional
@@ -18,17 +20,19 @@ def get(self, request: operations.GetSyncByIDRequest, retries: Optional[utils.Re
r"""Get sync status
Get the sync status for a specified sync
"""
+ hook_ctx = HookContext(operation_id='get-sync-by-id', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetSyncByIDRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/{syncId}/status', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -38,33 +42,58 @@ def get(self, request: operations.GetSyncByIDRequest, retries: Optional[utils.Re
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetSyncByIDResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetSyncByIDResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CompanySyncStatus])
res.company_sync_status = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -74,17 +103,19 @@ def get_last_successful_sync(self, request: operations.GetLastSuccessfulSyncRequ
r"""Last successful sync
Gets the status of the last successful sync
"""
+ hook_ctx = HookContext(operation_id='get-last-successful-sync', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetLastSuccessfulSyncRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/lastSuccessful/status', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -94,33 +125,58 @@ def get_last_successful_sync(self, request: operations.GetLastSuccessfulSyncRequ
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetLastSuccessfulSyncResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetLastSuccessfulSyncResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CompanySyncStatus])
res.company_sync_status = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -130,17 +186,19 @@ def get_latest_sync(self, request: operations.GetLatestSyncRequest, retries: Opt
r"""Latest sync status
Gets the latest sync status
"""
+ hook_ctx = HookContext(operation_id='get-latest-sync', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetLatestSyncRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/latest/status', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -150,33 +208,58 @@ def get_latest_sync(self, request: operations.GetLatestSyncRequest, retries: Opt
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetLatestSyncResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetLatestSyncResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.CompanySyncStatus])
res.company_sync_status = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -186,20 +269,22 @@ def initiate_sync(self, request: operations.InitiateSyncRequest, retries: Option
r"""Initiate sync
Initiate sync of pending transactions.
"""
+ hook_ctx = HookContext(operation_id='initiate-sync', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.InitiateSyncRequest, base_url, '/companies/{companyId}/sync/expenses/syncs', request)
- headers = {}
+
+ if callable(self.sdk_configuration.security):
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
+ else:
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
req_content_type, data, form = utils.serialize_request_body(request, operations.InitiateSyncRequest, "initiate_sync", False, True, 'json')
- if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
+ if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
headers['content-type'] = req_content_type
headers['Accept'] = 'application/json'
headers['user-agent'] = self.sdk_configuration.user_agent
-
- if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
- else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -209,33 +294,58 @@ def initiate_sync(self, request: operations.InitiateSyncRequest, retries: Option
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('POST', url, data=data, files=form, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','422','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.InitiateSyncResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.InitiateSyncResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 202:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.SyncInitiated])
res.sync_initiated = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 422, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -245,17 +355,19 @@ def list(self, request: operations.ListSyncsRequest, retries: Optional[utils.Ret
r"""List sync statuses
Gets a list of sync statuses
"""
+ hook_ctx = HookContext(operation_id='list-syncs', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListSyncsRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/list/status', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -265,33 +377,58 @@ def list(self, request: operations.ListSyncsRequest, retries: Optional[utils.Ret
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListSyncsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListSyncsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[List[shared.CompanySyncStatus]])
res.classes = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/transaction_status.py b/sync-for-expenses/src/codatsyncexpenses/transaction_status.py
index 5f56e672b..cb917aee4 100644
--- a/sync-for-expenses/src/codatsyncexpenses/transaction_status.py
+++ b/sync-for-expenses/src/codatsyncexpenses/transaction_status.py
@@ -1,9 +1,11 @@
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
+import requests as requests_http
from .sdkconfiguration import SDKConfiguration
from codatsyncexpenses import utils
+from codatsyncexpenses._hooks import HookContext
from codatsyncexpenses.models import errors, operations, shared
-from typing import Optional
+from typing import List, Optional
class TransactionStatus:
r"""Retrieve the status of transactions within a sync."""
@@ -18,17 +20,19 @@ def get(self, request: operations.GetSyncTransactionRequest, retries: Optional[u
r"""Get sync transaction
Gets the status of a transaction for a sync
"""
+ hook_ctx = HookContext(operation_id='get-sync-transaction', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.GetSyncTransactionRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}', request)
- headers = {}
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -38,33 +42,58 @@ def get(self, request: operations.GetSyncTransactionRequest, retries: Optional[u
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.GetSyncTransactionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.GetSyncTransactionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
- out = utils.unmarshal_json(http_res.text, Optional[shared.Transaction])
- res.transaction = out
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
+ out = utils.unmarshal_json(http_res.text, Optional[List[shared.Transaction]])
+ res.transaction_response = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
@@ -74,18 +103,20 @@ def list(self, request: operations.ListSyncTransactionsRequest, retries: Optiona
r"""List sync transactions
Gets the transactions and status for a sync
"""
+ hook_ctx = HookContext(operation_id='list-sync-transactions', oauth2_scopes=[], security_source=self.sdk_configuration.security)
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
url = utils.generate_url(operations.ListSyncTransactionsRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions', request)
- headers = {}
- query_params = utils.get_query_params(operations.ListSyncTransactionsRequest, request)
- headers['Accept'] = 'application/json'
- headers['user-agent'] = self.sdk_configuration.user_agent
if callable(self.sdk_configuration.security):
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
+ headers, query_params = utils.get_security(self.sdk_configuration.security())
else:
- client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
+ headers, query_params = utils.get_security(self.sdk_configuration.security)
+
+ query_params = { **utils.get_query_params(operations.ListSyncTransactionsRequest, request), **query_params }
+ headers['Accept'] = 'application/json'
+ headers['user-agent'] = self.sdk_configuration.user_agent
+ client = self.sdk_configuration.client
global_retry_config = self.sdk_configuration.retry_config
retry_config = retries
@@ -95,33 +126,58 @@ def list(self, request: operations.ListSyncTransactionsRequest, retries: Optiona
else:
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True)
+ req = None
def do_request():
- return client.request('GET', url, params=query_params, headers=headers)
+ nonlocal req
+ try:
+ req = self.sdk_configuration.get_hooks().before_request(
+ hook_ctx,
+ requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
+ )
+ http_res = client.send(req)
+ except Exception as e:
+ _, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
+ raise e
+
+ if utils.match_status_codes(['400','401','402','403','404','429','4XX','500','503','5XX'], http_res.status_code):
+ http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
+ if e:
+ raise e
+ else:
+ result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
+ if isinstance(result, Exception):
+ raise result
+ http_res = result
+
+ return http_res
http_res = utils.retry(do_request, utils.Retries(retry_config, [
'408',
'429',
'5XX'
]))
- content_type = http_res.headers.get('Content-Type')
- res = operations.ListSyncTransactionsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
+
+ res = operations.ListSyncTransactionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
if http_res.status_code == 200:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, Optional[shared.Transactions])
res.transactions = out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code in [400, 401, 402, 403, 404, 429, 500, 503]:
- if utils.match_content_type(content_type, 'application/json'):
+ if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
out = utils.unmarshal_json(http_res.text, errors.ErrorMessage)
- out.raw_response = http_res
raise out
else:
+ content_type = http_res.headers.get('Content-Type')
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
+ else:
+ raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
return res
diff --git a/sync-for-expenses/src/codatsyncexpenses/utils/utils.py b/sync-for-expenses/src/codatsyncexpenses/utils/utils.py
index 52434025e..44b7a2e06 100644
--- a/sync-for-expenses/src/codatsyncexpenses/utils/utils.py
+++ b/sync-for-expenses/src/codatsyncexpenses/utils/utils.py
@@ -4,7 +4,7 @@
import json
import re
import sys
-from dataclasses import Field, dataclass, fields, is_dataclass, make_dataclass
+from dataclasses import Field, fields, is_dataclass, make_dataclass
from datetime import date, datetime
from decimal import Decimal
from email.message import Message
@@ -14,29 +14,15 @@
from xmlrpc.client import boolean
from typing_inspect import is_optional_type
import dateutil.parser
-import requests
from dataclasses_json import DataClassJsonMixin
-class SecurityClient:
- client: requests.Session
+def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, str]]:
+ headers: Dict[str, str] = {}
query_params: Dict[str, str] = {}
- def __init__(self, client: requests.Session):
- self.client = client
-
- def request(self, method, url, **kwargs):
- params = kwargs.get('params', {})
- kwargs["params"] = {**self.query_params, **params}
-
- return self.client.request(method, url, **kwargs)
-
-
-def configure_security_client(client: requests.Session, security: dataclass):
- client = SecurityClient(client)
-
if security is None:
- return client
+ return headers, query_params
sec_fields: Tuple[Field, ...] = fields(security)
for sec_field in sec_fields:
@@ -48,35 +34,35 @@ def configure_security_client(client: requests.Session, security: dataclass):
if metadata is None:
continue
if metadata.get('option'):
- _parse_security_option(client, value)
- return client
+ _parse_security_option(headers, query_params, value)
+ return headers, query_params
if metadata.get('scheme'):
# Special case for basic auth which could be a flattened struct
if metadata.get("sub_type") == "basic" and not is_dataclass(value):
- _parse_security_scheme(client, metadata, security)
+ _parse_security_scheme(headers, query_params, metadata, security)
else:
- _parse_security_scheme(client, metadata, value)
+ _parse_security_scheme(headers, query_params, metadata, value)
- return client
+ return headers, query_params
-def _parse_security_option(client: SecurityClient, option: dataclass):
+def _parse_security_option(headers: Dict[str, str], query_params: Dict[str, str], option: Any):
opt_fields: Tuple[Field, ...] = fields(option)
for opt_field in opt_fields:
metadata = opt_field.metadata.get('security')
if metadata is None or metadata.get('scheme') is None:
continue
_parse_security_scheme(
- client, metadata, getattr(option, opt_field.name))
+ headers, query_params, metadata, getattr(option, opt_field.name))
-def _parse_security_scheme(client: SecurityClient, scheme_metadata: Dict, scheme: any):
+def _parse_security_scheme(headers: Dict[str, str], query_params: Dict[str, str], scheme_metadata: Dict, scheme: Any):
scheme_type = scheme_metadata.get('type')
sub_type = scheme_metadata.get('sub_type')
if is_dataclass(scheme):
if scheme_type == 'http' and sub_type == 'basic':
- _parse_basic_auth_scheme(client, scheme)
+ _parse_basic_auth_scheme(headers, scheme)
return
scheme_fields: Tuple[Field, ...] = fields(scheme)
@@ -88,34 +74,33 @@ def _parse_security_scheme(client: SecurityClient, scheme_metadata: Dict, scheme
value = getattr(scheme, scheme_field.name)
_parse_security_scheme_value(
- client, scheme_metadata, metadata, value)
+ headers, query_params, scheme_metadata, metadata, value)
else:
_parse_security_scheme_value(
- client, scheme_metadata, scheme_metadata, scheme)
+ headers, query_params, scheme_metadata, scheme_metadata, scheme)
-def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: Dict, security_metadata: Dict, value: any):
+def _parse_security_scheme_value(headers: Dict[str, str], query_params: Dict[str, str], scheme_metadata: Dict, security_metadata: Dict, value: Any):
scheme_type = scheme_metadata.get('type')
sub_type = scheme_metadata.get('sub_type')
- header_name = security_metadata.get('field_name')
+ header_name = str(security_metadata.get('field_name'))
if scheme_type == "apiKey":
if sub_type == 'header':
- client.client.headers[header_name] = value
+ headers[header_name] = value
elif sub_type == 'query':
- client.query_params[header_name] = value
- elif sub_type == 'cookie':
- client.client.cookies[header_name] = value
+ query_params[header_name] = value
else:
raise Exception('not supported')
elif scheme_type == "openIdConnect":
- client.client.headers[header_name] = _apply_bearer(value)
+ headers[header_name] = _apply_bearer(value)
elif scheme_type == 'oauth2':
- client.client.headers[header_name] = _apply_bearer(value)
+ if sub_type != 'client_credentials':
+ headers[header_name] = _apply_bearer(value)
elif scheme_type == 'http':
if sub_type == 'bearer':
- client.client.headers[header_name] = _apply_bearer(value)
+ headers[header_name] = _apply_bearer(value)
else:
raise Exception('not supported')
else:
@@ -126,7 +111,7 @@ def _apply_bearer(token: str) -> str:
return token.lower().startswith('bearer ') and token or f'Bearer {token}'
-def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
+def _parse_basic_auth_scheme(headers: Dict[str, str], scheme: Any):
username = ""
password = ""
@@ -145,11 +130,11 @@ def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
password = value
data = f'{username}:{password}'.encode()
- client.client.headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
+ headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}'
-def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass,
- gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> str:
+def generate_url(clazz: type, server_url: str, path: str, path_params: Any,
+ gbls: Optional[Dict[str, Dict[str, Dict[str, Any]]]] = None) -> str:
path_param_fields: Tuple[Field, ...] = fields(clazz)
for field in path_param_fields:
request_metadata = field.metadata.get('request')
@@ -241,7 +226,7 @@ def template_url(url_with_params: str, params: Dict[str, str]) -> str:
return url_with_params
-def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> Dict[
+def get_query_params(clazz: type, query_params: Any, gbls: Optional[Dict[str, Dict[str, Dict[str, Any]]]] = None) -> Dict[
str, List[str]]:
params: Dict[str, List[str]] = {}
@@ -264,7 +249,8 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[
f_name = metadata.get("field_name")
serialization = metadata.get('serialization', '')
if serialization != '':
- serialized_parms = _get_serialized_params(metadata, field.type, f_name, value)
+ serialized_parms = _get_serialized_params(
+ metadata, field.type, f_name, value)
for key, value in serialized_parms.items():
if key in params:
params[key].extend(value)
@@ -286,7 +272,7 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[
return params
-def get_headers(headers_params: dataclass) -> Dict[str, str]:
+def get_headers(headers_params: Any) -> Dict[str, str]:
if headers_params is None:
return {}
@@ -307,17 +293,18 @@ def get_headers(headers_params: dataclass) -> Dict[str, str]:
return headers
-def _get_serialized_params(metadata: Dict, field_type: type, field_name: str, obj: any) -> Dict[str, str]:
+def _get_serialized_params(metadata: Dict, field_type: type, field_name: str, obj: Any) -> Dict[str, str]:
params: Dict[str, str] = {}
serialization = metadata.get('serialization', '')
if serialization == 'json':
- params[metadata.get("field_name", field_name)] = marshal_json(obj, field_type)
+ params[metadata.get("field_name", field_name)
+ ] = marshal_json(obj, field_type)
return params
-def _get_deep_object_query_params(metadata: Dict, field_name: str, obj: any) -> Dict[str, List[str]]:
+def _get_deep_object_query_params(metadata: Dict, field_name: str, obj: Any) -> Dict[str, List[str]]:
params: Dict[str, List[str]] = {}
if obj is None:
@@ -383,7 +370,7 @@ def _get_query_param_field_name(obj_field: Field) -> str:
return obj_param_metadata.get("field_name", obj_field.name)
-def _get_delimited_query_params(metadata: Dict, field_name: str, obj: any, delimiter: str) -> Dict[
+def _get_delimited_query_params(metadata: Dict, field_name: str, obj: Any, delimiter: str) -> Dict[
str, List[str]]:
return _populate_form(field_name, metadata.get("explode", True), obj, _get_query_param_field_name, delimiter)
@@ -397,8 +384,8 @@ def _get_delimited_query_params(metadata: Dict, field_name: str, obj: any, delim
}
-def serialize_request_body(request: dataclass, request_type: type, request_field_name: str, nullable: bool, optional: bool, serialization_method: str, encoder=None) -> Tuple[
- str, any, any]:
+def serialize_request_body(request: Any, request_type: type, request_field_name: str, nullable: bool, optional: bool, serialization_method: str, encoder=None) -> Tuple[
+ Optional[str], Optional[Any], Optional[Any]]:
if request is None:
if not nullable and optional:
return None, None, None
@@ -428,7 +415,7 @@ def serialize_request_body(request: dataclass, request_type: type, request_field
request_val)
-def serialize_content_type(field_name: str, request_type: any, media_type: str, request: dataclass, encoder=None) -> Tuple[str, any, List[List[any]]]:
+def serialize_content_type(field_name: str, request_type: Any, media_type: str, request: Any, encoder=None) -> Tuple[Optional[str], Optional[Any], Optional[List[List[Any]]]]:
if re.match(r'(application|text)\/.*?\+*json.*', media_type) is not None:
return media_type, marshal_json(request, request_type, encoder), None
if re.match(r'multipart\/.*', media_type) is not None:
@@ -444,8 +431,8 @@ def serialize_content_type(field_name: str, request_type: any, media_type: str,
f"invalid request body type {type(request)} for mediaType {media_type}")
-def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, any, List[List[any]]]:
- form: List[List[any]] = []
+def serialize_multipart_form(media_type: str, request: Any) -> Tuple[str, Any, List[List[Any]]]:
+ form: List[List[Any]] = []
request_fields = fields(request)
for field in request_fields:
@@ -500,7 +487,7 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str,
def serialize_dict(original: Dict, explode: bool, field_name, existing: Optional[Dict[str, List[str]]]) -> Dict[
str, List[str]]:
if existing is None:
- existing = []
+ existing = {}
if explode is True:
for key, val in original.items():
@@ -518,7 +505,7 @@ def serialize_dict(original: Dict, explode: bool, field_name, existing: Optional
return existing
-def serialize_form_data(field_name: str, data: dataclass) -> Dict[str, any]:
+def serialize_form_data(field_name: str, data: Any) -> Dict[str, Any]:
form: Dict[str, List[str]] = {}
if is_dataclass(data):
@@ -560,7 +547,7 @@ def _get_form_field_name(obj_field: Field) -> str:
return obj_param_metadata.get("field_name", obj_field.name)
-def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_func: Callable, delimiter: str) -> \
+def _populate_form(field_name: str, explode: boolean, obj: Any, get_field_name_func: Callable, delimiter: str) -> \
Dict[str, List[str]]:
params: Dict[str, List[str]] = {}
@@ -595,7 +582,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
continue
if explode:
- params[key] = _val_to_string(value)
+ params[key] = [_val_to_string(value)]
else:
items.append(f'{key}{delimiter}{_val_to_string(value)}')
@@ -624,7 +611,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f
return params
-def _serialize_header(explode: bool, obj: any) -> str:
+def _serialize_header(explode: bool, obj: Any) -> str:
if obj is None:
return ''
@@ -702,7 +689,8 @@ def unmarshal_json(data, typ, decoder=None):
def marshal_json(val, typ, encoder=None):
if not is_optional_type(typ) and val is None:
- raise ValueError(f"Could not marshal None into non-optional type: {typ}")
+ raise ValueError(
+ f"Could not marshal None into non-optional type: {typ}")
marshal = make_dataclass('Marshal', [('res', typ)],
bases=(DataClassJsonMixin,))
@@ -732,6 +720,16 @@ def match_content_type(content_type: str, pattern: str) -> boolean:
return False
+def match_status_codes(status_codes: List[str], status_code: int) -> bool:
+ for code in status_codes:
+ if code == str(status_code):
+ return True
+
+ if code.endswith("XX") and code.startswith(str(status_code)[:1]):
+ return True
+ return False
+
+
def datetimeisoformat(optional: bool):
def isoformatoptional(val):
if optional and val is None:
@@ -835,15 +833,17 @@ def list_decode(val: List):
return list_decode
+
def union_encoder(all_encoders: Dict[str, Callable]):
- def selective_encoder(val: any):
+ def selective_encoder(val: Any):
if type(val) in all_encoders:
return all_encoders[type(val)](val)
return val
return selective_encoder
+
def union_decoder(all_decoders: List[Callable]):
- def selective_decoder(val: any):
+ def selective_decoder(val: Any):
decoded = val
for decoder in all_decoders:
try:
@@ -854,6 +854,7 @@ def selective_decoder(val: any):
return decoded
return selective_decoder
+
def get_field_name(name):
def override(_, _field_name=name):
return _field_name
@@ -861,18 +862,18 @@ def override(_, _field_name=name):
return override
-def _val_to_string(val):
+def _val_to_string(val) -> str:
if isinstance(val, bool):
return str(val).lower()
if isinstance(val, datetime):
- return val.isoformat().replace('+00:00', 'Z')
+ return str(val.isoformat().replace('+00:00', 'Z'))
if isinstance(val, Enum):
return str(val.value)
return str(val)
-def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: Dict[str, Dict[str, Dict[str, Any]]]):
+def _populate_from_globals(param_name: str, value: Any, param_type: str, gbls: Optional[Dict[str, Dict[str, Dict[str, Any]]]]):
if value is None and gbls is not None:
if 'parameters' in gbls:
if param_type in gbls['parameters']: