diff --git a/expenses/.gitignore b/expenses/.gitignore index 648876d29..8ac3f51d4 100755 --- a/expenses/.gitignore +++ b/expenses/.gitignore @@ -1,3 +1,5 @@ +.python-version +.DS_Store venv/ src/*.egg-info/ __pycache__/ diff --git a/expenses/README.md b/expenses/README.md index f1868270f..53bd3fdcc 100755 --- a/expenses/README.md +++ b/expenses/README.md @@ -49,6 +49,7 @@ if res.company_configuration is not None: ### [expenses](docs/sdks/expenses/README.md) * [create_expense_dataset](docs/sdks/expenses/README.md#create_expense_dataset) - Create expense-transactions +* [update_expense_dataset](docs/sdks/expenses/README.md#update_expense_dataset) - Update expense-transactions * [upload_attachment](docs/sdks/expenses/README.md#upload_attachment) - Upload attachment ### [mapping_options](docs/sdks/mappingoptions/README.md) diff --git a/expenses/RELEASES.md b/expenses/RELEASES.md index 6dacc61ff..5d73a2aa6 100644 --- a/expenses/RELEASES.md +++ b/expenses/RELEASES.md @@ -526,4 +526,84 @@ Based on: - OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml - Speakeasy CLI 1.48.0 (2.41.1) https://github.com/speakeasy-api/speakeasy ### Releases -- [PyPI v0.27.1] https://pypi.org/project/codat-sync-for-expenses/0.27.1 - expenses \ No newline at end of file +- [PyPI v0.27.1] https://pypi.org/project/codat-sync-for-expenses/0.27.1 - expenses + +## 2023-06-20 00:13:59 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.49.0 (2.41.4) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.27.2] https://pypi.org/project/codat-sync-for-expenses/0.27.2 - expenses + +## 2023-06-21 00:14:42 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.49.1 (2.41.5) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.27.3] https://pypi.org/project/codat-sync-for-expenses/0.27.3 - expenses + +## 2023-06-23 00:17:48 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.50.1 (2.43.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.28.0] https://pypi.org/project/codat-sync-for-expenses/0.28.0 - expenses + +## 2023-06-27 00:17:56 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.51.1 (2.50.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.29.0] https://pypi.org/project/codat-sync-for-expenses/0.29.0 - expenses + +## 2023-06-29 00:16:50 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.51.3 (2.52.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.30.0] https://pypi.org/project/codat-sync-for-expenses/0.30.0 - expenses + +## 2023-07-01 00:18:44 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.52.0 (2.55.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.31.0] https://pypi.org/project/codat-sync-for-expenses/0.31.0 - expenses + +## 2023-07-04 00:16:58 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.52.0 (2.55.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.31.1] https://pypi.org/project/codat-sync-for-expenses/0.31.1 - expenses + +## 2023-07-06 00:17:28 +### Changes +Based on: +- OpenAPI Doc prealpha https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Expenses.yaml +- Speakeasy CLI 1.52.2 (2.57.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.32.0] https://pypi.org/project/codat-sync-for-expenses/0.32.0 - expenses + +## 2023-07-07 00:16:55 +### Changes +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.0] https://pypi.org/project/codat-sync-for-expenses/0.33.0 - expenses + +## 2023-07-07 09:23:21 +### Changes +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 diff --git a/expenses/docs/models/operations/updateexpensedataset202applicationjson.md b/expenses/docs/models/operations/updateexpensedataset202applicationjson.md new file mode 100755 index 000000000..0cafdc3ba --- /dev/null +++ b/expenses/docs/models/operations/updateexpensedataset202applicationjson.md @@ -0,0 +1,10 @@ +# UpdateExpenseDataset202ApplicationJSON + +Accepted + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `sync_id` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/expenses/docs/models/operations/updateexpensedatasetrequest.md b/expenses/docs/models/operations/updateexpensedatasetrequest.md new file mode 100755 index 000000000..3bf50ad10 --- /dev/null +++ b/expenses/docs/models/operations/updateexpensedatasetrequest.md @@ -0,0 +1,10 @@ +# UpdateExpenseDatasetRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `update_expense_request` | [Optional[shared.UpdateExpenseRequest]](../../models/shared/updateexpenserequest.md) | :heavy_minus_sign: | N/A | | +| `company_id` | *str* | :heavy_check_mark: | N/A | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `transaction_id` | *str* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file diff --git a/expenses/docs/models/operations/updateexpensedatasetresponse.md b/expenses/docs/models/operations/updateexpensedatasetresponse.md new file mode 100755 index 000000000..49d84d916 --- /dev/null +++ b/expenses/docs/models/operations/updateexpensedatasetresponse.md @@ -0,0 +1,12 @@ +# UpdateExpenseDatasetResponse + + +## 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 | +| `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/shared/dataconnection.md b/expenses/docs/models/shared/dataconnection.md index 587af74b9..08073026c 100755 --- a/expenses/docs/models/shared/dataconnection.md +++ b/expenses/docs/models/shared/dataconnection.md @@ -1,6 +1,15 @@ # DataConnection -A connection represents the link between a `company` and a source of data. +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). ## Fields diff --git a/expenses/docs/models/shared/expensetransaction.md b/expenses/docs/models/shared/expensetransaction.md index ee8d76e1e..9e8f00616 100755 --- a/expenses/docs/models/shared/expensetransaction.md +++ b/expenses/docs/models/shared/expensetransaction.md @@ -3,13 +3,13 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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.

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 | -| `issue_date` | *str* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00: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` | [ExpenseTransactionType](../../models/shared/expensetransactiontype.md) | :heavy_check_mark: | The type of transaction. | Payment | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 | +| `issue_date` | *str* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23T00: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` | [ExpenseTransactionType](../../models/shared/expensetransactiontype.md) | :heavy_check_mark: | The type of transaction. | Payment | \ No newline at end of file diff --git a/expenses/docs/models/shared/updateexpenserequest.md b/expenses/docs/models/shared/updateexpenserequest.md new file mode 100755 index 000000000..0fa5fb52d --- /dev/null +++ b/expenses/docs/models/shared/updateexpenserequest.md @@ -0,0 +1,13 @@ +# UpdateExpenseRequest + + +## 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 diff --git a/expenses/docs/sdks/expenses/README.md b/expenses/docs/sdks/expenses/README.md index 4cbc91154..0b7bbdac5 100755 --- a/expenses/docs/sdks/expenses/README.md +++ b/expenses/docs/sdks/expenses/README.md @@ -7,6 +7,7 @@ Create expense datasets and upload receipts. ### Available Operations * [create_expense_dataset](#create_expense_dataset) - Create expense-transactions +* [update_expense_dataset](#update_expense_dataset) - Update expense-transactions * [upload_attachment](#upload_attachment) - Upload attachment ## create_expense_dataset @@ -307,6 +308,133 @@ if res.create_expense_response is not None: **[operations.CreateExpenseDatasetResponse](../../models/operations/createexpensedatasetresponse.md)** +## update_expense_dataset + +Update an expense transaction + +### Example Usage + +```python +import codatsyncexpenses +from codatsyncexpenses.models import operations, shared + +s = codatsyncexpenses.CodatSyncExpenses( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +req = operations.UpdateExpenseDatasetRequest( + update_expense_request=shared.UpdateExpenseRequest( + currency='GBP', + 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', + ), + 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.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', + ), + 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', + ), + ], + ), + ], + merchant_name='Amazon UK', + notes='APPLE.COM/BILL - 09001077498 - Card Ending: 4590', + type='recusandae', + ), + company_id='8a210b68-6988-11ed-a1eb-0242ac120002', + transaction_id='336694d8-2dca-4cb5-a28d-3ccb83e55eee', +) + +res = s.expenses.update_expense_dataset(req) + +if res.update_expense_dataset_202_application_json_object is not None: + # handle response +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.UpdateExpenseDatasetRequest](../../models/operations/updateexpensedatasetrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + + +### Response + +**[operations.UpdateExpenseDatasetResponse](../../models/operations/updateexpensedatasetresponse.md)** + + ## upload_attachment Creates an attachment in the accounting software against the given transactionId @@ -325,8 +453,8 @@ s = codatsyncexpenses.CodatSyncExpenses( req = operations.UploadAttachmentRequest( request_body=operations.UploadAttachmentRequestBody( - content='placeat'.encode(), - request_body='voluptatum', + content='temporibus'.encode(), + request_body='ab', ), company_id='8a210b68-6988-11ed-a1eb-0242ac120002', sync_id='6fb40d5e-b13e-11ed-afa1-0242ac120002', diff --git a/expenses/docs/sdks/sync/README.md b/expenses/docs/sdks/sync/README.md index f89b6169d..867e3a87a 100755 --- a/expenses/docs/sdks/sync/README.md +++ b/expenses/docs/sdks/sync/README.md @@ -27,8 +27,8 @@ s = codatsyncexpenses.CodatSyncExpenses( req = operations.IntiateSyncRequest( post_sync=shared.PostSync( dataset_ids=[ - '96ed151a-05df-4c2d-9f7c-c78ca1ba928f', - 'c816742c-b739-4205-9293-96fea7596eb1', + '1a05dfc2-ddf7-4cc7-8ca1-ba928fc81674', + '2cb73920-5929-4396-bea7-596eb10faaa2', ], ), company_id='8a210b68-6988-11ed-a1eb-0242ac120002', diff --git a/expenses/files.gen b/expenses/files.gen index 6e1f7c94a..f93e05303 100755 --- a/expenses/files.gen +++ b/expenses/files.gen @@ -18,6 +18,7 @@ src/codatsyncexpenses/models/operations/get_company_configuration.py src/codatsyncexpenses/models/operations/save_company_configuration.py src/codatsyncexpenses/models/operations/create_partner_expense_connection.py src/codatsyncexpenses/models/operations/create_expense_dataset.py +src/codatsyncexpenses/models/operations/update_expense_dataset.py src/codatsyncexpenses/models/operations/upload_attachment.py src/codatsyncexpenses/models/operations/get_mapping_options.py src/codatsyncexpenses/models/operations/intiate_sync.py @@ -41,6 +42,7 @@ 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/updateexpenserequest.py src/codatsyncexpenses/models/shared/attachment.py src/codatsyncexpenses/models/shared/mappingoptions.py src/codatsyncexpenses/models/shared/trackingcategorymappinginfo.py @@ -75,6 +77,9 @@ docs/models/operations/createpartnerexpenseconnectionrequest.md docs/models/operations/createpartnerexpenseconnectionresponse.md docs/models/operations/createexpensedatasetrequest.md docs/models/operations/createexpensedatasetresponse.md +docs/models/operations/updateexpensedatasetrequest.md +docs/models/operations/updateexpensedataset202applicationjson.md +docs/models/operations/updateexpensedatasetresponse.md docs/models/operations/uploadattachmentrequestbody.md docs/models/operations/uploadattachmentrequest.md docs/models/operations/uploadattachmentresponse.md @@ -109,6 +114,7 @@ docs/models/shared/expensetransactiontype.md docs/models/shared/expensetransaction.md docs/models/shared/expensetransactionline.md docs/models/shared/recordref.md +docs/models/shared/updateexpenserequest.md docs/models/shared/attachment.md docs/models/shared/mappingoptions.md docs/models/shared/trackingcategorymappinginfo.md diff --git a/expenses/gen.yaml b/expenses/gen.yaml index ccd4a0e80..39435b599 100644 --- a/expenses/gen.yaml +++ b/expenses/gen.yaml @@ -1,15 +1,15 @@ configVersion: 1.0.0 management: - docChecksum: d1dc5e1387fcc67d7a6d87c4b41f3e1d + docChecksum: 10a2f2e33bc0830d491b01b2e4f509c9 docVersion: prealpha - speakeasyVersion: 1.48.0 - generationVersion: 2.41.1 + speakeasyVersion: 1.53.0 + generationVersion: 2.58.0 generation: sdkClassName: CodatSyncExpenses singleTagPerOp: false telemetryEnabled: true python: - version: 0.27.1 + version: 0.33.1 author: Speakeasy description: Python Client SDK Generated by Speakeasy maxMethodParams: 0 diff --git a/expenses/setup.py b/expenses/setup.py index 4c10cdff9..c4b9a7e25 100755 --- a/expenses/setup.py +++ b/expenses/setup.py @@ -10,7 +10,7 @@ setuptools.setup( name="codat-sync-for-expenses", - version="0.27.1", + version="0.33.1", author="Speakeasy", description="Python Client SDK Generated by Speakeasy", long_description=long_description, diff --git a/expenses/src/codatsyncexpenses/expenses.py b/expenses/src/codatsyncexpenses/expenses.py index b37915fd5..3feda772b 100755 --- a/expenses/src/codatsyncexpenses/expenses.py +++ b/expenses/src/codatsyncexpenses/expenses.py @@ -57,6 +57,50 @@ def do_request(): return res + def update_expense_dataset(self, request: operations.UpdateExpenseDatasetRequest, retries: Optional[utils.RetryConfig] = None) -> operations.UpdateExpenseDatasetResponse: + r"""Update expense-transactions + Update an expense transaction + """ + base_url = utils.template_url(*self.sdk_configuration.get_server_details()) + + url = utils.generate_url(operations.UpdateExpenseDatasetRequest, base_url, '/companies/{companyId}/sync/expenses/expense-transactions/{transactionId}', request) + headers = {} + 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['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 + + retry_config = retries + if retry_config is None: + retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 3600000), True) + + def do_request(): + return client.request('PUT', url, data=data, files=form, headers=headers) + + http_res = utils.retry(do_request, utils.Retries(retry_config, [ + '408', + '429', + '5XX' + ])) + content_type = http_res.headers.get('Content-Type') + + res = operations.UpdateExpenseDatasetResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + + if http_res.status_code == 202: + 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 + 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 + + return res + + def upload_attachment(self, request: operations.UploadAttachmentRequest, retries: Optional[utils.RetryConfig] = None) -> operations.UploadAttachmentResponse: r"""Upload attachment Creates an attachment in the accounting software against the given transactionId diff --git a/expenses/src/codatsyncexpenses/models/operations/__init__.py b/expenses/src/codatsyncexpenses/models/operations/__init__.py index da5bcfe85..88413d5b0 100755 --- a/expenses/src/codatsyncexpenses/models/operations/__init__.py +++ b/expenses/src/codatsyncexpenses/models/operations/__init__.py @@ -12,6 +12,7 @@ from .list_sync_transactions import * from .list_syncs import * from .save_company_configuration import * +from .update_expense_dataset import * from .upload_attachment import * -__all__ = ["CreateExpenseDatasetRequest","CreateExpenseDatasetResponse","CreatePartnerExpenseConnectionRequest","CreatePartnerExpenseConnectionResponse","GetCompanyConfigurationRequest","GetCompanyConfigurationResponse","GetLastSuccessfulSyncRequest","GetLastSuccessfulSyncResponse","GetLatestSyncRequest","GetLatestSyncResponse","GetMappingOptionsRequest","GetMappingOptionsResponse","GetSyncByIDRequest","GetSyncByIDResponse","GetSyncTransactionRequest","GetSyncTransactionResponse","IntiateSyncRequest","IntiateSyncResponse","ListSyncTransactionsRequest","ListSyncTransactionsResponse","ListSyncsRequest","ListSyncsResponse","SaveCompanyConfigurationRequest","SaveCompanyConfigurationResponse","UploadAttachmentRequest","UploadAttachmentRequestBody","UploadAttachmentResponse"] +__all__ = ["CreateExpenseDatasetRequest","CreateExpenseDatasetResponse","CreatePartnerExpenseConnectionRequest","CreatePartnerExpenseConnectionResponse","GetCompanyConfigurationRequest","GetCompanyConfigurationResponse","GetLastSuccessfulSyncRequest","GetLastSuccessfulSyncResponse","GetLatestSyncRequest","GetLatestSyncResponse","GetMappingOptionsRequest","GetMappingOptionsResponse","GetSyncByIDRequest","GetSyncByIDResponse","GetSyncTransactionRequest","GetSyncTransactionResponse","IntiateSyncRequest","IntiateSyncResponse","ListSyncTransactionsRequest","ListSyncTransactionsResponse","ListSyncsRequest","ListSyncsResponse","SaveCompanyConfigurationRequest","SaveCompanyConfigurationResponse","UpdateExpenseDataset202ApplicationJSON","UpdateExpenseDatasetRequest","UpdateExpenseDatasetResponse","UploadAttachmentRequest","UploadAttachmentRequestBody","UploadAttachmentResponse"] diff --git a/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py b/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py new file mode 100755 index 000000000..3896363bf --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/operations/update_expense_dataset.py @@ -0,0 +1,45 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +import requests as requests_http +from ..shared import schema as shared_schema +from ..shared import updateexpenserequest as shared_updateexpenserequest +from codatsyncexpenses import utils +from dataclasses_json import Undefined, dataclass_json +from typing import Optional + + + +@dataclasses.dataclass +class UpdateExpenseDatasetRequest: + company_id: str = dataclasses.field(metadata={'path_param': { 'field_name': 'companyId', 'style': 'simple', 'explode': False }}) + transaction_id: str = dataclasses.field(metadata={'path_param': { 'field_name': 'transactionId', 'style': 'simple', 'explode': False }}) + r"""The unique identifier for your SMB's transaction.""" + update_expense_request: Optional[shared_updateexpenserequest.UpdateExpenseRequest] = dataclasses.field(default=None, metadata={'request': { 'media_type': 'application/json' }}) + + + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +class UpdateExpenseDataset202ApplicationJSON: + r"""Accepted""" + sync_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncId'), 'exclude': lambda f: f is None }}) + + + + + +@dataclasses.dataclass +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) + r"""The request made is not valid.""" + update_expense_dataset_202_application_json_object: Optional[UpdateExpenseDataset202ApplicationJSON] = dataclasses.field(default=None) + r"""Accepted""" + + diff --git a/expenses/src/codatsyncexpenses/models/shared/__init__.py b/expenses/src/codatsyncexpenses/models/shared/__init__.py index 8a9489edf..63c1841a3 100755 --- a/expenses/src/codatsyncexpenses/models/shared/__init__.py +++ b/expenses/src/codatsyncexpenses/models/shared/__init__.py @@ -28,5 +28,6 @@ from .transactionmetadata import * from .transactionmetadatalist import * 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"] +__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"] diff --git a/expenses/src/codatsyncexpenses/models/shared/dataconnection.py b/expenses/src/codatsyncexpenses/models/shared/dataconnection.py index b2102abb4..ba33e496b 100755 --- a/expenses/src/codatsyncexpenses/models/shared/dataconnection.py +++ b/expenses/src/codatsyncexpenses/models/shared/dataconnection.py @@ -22,7 +22,17 @@ class DataConnectionSourceType(str, Enum): @dataclasses.dataclass class DataConnection: - r"""A connection represents the link between a `company` and a source of data.""" + 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: diff --git a/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py b/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py index 706daa25c..3d8e861a5 100755 --- a/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py +++ b/expenses/src/codatsyncexpenses/models/shared/expensetransaction.py @@ -56,6 +56,8 @@ class ExpenseTransaction: 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. diff --git a/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py b/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py new file mode 100755 index 000000000..415f9630e --- /dev/null +++ b/expenses/src/codatsyncexpenses/models/shared/updateexpenserequest.py @@ -0,0 +1,27 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from ..shared import expensetransactionline as shared_expensetransactionline +from codatsyncexpenses import utils +from dataclasses_json import Undefined, dataclass_json +from typing import Any, Optional + + +@dataclass_json(undefined=Undefined.EXCLUDE) + +@dataclasses.dataclass +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') }}) + 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.""" + 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 }}) + r"""Name of the merchant where the purchase took place""" + notes: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('notes'), 'exclude': lambda f: f is None }}) + r"""Any private, company notes about the transaction.""" + + diff --git a/expenses/src/codatsyncexpenses/sdkconfiguration.py b/expenses/src/codatsyncexpenses/sdkconfiguration.py index 974894fff..697af8fdd 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.27.1' - gen_version: str = '2.41.1' + sdk_version: str = '0.33.1' + gen_version: str = '2.58.0' def get_server_details(self) -> tuple[str, dict[str, str]]: if self.server_url: