diff --git a/expenses/README.md b/expenses/README.md index 53bd3fdcc..737dc5f3c 100755 --- a/expenses/README.md +++ b/expenses/README.md @@ -12,9 +12,11 @@ pip install codat-sync-for-expenses ## SDK Example Usage + + ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/RELEASES.md b/expenses/RELEASES.md index 5d73a2aa6..0841e6b06 100644 --- a/expenses/RELEASES.md +++ b/expenses/RELEASES.md @@ -606,4 +606,14 @@ Based on: - OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml - Speakeasy CLI 1.53.0 (2.58.0) https://github.com/speakeasy-api/speakeasy ### Releases -- [PyPI v0.33.1] https://pypi.org/project/codat-sync-for-expenses/0.33.1 - expenses \ No newline at end of file +- [PyPI v0.33.1] https://pypi.org/project/codat-sync-for-expenses/0.33.1 - expenses + +## 2023-08-16 11:00:43 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.73.1 (2.84.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.34.0] expenses +### Releases +- [PyPI v0.34.0] https://pypi.org/project/codat-sync-for-expenses/0.34.0 - expenses \ No newline at end of file diff --git a/expenses/USAGE.md b/expenses/USAGE.md index 30787d99e..6745c7299 100755 --- a/expenses/USAGE.md +++ b/expenses/USAGE.md @@ -1,7 +1,9 @@ + + ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/docs/models/operations/createexpensedatasetresponse.md b/expenses/docs/models/operations/createexpensedatasetresponse.md index 0073543cc..3036fbdb7 100755 --- a/expenses/docs/models/operations/createexpensedatasetresponse.md +++ b/expenses/docs/models/operations/createexpensedatasetresponse.md @@ -7,6 +7,6 @@ | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `content_type` | *str* | :heavy_check_mark: | N/A | | `create_expense_response` | [Optional[shared.CreateExpenseResponse]](../../models/shared/createexpenseresponse.md) | :heavy_minus_sign: | OK | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | The request made is not valid. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | The request made is not valid. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md b/expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md index 6f7bb44b2..039dec66a 100755 --- a/expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md +++ b/expenses/docs/models/operations/createpartnerexpenseconnectionresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `content_type` | *str* | :heavy_check_mark: | N/A | | `data_connection` | [Optional[shared.DataConnection]](../../models/shared/dataconnection.md) | :heavy_minus_sign: | Success | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | The request made is not valid. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | The request made is not valid. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/getcompanyconfigurationresponse.md b/expenses/docs/models/operations/getcompanyconfigurationresponse.md index 10e7f12f4..92fe9ca69 100755 --- a/expenses/docs/models/operations/getcompanyconfigurationresponse.md +++ b/expenses/docs/models/operations/getcompanyconfigurationresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `company_configuration` | [Optional[shared.CompanyConfiguration]](../../models/shared/companyconfiguration.md) | :heavy_minus_sign: | Success | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/getlastsuccessfulsyncresponse.md b/expenses/docs/models/operations/getlastsuccessfulsyncresponse.md index 1eb49c0f3..eb964382b 100755 --- a/expenses/docs/models/operations/getlastsuccessfulsyncresponse.md +++ b/expenses/docs/models/operations/getlastsuccessfulsyncresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `company_sync_status` | [Optional[shared.CompanySyncStatus]](../../models/shared/companysyncstatus.md) | :heavy_minus_sign: | Success | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/getlatestsyncresponse.md b/expenses/docs/models/operations/getlatestsyncresponse.md index 30ab15dee..9b9951a6a 100755 --- a/expenses/docs/models/operations/getlatestsyncresponse.md +++ b/expenses/docs/models/operations/getlatestsyncresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `company_sync_status` | [Optional[shared.CompanySyncStatus]](../../models/shared/companysyncstatus.md) | :heavy_minus_sign: | Success | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/getmappingoptionsresponse.md b/expenses/docs/models/operations/getmappingoptionsresponse.md index 93d6a8073..321cd56f1 100755 --- a/expenses/docs/models/operations/getmappingoptionsresponse.md +++ b/expenses/docs/models/operations/getmappingoptionsresponse.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `mapping_options` | [Optional[shared.MappingOptions]](../../models/shared/mappingoptions.md) | :heavy_minus_sign: | Success | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/getsyncbyidresponse.md b/expenses/docs/models/operations/getsyncbyidresponse.md index ba66c7a84..1dd1a1c76 100755 --- a/expenses/docs/models/operations/getsyncbyidresponse.md +++ b/expenses/docs/models/operations/getsyncbyidresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `company_sync_status` | [Optional[shared.CompanySyncStatus]](../../models/shared/companysyncstatus.md) | :heavy_minus_sign: | Success | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/getsynctransactionresponse.md b/expenses/docs/models/operations/getsynctransactionresponse.md index 1a514269d..3f3853d84 100755 --- a/expenses/docs/models/operations/getsynctransactionresponse.md +++ b/expenses/docs/models/operations/getsynctransactionresponse.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | | `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `transaction_metadata` | list[[shared.TransactionMetadata](../../models/shared/transactionmetadata.md)] | :heavy_minus_sign: | Success | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `transaction_metadata` | list[[shared.TransactionMetadata](../../models/shared/transactionmetadata.md)] | :heavy_minus_sign: | Success | \ No newline at end of file diff --git a/expenses/docs/models/operations/listsyncsresponse.md b/expenses/docs/models/operations/listsyncsresponse.md index 4b63b0807..c0ace91ac 100755 --- a/expenses/docs/models/operations/listsyncsresponse.md +++ b/expenses/docs/models/operations/listsyncsresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `company_sync_statuses` | list[[shared.CompanySyncStatus](../../models/shared/companysyncstatus.md)] | :heavy_minus_sign: | Success | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/listsynctransactionsresponse.md b/expenses/docs/models/operations/listsynctransactionsresponse.md index 9adae833c..c127362d4 100755 --- a/expenses/docs/models/operations/listsynctransactionsresponse.md +++ b/expenses/docs/models/operations/listsynctransactionsresponse.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | Your API request was not properly authorized. | | `status_code` | *int* | :heavy_check_mark: | N/A | | `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `transaction_metadata_list` | [Optional[shared.TransactionMetadataList]](../../models/shared/transactionmetadatalist.md) | :heavy_minus_sign: | Success | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | Your API request was not properly authorized. | \ No newline at end of file +| `transaction_metadata_list` | [Optional[shared.TransactionMetadataList]](../../models/shared/transactionmetadatalist.md) | :heavy_minus_sign: | Success | \ No newline at end of file diff --git a/expenses/docs/models/operations/savecompanyconfigurationresponse.md b/expenses/docs/models/operations/savecompanyconfigurationresponse.md index ef1588834..cb2dad148 100755 --- a/expenses/docs/models/operations/savecompanyconfigurationresponse.md +++ b/expenses/docs/models/operations/savecompanyconfigurationresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `company_configuration` | [Optional[shared.CompanyConfiguration]](../../models/shared/companyconfiguration.md) | :heavy_minus_sign: | Success | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | The request made is not valid. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | The request made is not valid. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/updateexpensedatasetresponse.md b/expenses/docs/models/operations/updateexpensedatasetresponse.md index 49d84d916..14d1ac9bb 100755 --- a/expenses/docs/models/operations/updateexpensedatasetresponse.md +++ b/expenses/docs/models/operations/updateexpensedatasetresponse.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | The request made is not valid. | | `status_code` | *int* | :heavy_check_mark: | N/A | | `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | The request made is not valid. | | `update_expense_dataset_202_application_json_object` | [Optional[UpdateExpenseDataset202ApplicationJSON]](../../models/operations/updateexpensedataset202applicationjson.md) | :heavy_minus_sign: | Accepted | \ No newline at end of file diff --git a/expenses/docs/models/operations/uploadattachmentresponse.md b/expenses/docs/models/operations/uploadattachmentresponse.md index a91cde8e0..6f073cade 100755 --- a/expenses/docs/models/operations/uploadattachmentresponse.md +++ b/expenses/docs/models/operations/uploadattachmentresponse.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `attachment` | [Optional[shared.Attachment]](../../models/shared/attachment.md) | :heavy_minus_sign: | OK | | `content_type` | *str* | :heavy_check_mark: | N/A | +| `error_message` | [Optional[shared.ErrorMessage]](../../models/shared/errormessage.md) | :heavy_minus_sign: | The request made is not valid. | | `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `schema` | [Optional[shared.Schema]](../../models/shared/schema.md) | :heavy_minus_sign: | The request made is not valid. | \ No newline at end of file +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/shared/contactref.md b/expenses/docs/models/shared/contactref.md new file mode 100755 index 000000000..4d252422e --- /dev/null +++ b/expenses/docs/models/shared/contactref.md @@ -0,0 +1,9 @@ +# ContactRef + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `contact_type` | [Optional[ContactRefContactType]](../../models/shared/contactrefcontacttype.md) | :heavy_minus_sign: | The type of contact. | Supplier | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of supplier or customer. | 40e3e57c-2322-4898-966c-ca41adfd23fd | \ No newline at end of file diff --git a/expenses/docs/models/shared/contactrefcontacttype.md b/expenses/docs/models/shared/contactrefcontacttype.md new file mode 100755 index 000000000..0e0790e83 --- /dev/null +++ b/expenses/docs/models/shared/contactrefcontacttype.md @@ -0,0 +1,10 @@ +# ContactRefContactType + +The type of contact. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `SUPPLIER` | Supplier | \ No newline at end of file diff --git a/expenses/docs/models/shared/schema.md b/expenses/docs/models/shared/errormessage.md similarity index 98% rename from expenses/docs/models/shared/schema.md rename to expenses/docs/models/shared/errormessage.md index 8ac076515..9d49473cf 100755 --- a/expenses/docs/models/shared/schema.md +++ b/expenses/docs/models/shared/errormessage.md @@ -1,4 +1,4 @@ -# Schema +# ErrorMessage Your API request was not properly authorized. diff --git a/expenses/docs/models/shared/expensetransaction.md b/expenses/docs/models/shared/expensetransaction.md index 9e8f00616..898c49c58 100755 --- a/expenses/docs/models/shared/expensetransaction.md +++ b/expenses/docs/models/shared/expensetransaction.md @@ -5,6 +5,7 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | | `currency` | *str* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | | `currency_rate` | *Optional[float]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \| | | | `id` | *str* | :heavy_check_mark: | Your unique identifier for the transaction. | 4d7c6929-7770-412b-91bb-44d3bc71d111 | diff --git a/expenses/docs/models/shared/expensetype.md b/expenses/docs/models/shared/expensetype.md new file mode 100755 index 000000000..d19a826f7 --- /dev/null +++ b/expenses/docs/models/shared/expensetype.md @@ -0,0 +1,17 @@ +# ExpenseType + +The type of transaction. + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `PAYMENT` | Payment | +| `REFUND` | Refund | +| `REWARD` | Reward | +| `CHARGEBACK` | Chargeback | +| `TRANSFER_IN` | TransferIn | +| `TRANSFER_OUT` | TransferOut | +| `ADJUSTMENT_IN` | AdjustmentIn | +| `ADJUSTMENT_OUT` | AdjustmentOut | \ No newline at end of file diff --git a/expenses/docs/models/shared/synccompletewebhook.md b/expenses/docs/models/shared/synccompletewebhook.md new file mode 100755 index 000000000..002c3ed9e --- /dev/null +++ b/expenses/docs/models/shared/synccompletewebhook.md @@ -0,0 +1,17 @@ +# SyncCompleteWebhook + +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[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 diff --git a/expenses/docs/models/shared/synccompletewebhookdata.md b/expenses/docs/models/shared/synccompletewebhookdata.md new file mode 100755 index 000000000..255098788 --- /dev/null +++ b/expenses/docs/models/shared/synccompletewebhookdata.md @@ -0,0 +1,11 @@ +# SyncCompleteWebhookData + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `sync_date_range_finish_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-23T00:00:00.000Z | +| `sync_date_range_start_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-23T00:00:00.000Z | +| `sync_id` | *Optional[str]* | :heavy_minus_sign: | N/A | a9367074-b5c3-42c4-9be4-be129f43577e | +| `sync_type` | *Optional[str]* | :heavy_minus_sign: | The type of sync being performed. | | \ No newline at end of file diff --git a/expenses/docs/models/shared/syncfailedwebhook.md b/expenses/docs/models/shared/syncfailedwebhook.md new file mode 100755 index 000000000..4054cefff --- /dev/null +++ b/expenses/docs/models/shared/syncfailedwebhook.md @@ -0,0 +1,17 @@ +# SyncFailedWebhook + +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[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 diff --git a/expenses/docs/models/shared/syncfailedwebhookdata.md b/expenses/docs/models/shared/syncfailedwebhookdata.md new file mode 100755 index 000000000..aa11280fa --- /dev/null +++ b/expenses/docs/models/shared/syncfailedwebhookdata.md @@ -0,0 +1,12 @@ +# SyncFailedWebhookData + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `failure_stage` | *Optional[str]* | :heavy_minus_sign: | The stage of the job the sync failed. | | +| `sync_date_range_finish_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-23T00:00:00.000Z | +| `sync_date_range_start_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-23T00:00:00.000Z | +| `sync_id` | *Optional[str]* | :heavy_minus_sign: | N/A | a9367074-b5c3-42c4-9be4-be129f43577e | +| `sync_type` | *Optional[str]* | :heavy_minus_sign: | The type of sync being performed. | | \ No newline at end of file diff --git a/expenses/docs/models/shared/syncstartedwebhook.md b/expenses/docs/models/shared/syncstartedwebhook.md new file mode 100755 index 000000000..15f31c0c6 --- /dev/null +++ b/expenses/docs/models/shared/syncstartedwebhook.md @@ -0,0 +1,17 @@ +# SyncStartedWebhook + +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[SyncStartedWebhookData]](../../models/shared/syncstartedwebhookdata.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 diff --git a/expenses/docs/models/shared/syncstartedwebhookdata.md b/expenses/docs/models/shared/syncstartedwebhookdata.md new file mode 100755 index 000000000..75b051314 --- /dev/null +++ b/expenses/docs/models/shared/syncstartedwebhookdata.md @@ -0,0 +1,11 @@ +# SyncStartedWebhookData + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `sync_date_range_finish_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-23T00:00:00.000Z | +| `sync_date_range_start_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-23T00:00:00.000Z | +| `sync_id` | *Optional[str]* | :heavy_minus_sign: | N/A | a9367074-b5c3-42c4-9be4-be129f43577e | +| `sync_type` | *Optional[str]* | :heavy_minus_sign: | The type of sync being performed. | | \ No newline at end of file diff --git a/expenses/docs/models/shared/updateexpenserequest.md b/expenses/docs/models/shared/updateexpenserequest.md index 0fa5fb52d..3e53584c0 100755 --- a/expenses/docs/models/shared/updateexpenserequest.md +++ b/expenses/docs/models/shared/updateexpenserequest.md @@ -3,11 +3,13 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `currency` | *Optional[str]* | :heavy_minus_sign: | Currency the transaction was recorded in. | GBP | -| `issue_date` | *str* | :heavy_check_mark: | Date the transaction was recorded. | 2022-06-28T00:00:00.000Z | -| `lines` | list[[ExpenseTransactionLine](../../models/shared/expensetransactionline.md)] | :heavy_minus_sign: | Array of transaction lines. | | -| `merchant_name` | *Optional[str]* | :heavy_minus_sign: | Name of the merchant where the purchase took place | Amazon UK | -| `notes` | *Optional[str]* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | -| `type` | *Any* | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | +| `currency` | *Optional[str]* | :heavy_minus_sign: | Currency the transaction was recorded in. | GBP | +| `currency_rate` | *Optional[float]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \| | | +| `issue_date` | *str* | :heavy_check_mark: | Date the transaction was recorded. | 2022-06-28T00:00:00.000Z | +| `lines` | list[[ExpenseTransactionLine](../../models/shared/expensetransactionline.md)] | :heavy_minus_sign: | Array of transaction lines. | | +| `merchant_name` | *Optional[str]* | :heavy_minus_sign: | Name of the merchant where the purchase took place | Amazon UK | +| `notes` | *Optional[str]* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `type` | [ExpenseType](../../models/shared/expensetype.md) | :heavy_check_mark: | The type of transaction. | Payment | \ No newline at end of file diff --git a/expenses/docs/models/webhooks/synccompleteresponse.md b/expenses/docs/models/webhooks/synccompleteresponse.md new file mode 100755 index 000000000..891ffee2a --- /dev/null +++ b/expenses/docs/models/webhooks/synccompleteresponse.md @@ -0,0 +1,10 @@ +# SyncCompleteResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | N/A | +| `status_code` | *int* | :heavy_check_mark: | N/A | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/webhooks/syncfailedresponse.md b/expenses/docs/models/webhooks/syncfailedresponse.md new file mode 100755 index 000000000..162c382d9 --- /dev/null +++ b/expenses/docs/models/webhooks/syncfailedresponse.md @@ -0,0 +1,10 @@ +# SyncFailedResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | N/A | +| `status_code` | *int* | :heavy_check_mark: | N/A | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/webhooks/syncstartedresponse.md b/expenses/docs/models/webhooks/syncstartedresponse.md new file mode 100755 index 000000000..968c36c52 --- /dev/null +++ b/expenses/docs/models/webhooks/syncstartedresponse.md @@ -0,0 +1,10 @@ +# SyncStartedResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | N/A | +| `status_code` | *int* | :heavy_check_mark: | N/A | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/sdks/configuration/README.md b/expenses/docs/sdks/configuration/README.md index 9244818d2..e7cc14b07 100755 --- a/expenses/docs/sdks/configuration/README.md +++ b/expenses/docs/sdks/configuration/README.md @@ -17,7 +17,7 @@ Gets a companies expense sync configuration ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/docs/sdks/connections/README.md b/expenses/docs/sdks/connections/README.md index 8de5a1287..89b8a05b4 100755 --- a/expenses/docs/sdks/connections/README.md +++ b/expenses/docs/sdks/connections/README.md @@ -16,7 +16,7 @@ Creates a Partner Expense data connection ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/docs/sdks/expenses/README.md b/expenses/docs/sdks/expenses/README.md index 0b7bbdac5..d57ffd36f 100755 --- a/expenses/docs/sdks/expenses/README.md +++ b/expenses/docs/sdks/expenses/README.md @@ -30,6 +30,10 @@ req = operations.CreateExpenseDatasetRequest( create_expense_request=shared.CreateExpenseRequest( items=[ shared.ExpenseTransaction( + contact_ref=shared.ContactRef( + contact_type=shared.ContactRefContactType.SUPPLIER, + id='40e3e57c-2322-4898-966c-ca41adfd23fd', + ), currency='GBP', currency_rate=5928.45, id='4d7c6929-7770-412b-91bb-44d3bc71d111', @@ -131,6 +135,10 @@ req = operations.CreateExpenseDatasetRequest( type=shared.ExpenseTransactionType.PAYMENT, ), shared.ExpenseTransaction( + contact_ref=shared.ContactRef( + contact_type=shared.ContactRefContactType.SUPPLIER, + id='40e3e57c-2322-4898-966c-ca41adfd23fd', + ), currency='GBP', currency_rate=4236.55, id='4d7c6929-7770-412b-91bb-44d3bc71d111', @@ -196,6 +204,10 @@ req = operations.CreateExpenseDatasetRequest( type=shared.ExpenseTransactionType.PAYMENT, ), shared.ExpenseTransaction( + contact_ref=shared.ContactRef( + contact_type=shared.ContactRefContactType.SUPPLIER, + id='40e3e57c-2322-4898-966c-ca41adfd23fd', + ), currency='GBP', currency_rate=8917.73, id='4d7c6929-7770-412b-91bb-44d3bc71d111', @@ -326,30 +338,14 @@ s = codatsyncexpenses.CodatSyncExpenses( req = operations.UpdateExpenseDatasetRequest( update_expense_request=shared.UpdateExpenseRequest( + contact_ref=shared.ContactRef( + contact_type=shared.ContactRefContactType.SUPPLIER, + id='40e3e57c-2322-4898-966c-ca41adfd23fd', + ), currency='GBP', + currency_rate=8121.69, issue_date='2022-06-28T00:00:00.000Z', lines=[ - shared.ExpenseTransactionLine( - account_ref=shared.RecordRef( - id='40e3e57c-2322-4898-966c-ca41adfd23fd', - ), - net_amount=110.42, - tax_amount=14.43, - tax_rate_ref=shared.RecordRef( - id='40e3e57c-2322-4898-966c-ca41adfd23fd', - ), - tracking_refs=[ - shared.RecordRef( - id='40e3e57c-2322-4898-966c-ca41adfd23fd', - ), - shared.RecordRef( - id='40e3e57c-2322-4898-966c-ca41adfd23fd', - ), - shared.RecordRef( - id='40e3e57c-2322-4898-966c-ca41adfd23fd', - ), - ], - ), shared.ExpenseTransactionLine( account_ref=shared.RecordRef( id='40e3e57c-2322-4898-966c-ca41adfd23fd', @@ -410,7 +406,7 @@ req = operations.UpdateExpenseDatasetRequest( ], merchant_name='Amazon UK', notes='APPLE.COM/BILL - 09001077498 - Card Ending: 4590', - type='recusandae', + type=shared.ExpenseType.PAYMENT, ), company_id='8a210b68-6988-11ed-a1eb-0242ac120002', transaction_id='336694d8-2dca-4cb5-a28d-3ccb83e55eee', @@ -443,7 +439,7 @@ Creates an attachment in the accounting software against the given transactionId ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( @@ -453,8 +449,8 @@ s = codatsyncexpenses.CodatSyncExpenses( req = operations.UploadAttachmentRequest( request_body=operations.UploadAttachmentRequestBody( - content='temporibus'.encode(), - request_body='ab', + content='recusandae'.encode(), + request_body='temporibus', ), company_id='8a210b68-6988-11ed-a1eb-0242ac120002', sync_id='6fb40d5e-b13e-11ed-afa1-0242ac120002', diff --git a/expenses/docs/sdks/mappingoptions/README.md b/expenses/docs/sdks/mappingoptions/README.md index b65e02664..95aa47279 100755 --- a/expenses/docs/sdks/mappingoptions/README.md +++ b/expenses/docs/sdks/mappingoptions/README.md @@ -16,7 +16,7 @@ Gets the expense mapping options for a companies accounting software ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/docs/sdks/sync/README.md b/expenses/docs/sdks/sync/README.md index 867e3a87a..52b322076 100755 --- a/expenses/docs/sdks/sync/README.md +++ b/expenses/docs/sdks/sync/README.md @@ -27,8 +27,7 @@ s = codatsyncexpenses.CodatSyncExpenses( req = operations.IntiateSyncRequest( post_sync=shared.PostSync( dataset_ids=[ - '1a05dfc2-ddf7-4cc7-8ca1-ba928fc81674', - '2cb73920-5929-4396-bea7-596eb10faaa2', + '51a05dfc-2ddf-47cc-b8ca-1ba928fc8167', ], ), company_id='8a210b68-6988-11ed-a1eb-0242ac120002', diff --git a/expenses/docs/sdks/syncstatus/README.md b/expenses/docs/sdks/syncstatus/README.md index f9db88a83..13d639c02 100755 --- a/expenses/docs/sdks/syncstatus/README.md +++ b/expenses/docs/sdks/syncstatus/README.md @@ -13,13 +13,13 @@ Check the status of ongoing or previous expense syncs. ## get_last_successful_sync -Gets the status of the last successfull sync +Gets the status of the last successful sync ### Example Usage ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( @@ -58,7 +58,7 @@ Gets the latest sync status ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( @@ -97,7 +97,7 @@ Get the sync status for a specified sync ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( @@ -137,7 +137,7 @@ Gets a list of sync statuses ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/docs/sdks/transactionstatus/README.md b/expenses/docs/sdks/transactionstatus/README.md index ddcbc9dd1..f42a76a49 100755 --- a/expenses/docs/sdks/transactionstatus/README.md +++ b/expenses/docs/sdks/transactionstatus/README.md @@ -17,7 +17,7 @@ Gets the status of a transaction for a sync ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( @@ -58,7 +58,7 @@ Get's the transactions and status for a sync ```python import codatsyncexpenses -from codatsyncexpenses.models import operations +from codatsyncexpenses.models import operations, shared s = codatsyncexpenses.CodatSyncExpenses( security=shared.Security( diff --git a/expenses/files.gen b/expenses/files.gen index f93e05303..dfa62bd8a 100755 --- a/expenses/files.gen +++ b/expenses/files.gen @@ -11,6 +11,7 @@ pylintrc setup.py src/codatsyncexpenses/__init__.py src/codatsyncexpenses/models/__init__.py +src/codatsyncexpenses/models/errors/sdkerror.py src/codatsyncexpenses/utils/__init__.py src/codatsyncexpenses/utils/retries.py src/codatsyncexpenses/utils/utils.py @@ -29,7 +30,7 @@ src/codatsyncexpenses/models/operations/list_syncs.py src/codatsyncexpenses/models/operations/get_sync_transaction.py src/codatsyncexpenses/models/operations/list_sync_transactions.py src/codatsyncexpenses/models/operations/__init__.py -src/codatsyncexpenses/models/shared/schema.py +src/codatsyncexpenses/models/shared/errormessage.py src/codatsyncexpenses/models/shared/companyconfiguration.py src/codatsyncexpenses/models/shared/supplier.py src/codatsyncexpenses/models/shared/customer.py @@ -42,7 +43,9 @@ src/codatsyncexpenses/models/shared/createexpenserequest.py src/codatsyncexpenses/models/shared/expensetransaction.py src/codatsyncexpenses/models/shared/expensetransactionline.py src/codatsyncexpenses/models/shared/recordref.py +src/codatsyncexpenses/models/shared/contactref.py src/codatsyncexpenses/models/shared/updateexpenserequest.py +src/codatsyncexpenses/models/shared/expensetype.py src/codatsyncexpenses/models/shared/attachment.py src/codatsyncexpenses/models/shared/mappingoptions.py src/codatsyncexpenses/models/shared/trackingcategorymappinginfo.py @@ -58,7 +61,15 @@ src/codatsyncexpenses/models/shared/integrationtype.py src/codatsyncexpenses/models/shared/transactionmetadatalist.py src/codatsyncexpenses/models/shared/hallink.py src/codatsyncexpenses/models/shared/security.py +src/codatsyncexpenses/models/shared/synccompletewebhook.py +src/codatsyncexpenses/models/shared/syncfailedwebhook.py +src/codatsyncexpenses/models/shared/syncstartedwebhook.py src/codatsyncexpenses/models/shared/__init__.py +src/codatsyncexpenses/models/webhooks/sync_complete.py +src/codatsyncexpenses/models/webhooks/sync_failed.py +src/codatsyncexpenses/models/webhooks/sync_started.py +src/codatsyncexpenses/models/webhooks/__init__.py +src/codatsyncexpenses/models/errors/__init__.py docs/sdks/codatsyncexpenses/README.md docs/models/utils/retryconfig.md docs/sdks/configuration/README.md @@ -99,7 +110,7 @@ docs/models/operations/getsynctransactionrequest.md docs/models/operations/getsynctransactionresponse.md docs/models/operations/listsynctransactionsrequest.md docs/models/operations/listsynctransactionsresponse.md -docs/models/shared/schema.md +docs/models/shared/errormessage.md docs/models/shared/companyconfiguration.md docs/models/shared/supplier.md docs/models/shared/customer.md @@ -114,7 +125,10 @@ docs/models/shared/expensetransactiontype.md docs/models/shared/expensetransaction.md docs/models/shared/expensetransactionline.md docs/models/shared/recordref.md +docs/models/shared/contactrefcontacttype.md +docs/models/shared/contactref.md docs/models/shared/updateexpenserequest.md +docs/models/shared/expensetype.md docs/models/shared/attachment.md docs/models/shared/mappingoptions.md docs/models/shared/trackingcategorymappinginfo.md @@ -137,4 +151,13 @@ docs/models/shared/integrationtype.md docs/models/shared/transactionmetadatalistlinks.md docs/models/shared/transactionmetadatalist.md docs/models/shared/hallink.md -docs/models/shared/security.md \ No newline at end of file +docs/models/shared/security.md +docs/models/shared/synccompletewebhookdata.md +docs/models/shared/synccompletewebhook.md +docs/models/shared/syncfailedwebhookdata.md +docs/models/shared/syncfailedwebhook.md +docs/models/shared/syncstartedwebhookdata.md +docs/models/shared/syncstartedwebhook.md +docs/models/webhooks/synccompleteresponse.md +docs/models/webhooks/syncfailedresponse.md +docs/models/webhooks/syncstartedresponse.md \ No newline at end of file diff --git a/expenses/gen.yaml b/expenses/gen.yaml index 39435b599..0223c1777 100644 --- a/expenses/gen.yaml +++ b/expenses/gen.yaml @@ -1,15 +1,22 @@ configVersion: 1.0.0 management: - docChecksum: 10a2f2e33bc0830d491b01b2e4f509c9 + docChecksum: 59f9a0dff31860c46214e22a23b994a8 docVersion: prealpha - speakeasyVersion: 1.53.0 - generationVersion: 2.58.0 + speakeasyVersion: 1.73.1 + generationVersion: 2.84.3 generation: sdkClassName: CodatSyncExpenses singleTagPerOp: false telemetryEnabled: true +features: + python: + core: 2.82.0 + examples: 2.81.1 + globalSecurity: 2.81.1 + globalServerURLs: 2.82.0 + retries: 2.81.1 python: - version: 0.33.1 + version: 0.34.0 author: Speakeasy description: Python Client SDK Generated by Speakeasy maxMethodParams: 0 diff --git a/expenses/pylintrc b/expenses/pylintrc index 1ce47d88d..21a389459 100755 --- a/expenses/pylintrc +++ b/expenses/pylintrc @@ -438,7 +438,9 @@ disable=raw-checker-failed, using-constant-test, too-many-statements, cyclic-import, - too-many-nested-blocks + too-many-nested-blocks, + too-many-boolean-expressions, + no-else-raise # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/expenses/setup.py b/expenses/setup.py index c4b9a7e25..18b3153aa 100755 --- a/expenses/setup.py +++ b/expenses/setup.py @@ -10,7 +10,7 @@ setuptools.setup( name="codat-sync-for-expenses", - version="0.33.1", + version="0.34.0", author="Speakeasy", description="Python Client SDK Generated by Speakeasy", long_description=long_description, @@ -19,7 +19,7 @@ install_requires=[ "certifi>=2022.12.7", "charset-normalizer>=2.1.1", - "dataclasses-json-speakeasy>=0.5.8", + "dataclasses-json>=0.5.12", "idna>=3.3", "jsonpath-python>=1.0.6 ", "marshmallow>=3.17.1", diff --git a/expenses/src/codatsyncexpenses/configuration.py b/expenses/src/codatsyncexpenses/configuration.py index 2cf07fc20..bd05ddf8d 100755 --- a/expenses/src/codatsyncexpenses/configuration.py +++ b/expenses/src/codatsyncexpenses/configuration.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class Configuration: @@ -21,7 +21,7 @@ def get_company_configuration(self, request: operations.GetCompanyConfigurationR url = utils.generate_url(operations.GetCompanyConfigurationRequest, base_url, '/companies/{companyId}/sync/expenses/config', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -46,10 +46,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CompanyConfiguration]) res.company_configuration = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -65,7 +69,7 @@ def save_company_configuration(self, request: operations.SaveCompanyConfiguratio req_content_type, data, form = utils.serialize_request_body(request, "company_configuration", 'json') if req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -90,10 +94,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CompanyConfiguration]) res.company_configuration = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/connections.py b/expenses/src/codatsyncexpenses/connections.py index a2682d312..72ef22c7a 100755 --- a/expenses/src/codatsyncexpenses/connections.py +++ b/expenses/src/codatsyncexpenses/connections.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class Connections: @@ -21,7 +21,7 @@ def create_partner_expense_connection(self, request: operations.CreatePartnerExp url = utils.generate_url(operations.CreatePartnerExpenseConnectionRequest, base_url, '/companies/{companyId}/sync/expenses/connections/partnerExpense', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -46,10 +46,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.DataConnection]) res.data_connection = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/expenses.py b/expenses/src/codatsyncexpenses/expenses.py index 3feda772b..93d6f87a6 100755 --- a/expenses/src/codatsyncexpenses/expenses.py +++ b/expenses/src/codatsyncexpenses/expenses.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class Expenses: @@ -24,7 +24,7 @@ def create_expense_dataset(self, request: operations.CreateExpenseDatasetRequest req_content_type, data, form = utils.serialize_request_body(request, "create_expense_request", 'json') if req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -49,10 +49,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CreateExpenseResponse]) res.create_expense_response = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -68,7 +72,7 @@ def update_expense_dataset(self, request: operations.UpdateExpenseDatasetRequest req_content_type, data, form = utils.serialize_request_body(request, "update_expense_request", 'json') if req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -93,10 +97,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[operations.UpdateExpenseDataset202ApplicationJSON]) res.update_expense_dataset_202_application_json_object = out + else: + 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, 404, 422, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -112,7 +120,7 @@ def upload_attachment(self, request: operations.UploadAttachmentRequest, retries req_content_type, data, form = utils.serialize_request_body(request, "request_body", 'multipart') if req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -137,10 +145,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.Attachment]) res.attachment = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/mapping_options.py b/expenses/src/codatsyncexpenses/mapping_options.py index a726c6c3d..89d91994f 100755 --- a/expenses/src/codatsyncexpenses/mapping_options.py +++ b/expenses/src/codatsyncexpenses/mapping_options.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class MappingOptions: @@ -21,7 +21,7 @@ def get_mapping_options(self, request: operations.GetMappingOptionsRequest, retr url = utils.generate_url(operations.GetMappingOptionsRequest, base_url, '/companies/{companyId}/sync/expenses/mappingOptions', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -46,10 +46,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.MappingOptions]) res.mapping_options = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/models/errors/__init__.py b/expenses/src/codatsyncexpenses/models/errors/__init__.py new file mode 100755 index 000000000..cfd848441 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/errors/__init__.py @@ -0,0 +1,4 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from .sdkerror import SDKError +__all__ = ["SDKError"] diff --git a/expenses/src/codatsyncexpenses/models/errors/sdkerror.py b/expenses/src/codatsyncexpenses/models/errors/sdkerror.py new file mode 100755 index 000000000..6bb02bbd6 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/errors/sdkerror.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +import requests as requests_http + + +class SDKError(Exception): + """Represents an error returned by the API.""" + message: str + status_code: int + body: str + raw_response: requests_http.Response + + def __init__(self, message: str, status_code: int, body: str, raw_response: requests_http.Response): + self.message = message + self.status_code = status_code + self.body = body + self.raw_response = raw_response + + def __str__(self): + body = '' + if len(self.body) > 0: + body = f'\n{self.body}' + + return f'{self.message}: Status {self.status_code}{body}' diff --git a/expenses/src/codatsyncexpenses/models/operations/create_expense_dataset.py b/expenses/src/codatsyncexpenses/models/operations/create_expense_dataset.py index 22bb90c77..d6a623d54 100755 --- a/expenses/src/codatsyncexpenses/models/operations/create_expense_dataset.py +++ b/expenses/src/codatsyncexpenses/models/operations/create_expense_dataset.py @@ -5,7 +5,7 @@ import requests as requests_http from ..shared import createexpenserequest as shared_createexpenserequest from ..shared import createexpenseresponse as shared_createexpenseresponse -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -25,8 +25,8 @@ class CreateExpenseDatasetResponse: status_code: int = dataclasses.field() create_expense_response: Optional[shared_createexpenseresponse.CreateExpenseResponse] = dataclasses.field(default=None) r"""OK""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""The request made is not valid.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/create_partner_expense_connection.py b/expenses/src/codatsyncexpenses/models/operations/create_partner_expense_connection.py index f810d06f5..c2b6922e0 100755 --- a/expenses/src/codatsyncexpenses/models/operations/create_partner_expense_connection.py +++ b/expenses/src/codatsyncexpenses/models/operations/create_partner_expense_connection.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import dataconnection as shared_dataconnection -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -23,8 +23,8 @@ class CreatePartnerExpenseConnectionResponse: status_code: int = dataclasses.field() data_connection: Optional[shared_dataconnection.DataConnection] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""The request made is not valid.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/get_company_configuration.py b/expenses/src/codatsyncexpenses/models/operations/get_company_configuration.py index 639078ba1..21423d2d8 100755 --- a/expenses/src/codatsyncexpenses/models/operations/get_company_configuration.py +++ b/expenses/src/codatsyncexpenses/models/operations/get_company_configuration.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import companyconfiguration as shared_companyconfiguration -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -23,8 +23,8 @@ class GetCompanyConfigurationResponse: status_code: int = dataclasses.field() company_configuration: Optional[shared_companyconfiguration.CompanyConfiguration] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/get_last_successful_sync.py b/expenses/src/codatsyncexpenses/models/operations/get_last_successful_sync.py index 7c94e58cd..033681e40 100755 --- a/expenses/src/codatsyncexpenses/models/operations/get_last_successful_sync.py +++ b/expenses/src/codatsyncexpenses/models/operations/get_last_successful_sync.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import companysyncstatus as shared_companysyncstatus -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -23,8 +23,8 @@ class GetLastSuccessfulSyncResponse: status_code: int = dataclasses.field() company_sync_status: Optional[shared_companysyncstatus.CompanySyncStatus] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/get_latest_sync.py b/expenses/src/codatsyncexpenses/models/operations/get_latest_sync.py index 9ac8ad181..598fe704c 100755 --- a/expenses/src/codatsyncexpenses/models/operations/get_latest_sync.py +++ b/expenses/src/codatsyncexpenses/models/operations/get_latest_sync.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import companysyncstatus as shared_companysyncstatus -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -23,8 +23,8 @@ class GetLatestSyncResponse: status_code: int = dataclasses.field() company_sync_status: Optional[shared_companysyncstatus.CompanySyncStatus] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/get_mapping_options.py b/expenses/src/codatsyncexpenses/models/operations/get_mapping_options.py index e8027419d..0c0e42881 100755 --- a/expenses/src/codatsyncexpenses/models/operations/get_mapping_options.py +++ b/expenses/src/codatsyncexpenses/models/operations/get_mapping_options.py @@ -3,8 +3,8 @@ from __future__ import annotations import dataclasses import requests as requests_http +from ..shared import errormessage as shared_errormessage from ..shared import mappingoptions as shared_mappingoptions -from ..shared import schema as shared_schema from typing import Optional @@ -21,10 +21,10 @@ class GetMappingOptionsRequest: class GetMappingOptionsResponse: content_type: str = dataclasses.field() status_code: int = dataclasses.field() + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) + r"""Your API request was not properly authorized.""" mapping_options: Optional[shared_mappingoptions.MappingOptions] = dataclasses.field(default=None) r"""Success""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) - r"""Your API request was not properly authorized.""" diff --git a/expenses/src/codatsyncexpenses/models/operations/get_sync_by_id.py b/expenses/src/codatsyncexpenses/models/operations/get_sync_by_id.py index 824aae06d..eafc89389 100755 --- a/expenses/src/codatsyncexpenses/models/operations/get_sync_by_id.py +++ b/expenses/src/codatsyncexpenses/models/operations/get_sync_by_id.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import companysyncstatus as shared_companysyncstatus -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -25,8 +25,8 @@ class GetSyncByIDResponse: status_code: int = dataclasses.field() company_sync_status: Optional[shared_companysyncstatus.CompanySyncStatus] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py b/expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py index 173d96ddc..8245aa252 100755 --- a/expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py +++ b/expenses/src/codatsyncexpenses/models/operations/get_sync_transaction.py @@ -3,7 +3,7 @@ from __future__ import annotations import dataclasses import requests as requests_http -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from ..shared import transactionmetadata as shared_transactionmetadata from typing import Optional @@ -25,9 +25,9 @@ class GetSyncTransactionRequest: class GetSyncTransactionResponse: content_type: str = dataclasses.field() status_code: int = dataclasses.field() - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) transaction_metadata: Optional[list[shared_transactionmetadata.TransactionMetadata]] = dataclasses.field(default=None) r"""Success""" diff --git a/expenses/src/codatsyncexpenses/models/operations/list_sync_transactions.py b/expenses/src/codatsyncexpenses/models/operations/list_sync_transactions.py index d73187e98..61ccfb210 100755 --- a/expenses/src/codatsyncexpenses/models/operations/list_sync_transactions.py +++ b/expenses/src/codatsyncexpenses/models/operations/list_sync_transactions.py @@ -3,7 +3,7 @@ from __future__ import annotations import dataclasses import requests as requests_http -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from ..shared import transactionmetadatalist as shared_transactionmetadatalist from typing import Optional @@ -27,9 +27,9 @@ class ListSyncTransactionsRequest: class ListSyncTransactionsResponse: content_type: str = dataclasses.field() status_code: int = dataclasses.field() - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) transaction_metadata_list: Optional[shared_transactionmetadatalist.TransactionMetadataList] = dataclasses.field(default=None) r"""Success""" diff --git a/expenses/src/codatsyncexpenses/models/operations/list_syncs.py b/expenses/src/codatsyncexpenses/models/operations/list_syncs.py index bb74f10dc..29fdc0b22 100755 --- a/expenses/src/codatsyncexpenses/models/operations/list_syncs.py +++ b/expenses/src/codatsyncexpenses/models/operations/list_syncs.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import companysyncstatus as shared_companysyncstatus -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -23,8 +23,8 @@ class ListSyncsResponse: status_code: int = dataclasses.field() company_sync_statuses: Optional[list[shared_companysyncstatus.CompanySyncStatus]] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""Your API request was not properly authorized.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/save_company_configuration.py b/expenses/src/codatsyncexpenses/models/operations/save_company_configuration.py index 3f6a715f4..e823a3ce8 100755 --- a/expenses/src/codatsyncexpenses/models/operations/save_company_configuration.py +++ b/expenses/src/codatsyncexpenses/models/operations/save_company_configuration.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import companyconfiguration as shared_companyconfiguration -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -24,8 +24,8 @@ class SaveCompanyConfigurationResponse: status_code: int = dataclasses.field() company_configuration: Optional[shared_companyconfiguration.CompanyConfiguration] = dataclasses.field(default=None) r"""Success""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""The request made is not valid.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py b/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py index 3896363bf..e8419e9a5 100755 --- a/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py +++ b/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py @@ -3,7 +3,7 @@ from __future__ import annotations import dataclasses import requests as requests_http -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from ..shared import updateexpenserequest as shared_updateexpenserequest from codatsyncexpenses import utils from dataclasses_json import Undefined, dataclass_json @@ -36,9 +36,9 @@ class UpdateExpenseDataset202ApplicationJSON: class UpdateExpenseDatasetResponse: content_type: str = dataclasses.field() status_code: int = dataclasses.field() - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""The request made is not valid.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) update_expense_dataset_202_application_json_object: Optional[UpdateExpenseDataset202ApplicationJSON] = dataclasses.field(default=None) r"""Accepted""" diff --git a/expenses/src/codatsyncexpenses/models/operations/upload_attachment.py b/expenses/src/codatsyncexpenses/models/operations/upload_attachment.py index c0b64ee40..42c2303cc 100755 --- a/expenses/src/codatsyncexpenses/models/operations/upload_attachment.py +++ b/expenses/src/codatsyncexpenses/models/operations/upload_attachment.py @@ -4,7 +4,7 @@ import dataclasses import requests as requests_http from ..shared import attachment as shared_attachment -from ..shared import schema as shared_schema +from ..shared import errormessage as shared_errormessage from typing import Optional @@ -37,8 +37,8 @@ class UploadAttachmentResponse: status_code: int = dataclasses.field() attachment: Optional[shared_attachment.Attachment] = dataclasses.field(default=None) r"""OK""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) - schema: Optional[shared_schema.Schema] = dataclasses.field(default=None) + error_message: Optional[shared_errormessage.ErrorMessage] = dataclasses.field(default=None) r"""The request made is not valid.""" + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/expenses/src/codatsyncexpenses/models/shared/__init__.py b/expenses/src/codatsyncexpenses/models/shared/__init__.py index 63c1841a3..16b99c368 100755 --- a/expenses/src/codatsyncexpenses/models/shared/__init__.py +++ b/expenses/src/codatsyncexpenses/models/shared/__init__.py @@ -6,23 +6,28 @@ from .codaterrormessage import * from .companyconfiguration import * from .companysyncstatus import * +from .contactref import * from .createexpenserequest import * from .createexpenseresponse import * from .customer import * from .dataconnection import * from .dataconnectionerror import * from .dataconnectionstatus import * +from .errormessage import * from .expensetransaction import * from .expensetransactionline import * +from .expensetype import * from .hallink import * from .integrationtype import * from .mappingoptions import * from .postsync import * from .recordref import * -from .schema import * from .security import * from .supplier import * +from .synccompletewebhook import * +from .syncfailedwebhook import * from .syncinitiated import * +from .syncstartedwebhook import * from .taxratemappinginfo import * from .trackingcategorymappinginfo import * from .transactionmetadata import * @@ -30,4 +35,4 @@ from .transactionstatus import * from .updateexpenserequest import * -__all__ = ["AccountMappingInfo","AccountMappingInfoAccountType","AccountMappingInfoValidTransactionTypes","Attachment","BankAccount","CodatErrorMessage","CodatErrorMessageValidation","CodatErrorMessageValidationErrors","CodatErrorMessageValidationInternals","CodatErrorMessageValidationWarnings","CompanyConfiguration","CompanySyncStatus","CreateExpenseRequest","CreateExpenseResponse","Customer","DataConnection","DataConnectionError","DataConnectionSourceType","DataConnectionStatus","ExpenseTransaction","ExpenseTransactionLine","ExpenseTransactionType","HalLink","IntegrationType","MappingOptions","PostSync","RecordRef","Schema","Security","Supplier","SyncInitiated","TaxRateMappingInfo","TaxRateMappingInfoValidTransactionTypes","TrackingCategoryMappingInfo","TransactionMetadata","TransactionMetadataList","TransactionMetadataListLinks","TransactionStatus","UpdateExpenseRequest"] +__all__ = ["AccountMappingInfo","AccountMappingInfoAccountType","AccountMappingInfoValidTransactionTypes","Attachment","BankAccount","CodatErrorMessage","CodatErrorMessageValidation","CodatErrorMessageValidationErrors","CodatErrorMessageValidationInternals","CodatErrorMessageValidationWarnings","CompanyConfiguration","CompanySyncStatus","ContactRef","ContactRefContactType","CreateExpenseRequest","CreateExpenseResponse","Customer","DataConnection","DataConnectionError","DataConnectionSourceType","DataConnectionStatus","ErrorMessage","ExpenseTransaction","ExpenseTransactionLine","ExpenseTransactionType","ExpenseType","HalLink","IntegrationType","MappingOptions","PostSync","RecordRef","Security","Supplier","SyncCompleteWebhook","SyncCompleteWebhookData","SyncFailedWebhook","SyncFailedWebhookData","SyncInitiated","SyncStartedWebhook","SyncStartedWebhookData","TaxRateMappingInfo","TaxRateMappingInfoValidTransactionTypes","TrackingCategoryMappingInfo","TransactionMetadata","TransactionMetadataList","TransactionMetadataListLinks","TransactionStatus","UpdateExpenseRequest"] diff --git a/expenses/src/codatsyncexpenses/models/shared/companysyncstatus.py b/expenses/src/codatsyncexpenses/models/shared/companysyncstatus.py index 0aa8a8536..c48f4fe71 100755 --- a/expenses/src/codatsyncexpenses/models/shared/companysyncstatus.py +++ b/expenses/src/codatsyncexpenses/models/shared/companysyncstatus.py @@ -28,20 +28,20 @@ class CompanySyncStatus: r"""Status code of the sync.""" sync_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncUtc'), 'exclude': lambda f: f is None }}) r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - + ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` - - - + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` - + > Time zones > > Not all dates from Codat will contain information about time zones. diff --git a/expenses/src/codatsyncexpenses/models/shared/contactref.py b/expenses/src/codatsyncexpenses/models/shared/contactref.py new file mode 100755 index 000000000..7f0ac3ad1 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/shared/contactref.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from codatsyncexpenses import utils +from dataclasses_json import Undefined, dataclass_json +from enum import Enum +from typing import Optional + +class ContactRefContactType(str, Enum): + r"""The type of contact.""" + SUPPLIER = 'Supplier' + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class ContactRef: + contact_type: Optional[ContactRefContactType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('contactType'), 'exclude': lambda f: f is None }}) + r"""The type of contact.""" + id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) + r"""Identifier of supplier or customer.""" + + diff --git a/expenses/src/codatsyncexpenses/models/shared/dataconnection.py b/expenses/src/codatsyncexpenses/models/shared/dataconnection.py index ba33e496b..78df0a188 100755 --- a/expenses/src/codatsyncexpenses/models/shared/dataconnection.py +++ b/expenses/src/codatsyncexpenses/models/shared/dataconnection.py @@ -23,32 +23,32 @@ class DataConnectionSourceType(str, Enum): @dataclasses.dataclass class DataConnection: r"""A connection represents a [company's](https://docs.codat.io/codat-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. - + A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: - + - [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection. - [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections. - [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections. Any combination of accounting, banking, and commerce data connections is allowed. - + Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). """ created: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('created') }}) r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - + ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` - - - + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` - + > Time zones > > Not all dates from Codat will contain information about time zones. @@ -73,20 +73,20 @@ class DataConnection: data_connection_errors: Optional[list[shared_dataconnectionerror.DataConnectionError]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('dataConnectionErrors'), 'exclude': lambda f: f is None }}) last_sync: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lastSync'), 'exclude': lambda f: f is None }}) r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - + ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` - - - + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` - + > Time zones > > Not all dates from Codat will contain information about time zones. diff --git a/expenses/src/codatsyncexpenses/models/shared/dataconnectionerror.py b/expenses/src/codatsyncexpenses/models/shared/dataconnectionerror.py index f1771aa69..eec7600d2 100755 --- a/expenses/src/codatsyncexpenses/models/shared/dataconnectionerror.py +++ b/expenses/src/codatsyncexpenses/models/shared/dataconnectionerror.py @@ -13,20 +13,20 @@ class DataConnectionError: errored_on_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('erroredOnUtc'), 'exclude': lambda f: f is None }}) r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - + ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` - - - + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` - + > Time zones > > Not all dates from Codat will contain information about time zones. diff --git a/expenses/src/codatsyncexpenses/models/shared/schema.py b/expenses/src/codatsyncexpenses/models/shared/errormessage.py similarity index 98% rename from expenses/src/codatsyncexpenses/models/shared/schema.py rename to expenses/src/codatsyncexpenses/models/shared/errormessage.py index c420d0fa1..e07a110d2 100755 --- a/expenses/src/codatsyncexpenses/models/shared/schema.py +++ b/expenses/src/codatsyncexpenses/models/shared/errormessage.py @@ -10,7 +10,7 @@ @dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass -class Schema: +class ErrorMessage: r"""Your API request was not properly authorized.""" can_be_retried: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('canBeRetried'), 'exclude': lambda f: f is None }}) correlation_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('correlationId'), 'exclude': lambda f: f is None }}) diff --git a/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py b/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py index 3d8e861a5..bddbfa5f5 100755 --- a/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py +++ b/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py @@ -2,6 +2,7 @@ from __future__ import annotations import dataclasses +from ..shared import contactref as shared_contactref from ..shared import expensetransactionline as shared_expensetransactionline from codatsyncexpenses import utils from dataclasses_json import Undefined, dataclass_json @@ -30,20 +31,20 @@ class ExpenseTransaction: r"""Your unique identifier for the transaction.""" issue_date: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('issueDate') }}) r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - + ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` - - - + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` - + > Time zones > > Not all dates from Codat will contain information about time zones. @@ -51,27 +52,28 @@ class ExpenseTransaction: """ type: ExpenseTransactionType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type') }}) r"""The type of transaction.""" + contact_ref: Optional[shared_contactref.ContactRef] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('contactRef'), 'exclude': lambda f: f is None }}) currency_rate: Optional[float] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currencyRate'), 'exclude': lambda f: f is None }}) r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - + Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - + For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - + ## Examples with base currency of GBP - + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | - + ## Examples with base currency of USD - + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | diff --git a/expenses/src/codatsyncexpenses/models/shared/expensetype.py b/expenses/src/codatsyncexpenses/models/shared/expensetype.py new file mode 100755 index 000000000..49941c64e --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/shared/expensetype.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + +class ExpenseType(str, Enum): + r"""The type of transaction.""" + PAYMENT = 'Payment' + REFUND = 'Refund' + REWARD = 'Reward' + CHARGEBACK = 'Chargeback' + TRANSFER_IN = 'TransferIn' + TRANSFER_OUT = 'TransferOut' + ADJUSTMENT_IN = 'AdjustmentIn' + ADJUSTMENT_OUT = 'AdjustmentOut' diff --git a/expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py b/expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py new file mode 100755 index 000000000..aaaba043e --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/shared/synccompletewebhook.py @@ -0,0 +1,84 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from codatsyncexpenses import utils +from dataclasses_json import Undefined, dataclass_json +from typing import Optional + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class SyncCompleteWebhookData: + sync_date_range_finish_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('SyncDateRangeFinishUtc'), 'exclude': lambda f: f is None }}) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + sync_date_range_start_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('SyncDateRangeStartUtc'), 'exclude': lambda f: f is None }}) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + sync_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncId'), 'exclude': lambda f: f is None }}) + sync_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncType'), 'exclude': lambda f: f is None }}) + r"""The type of sync being performed.""" + + + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class SyncCompleteWebhook: + r"""Webhook request body used to notify that a sync has completed.""" + alert_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('AlertId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier of the webhook event.""" + client_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ClientId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier for your client in Codat.""" + client_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ClientName'), 'exclude': lambda f: f is None }}) + r"""Name of your client in Codat.""" + company_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('CompanyId'), 'exclude': lambda f: f is None }}) + 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.""" + 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.""" + 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/expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py b/expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py new file mode 100755 index 000000000..5a63fb499 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/shared/syncfailedwebhook.py @@ -0,0 +1,86 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from codatsyncexpenses import utils +from dataclasses_json import Undefined, dataclass_json +from typing import Optional + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class SyncFailedWebhookData: + failure_stage: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('FailureStage'), 'exclude': lambda f: f is None }}) + r"""The stage of the job the sync failed.""" + sync_date_range_finish_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('SyncDateRangeFinishUtc'), 'exclude': lambda f: f is None }}) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + sync_date_range_start_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('SyncDateRangeStartUtc'), 'exclude': lambda f: f is None }}) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + sync_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncId'), 'exclude': lambda f: f is None }}) + sync_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncType'), 'exclude': lambda f: f is None }}) + r"""The type of sync being performed.""" + + + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class SyncFailedWebhook: + r"""Webhook request body used to notify that a sync has failed.""" + alert_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('AlertId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier of the webhook event.""" + client_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ClientId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier for your client in Codat.""" + client_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ClientName'), 'exclude': lambda f: f is None }}) + r"""Name of your client in Codat.""" + company_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('CompanyId'), 'exclude': lambda f: f is None }}) + 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.""" + 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.""" + 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/expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py b/expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py new file mode 100755 index 000000000..802ed4159 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/shared/syncstartedwebhook.py @@ -0,0 +1,84 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from codatsyncexpenses import utils +from dataclasses_json import Undefined, dataclass_json +from typing import Optional + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class SyncStartedWebhookData: + sync_date_range_finish_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('SyncDateRangeFinishUtc'), 'exclude': lambda f: f is None }}) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + sync_date_range_start_utc: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('SyncDateRangeStartUtc'), 'exclude': lambda f: f is None }}) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + sync_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncId'), 'exclude': lambda f: f is None }}) + sync_type: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncType'), 'exclude': lambda f: f is None }}) + r"""The type of sync being performed.""" + + + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class SyncStartedWebhook: + r"""Webhook request body used to notify that a sync has started.""" + alert_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('AlertId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier of the webhook event.""" + client_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ClientId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier for your client in Codat.""" + client_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('ClientName'), 'exclude': lambda f: f is None }}) + r"""Name of your client in Codat.""" + company_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('CompanyId'), 'exclude': lambda f: f is None }}) + r"""Unique identifier for your SMB in Codat.""" + data: Optional[SyncStartedWebhookData] = 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.""" + 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.""" + 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/expenses/src/codatsyncexpenses/models/shared/trackingcategorymappinginfo.py b/expenses/src/codatsyncexpenses/models/shared/trackingcategorymappinginfo.py index 87a1f62ee..d1f63852b 100755 --- a/expenses/src/codatsyncexpenses/models/shared/trackingcategorymappinginfo.py +++ b/expenses/src/codatsyncexpenses/models/shared/trackingcategorymappinginfo.py @@ -17,20 +17,20 @@ class TrackingCategoryMappingInfo: r"""Unique identifier of the tracking category.""" modified_date: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('modifiedDate'), 'exclude': lambda f: f is None }}) r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - + ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` - - - + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` - + > Time zones > > Not all dates from Codat will contain information about time zones. diff --git a/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py b/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py index 415f9630e..10a2fa196 100755 --- a/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py +++ b/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py @@ -2,10 +2,12 @@ from __future__ import annotations import dataclasses +from ..shared import contactref as shared_contactref from ..shared import expensetransactionline as shared_expensetransactionline +from ..shared import expensetype as shared_expensetype from codatsyncexpenses import utils from dataclasses_json import Undefined, dataclass_json -from typing import Any, Optional +from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) @@ -14,9 +16,38 @@ class UpdateExpenseRequest: issue_date: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('issueDate') }}) r"""Date the transaction was recorded.""" - type: Any = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type') }}) + type: shared_expensetype.ExpenseType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type') }}) + r"""The type of transaction.""" + contact_ref: Optional[shared_contactref.ContactRef] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('contactRef'), 'exclude': lambda f: f is None }}) currency: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currency'), 'exclude': lambda f: f is None }}) r"""Currency the transaction was recorded in.""" + currency_rate: Optional[float] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('currencyRate'), 'exclude': lambda f: f is None }}) + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + """ lines: Optional[list[shared_expensetransactionline.ExpenseTransactionLine]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lines'), 'exclude': lambda f: f is None }}) r"""Array of transaction lines.""" merchant_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('merchantName'), 'exclude': lambda f: f is None }}) diff --git a/expenses/src/codatsyncexpenses/models/webhooks/__init__.py b/expenses/src/codatsyncexpenses/models/webhooks/__init__.py new file mode 100755 index 000000000..a9296338c --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/webhooks/__init__.py @@ -0,0 +1,7 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from .sync_complete import * +from .sync_failed import * +from .sync_started import * + +__all__ = ["SyncCompleteResponse","SyncFailedResponse","SyncStartedResponse"] diff --git a/expenses/src/codatsyncexpenses/models/webhooks/sync_complete.py b/expenses/src/codatsyncexpenses/models/webhooks/sync_complete.py new file mode 100755 index 000000000..f396d61c7 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/webhooks/sync_complete.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +import requests as requests_http +from typing import Optional + + + +@dataclasses.dataclass +class SyncCompleteResponse: + content_type: str = dataclasses.field() + status_code: int = dataclasses.field() + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + + diff --git a/expenses/src/codatsyncexpenses/models/webhooks/sync_failed.py b/expenses/src/codatsyncexpenses/models/webhooks/sync_failed.py new file mode 100755 index 000000000..e43ccd28f --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/webhooks/sync_failed.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +import requests as requests_http +from typing import Optional + + + +@dataclasses.dataclass +class SyncFailedResponse: + content_type: str = dataclasses.field() + status_code: int = dataclasses.field() + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + + diff --git a/expenses/src/codatsyncexpenses/models/webhooks/sync_started.py b/expenses/src/codatsyncexpenses/models/webhooks/sync_started.py new file mode 100755 index 000000000..5815a03a5 --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/webhooks/sync_started.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +import requests as requests_http +from typing import Optional + + + +@dataclasses.dataclass +class SyncStartedResponse: + content_type: str = dataclasses.field() + status_code: int = dataclasses.field() + raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + + diff --git a/expenses/src/codatsyncexpenses/sdk.py b/expenses/src/codatsyncexpenses/sdk.py index 67828ce99..4a7a3af2e 100755 --- a/expenses/src/codatsyncexpenses/sdk.py +++ b/expenses/src/codatsyncexpenses/sdk.py @@ -15,9 +15,9 @@ class CodatSyncExpenses: r"""Sync for Expenses API: The API for Sync for Expenses. Sync for Expenses is an API and a set of supporting tools. It has been built to enable corporate card and expense management platforms to provide high-quality integrations with multiple accounting platforms through a standardized API. - + [Read more...](https://docs.codat.io/sync-for-expenses/overview) - + [See our OpenAPI spec](https://github.com/codatio/oas) """ configuration: Configuration diff --git a/expenses/src/codatsyncexpenses/sdkconfiguration.py b/expenses/src/codatsyncexpenses/sdkconfiguration.py index 697af8fdd..f0e7f9f6a 100755 --- a/expenses/src/codatsyncexpenses/sdkconfiguration.py +++ b/expenses/src/codatsyncexpenses/sdkconfiguration.py @@ -17,8 +17,8 @@ class SDKConfiguration: server_idx: int = 0 language: str = 'python' openapi_doc_version: str = 'prealpha' - sdk_version: str = '0.33.1' - gen_version: str = '2.58.0' + sdk_version: str = '0.34.0' + gen_version: str = '2.84.3' def get_server_details(self) -> tuple[str, dict[str, str]]: if self.server_url: diff --git a/expenses/src/codatsyncexpenses/sync.py b/expenses/src/codatsyncexpenses/sync.py index 4503c9c6d..5a212ec0c 100755 --- a/expenses/src/codatsyncexpenses/sync.py +++ b/expenses/src/codatsyncexpenses/sync.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class Sync: @@ -24,7 +24,7 @@ def intiate_sync(self, request: operations.IntiateSyncRequest, retries: Optional req_content_type, data, form = utils.serialize_request_body(request, "post_sync", 'json') if req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -49,10 +49,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.SyncInitiated]) res.sync_initiated = out + else: + 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, 404, 422]: if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CodatErrorMessage]) res.codat_error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/sync_status.py b/expenses/src/codatsyncexpenses/sync_status.py index fb61c2bad..a82906aeb 100755 --- a/expenses/src/codatsyncexpenses/sync_status.py +++ b/expenses/src/codatsyncexpenses/sync_status.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class SyncStatus: @@ -15,13 +15,13 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: def get_last_successful_sync(self, request: operations.GetLastSuccessfulSyncRequest, retries: Optional[utils.RetryConfig] = None) -> operations.GetLastSuccessfulSyncResponse: r"""Last successful sync - Gets the status of the last successfull sync + Gets the status of the last successful sync """ 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;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -46,10 +46,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CompanySyncStatus]) res.company_sync_status = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -62,7 +66,7 @@ def get_latest_sync(self, request: operations.GetLatestSyncRequest, retries: Opt url = utils.generate_url(operations.GetLatestSyncRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/latest/status', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -87,10 +91,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CompanySyncStatus]) res.company_sync_status = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -103,7 +111,7 @@ def get_sync_by_id(self, request: operations.GetSyncByIDRequest, retries: Option url = utils.generate_url(operations.GetSyncByIDRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/{syncId}/status', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -128,10 +136,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CompanySyncStatus]) res.company_sync_status = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -144,7 +156,7 @@ def list_syncs(self, request: operations.ListSyncsRequest, retries: Optional[uti url = utils.generate_url(operations.ListSyncsRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/list/status', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -169,10 +181,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[list[shared.CompanySyncStatus]]) res.company_sync_statuses = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/transaction_status.py b/expenses/src/codatsyncexpenses/transaction_status.py index 4c3926894..1deb24d52 100755 --- a/expenses/src/codatsyncexpenses/transaction_status.py +++ b/expenses/src/codatsyncexpenses/transaction_status.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from codatsyncexpenses import utils -from codatsyncexpenses.models import operations, shared +from codatsyncexpenses.models import errors, operations, shared from typing import Optional class TransactionStatus: @@ -21,7 +21,7 @@ def get_sync_transaction(self, request: operations.GetSyncTransactionRequest, re url = utils.generate_url(operations.GetSyncTransactionRequest, base_url, '/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}', request) headers = {} - headers['Accept'] = 'application/json;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -46,10 +46,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[list[shared.TransactionMetadata]]) res.transaction_metadata = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res @@ -63,7 +67,7 @@ def list_sync_transactions(self, request: operations.ListSyncTransactionsRequest 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;q=1, application/json;q=0' + headers['Accept'] = 'application/json' headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' client = self.sdk_configuration.security_client @@ -88,10 +92,14 @@ def do_request(): if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.TransactionMetadataList]) res.transaction_metadata_list = out + else: + 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, 404, 429]: if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Schema]) - res.schema = out + out = utils.unmarshal_json(http_res.text, Optional[shared.ErrorMessage]) + res.error_message = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) return res diff --git a/expenses/src/codatsyncexpenses/utils/utils.py b/expenses/src/codatsyncexpenses/utils/utils.py index 6b39ecf74..3456af651 100755 --- a/expenses/src/codatsyncexpenses/utils/utils.py +++ b/expenses/src/codatsyncexpenses/utils/utils.py @@ -678,7 +678,10 @@ def unmarshal_json(data, typ): unmarhsal = make_dataclass('Unmarhsal', [('res', typ)], bases=(DataClassJsonMixin,)) json_dict = json.loads(data) - out = unmarhsal.from_dict({"res": json_dict}) + try: + out = unmarhsal.from_dict({"res": json_dict}) + except AttributeError as attr_err: + raise AttributeError(f'unable to unmarshal {data} as {typ}') from attr_err return out.res