Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.477.0
speakeasyVersion: 1.500.0
sources:
accounting-source:
sourceNamespace: accounting-source
Expand Down Expand Up @@ -68,11 +68,11 @@ sources:
- 3.0.0
sync-for-commerce-source:
sourceNamespace: sync-for-commerce-source
sourceRevisionDigest: sha256:df4334894c5b162a67c75770369c6fd6c0cf7b4ce5374c2f9654c2fc6da9fcb5
sourceBlobDigest: sha256:1d1592cd53dae647bff1e58e43cb64f19f9da714cfc6f6198c43659b89b05369
sourceRevisionDigest: sha256:119a243cc27781b143b0d8ea42a041cfc1bbf16bf6c45001a12d700a6e1cb40f
sourceBlobDigest: sha256:61c9eb51c53318764e70fbc30d9960e3f776aa6f9de0b1612e41694baf3fbb7f
tags:
- latest
- speakeasy-sdk-regen-1733826200
- speakeasy-sdk-regen-1740153196
- "1.1"
sync-for-expenses-source:
sourceNamespace: sync-for-expenses-source
Expand Down Expand Up @@ -152,10 +152,10 @@ targets:
sync-for-commerce-library:
source: sync-for-commerce-source
sourceNamespace: sync-for-commerce-source
sourceRevisionDigest: sha256:df4334894c5b162a67c75770369c6fd6c0cf7b4ce5374c2f9654c2fc6da9fcb5
sourceBlobDigest: sha256:1d1592cd53dae647bff1e58e43cb64f19f9da714cfc6f6198c43659b89b05369
sourceRevisionDigest: sha256:119a243cc27781b143b0d8ea42a041cfc1bbf16bf6c45001a12d700a6e1cb40f
sourceBlobDigest: sha256:61c9eb51c53318764e70fbc30d9960e3f776aa6f9de0b1612e41694baf3fbb7f
codeSamplesNamespace: sync-for-commerce-source-python-code-samples
codeSamplesRevisionDigest: sha256:f936f9db889b789f7d3b90695f9b203b63e08f2f32dc96d753e5bd322d6af49a
codeSamplesRevisionDigest: sha256:8cc7bb729390dbebc17e46381ce1c574cb34eae2d3d02a4fc1a6c6c0a7f312bc
sync-for-expenses-library:
source: sync-for-expenses-source
sourceNamespace: sync-for-expenses-source
Expand Down
1 change: 1 addition & 0 deletions sync-for-commerce/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.speakeasy/reports
.venv/
pyrightconfig.json
README-PYPI.md
Expand Down
113 changes: 78 additions & 35 deletions sync-for-commerce/.speakeasy/gen.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions sync-for-commerce/.speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ generation:
usageSnippets:
optionalPropertyRendering: withExample
fixes:
nameResolutionDec2023: false
nameResolutionFeb2025: false
parameterOrderingFeb2024: false
requestResponseComponentNamesFeb2024: false
securityFeb2025: false
auth:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
telemetryEnabled: true
python:
version: 6.0.1
version: 6.1.0
additionalDependencies:
dev: {}
main: {}
Expand All @@ -22,6 +23,7 @@ python:
clientServerStatusCodesAsErrors: true
defaultErrorName: SDKError
description: Push merchants' data from your ecommerce or point-of-sale (POS) platform into your merchants' accounting software.
enableCustomCodeRegions: false
enumFormat: enum
fixFlags:
responseRequiredSep2024: false
Expand All @@ -41,5 +43,6 @@ python:
methodArguments: infer-optional-args
outputModelSuffix: output
packageName: codat-sync-for-commerce
pytestTimeout: 0
responseFormat: flat
templateVersion: v2
145 changes: 124 additions & 21 deletions sync-for-commerce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Sync for Commerce: The API for Sync for Commerce.

Sync for Commerce automatically replicates and reconciles sales data from a merchant’s source PoS, Payments, and eCommerce systems into their accounting software. This eliminates manual processing by merchants and transforms their ability to run and grow their business.

[Explore product](https://docs.codat.io/commerce/overview) | [See our OpenAPI spec](https://github.com/codatio/oas)
[Explore solution](https://docs.codat.io/commerce/overview) | [See our OpenAPI spec](https://github.com/codatio/oas)

Not seeing the endpoints you're expecting? We've [reorganized our products](https://docs.codat.io/updates/230901-new-products), and you may be using a [different version of Sync for Commerce](https://docs.codat.io/sync-for-commerce-v1-api#/).

Expand Down Expand Up @@ -45,6 +45,7 @@ Not seeing the endpoints you're expecting? We've [reorganized our products](http
* [Server Selection](#server-selection)
* [Custom HTTP Client](#custom-http-client)
* [Authentication](#authentication)
* [Resource Management](#resource-management)
* [Debugging](#debugging)
* [Support](#support)

Expand All @@ -53,6 +54,11 @@ Not seeing the endpoints you're expecting? We've [reorganized our products](http
<!-- Start SDK Installation [installation] -->
## SDK Installation

> [!NOTE]
> **Python version upgrade policy**
>
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.

The SDK can be installed with either *pip* or *poetry* package managers.

### PIP
Expand All @@ -70,6 +76,37 @@ pip install codat-sync-for-commerce
```bash
poetry add codat-sync-for-commerce
```

### Shell and script usage with `uv`

You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:

```shell
uvx --from codat-sync-for-commerce python
```

It's also possible to write a standalone Python script without needing to set up a whole project like so:

```python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "codat-sync-for-commerce",
# ]
# ///

from codat_sync_for_commerce import CodatSyncCommerce

sdk = CodatSyncCommerce(
# SDK arguments
)

# Rest of script here...
```

Once that is saved to a file, you can run it with `uv run script.py` where
`script.py` can be replaced with the actual file name.
<!-- End SDK Installation [installation] -->

## Example Usage
Expand All @@ -94,6 +131,7 @@ from codat_sync_for_commerce import CodatSyncCommerce
from codat_sync_for_commerce.models import shared

with CodatSyncCommerce() as codat_sync_commerce:

codat_sync_commerce.connection_deleted(request={
"event_type": "connection.created",
"generated_date": "2022-10-23T00:00:00Z",
Expand All @@ -109,6 +147,16 @@ with CodatSyncCommerce() as codat_sync_commerce:
"source_id": "35b92968-9851-4095-ad60-395c95cbcba4",
"source_type": shared.SourceType.ACCOUNTING,
"status": shared.DataConnectionStatus.LINKED,
"data_connection_errors": [
{
"errored_on_utc": "2022-10-23T00:00:00Z",
"resolved_on_utc": "2022-10-23T00:00:00Z",
},
{
"errored_on_utc": "2022-10-23T00:00:00Z",
"resolved_on_utc": "2022-10-23T00:00:00Z",
},
],
"last_sync": "2022-10-23T00:00:00Z",
},
"reference_company": {
Expand All @@ -133,6 +181,7 @@ from codat_sync_for_commerce.models import shared

async def main():
async with CodatSyncCommerce() as codat_sync_commerce:

await codat_sync_commerce.connection_deleted_async(request={
"event_type": "connection.created",
"generated_date": "2022-10-23T00:00:00Z",
Expand All @@ -148,6 +197,16 @@ async def main():
"source_id": "35b92968-9851-4095-ad60-395c95cbcba4",
"source_type": shared.SourceType.ACCOUNTING,
"status": shared.DataConnectionStatus.LINKED,
"data_connection_errors": [
{
"errored_on_utc": "2022-10-23T00:00:00Z",
"resolved_on_utc": "2022-10-23T00:00:00Z",
},
{
"errored_on_utc": "2022-10-23T00:00:00Z",
"resolved_on_utc": "2022-10-23T00:00:00Z",
},
],
"last_sync": "2022-10-23T00:00:00Z",
},
"reference_company": {
Expand Down Expand Up @@ -229,14 +288,16 @@ with CodatSyncCommerce(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_sync_commerce:

res = codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow(request={
"locale": shared.Locale.EN_US,
},
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))

if res is not None:
# handle response
pass
assert res is not None

# Handle response
print(res)

```

Expand All @@ -252,13 +313,15 @@ with CodatSyncCommerce(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_sync_commerce:

res = codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow(request={
"locale": shared.Locale.EN_US,
})

if res is not None:
# handle response
pass
assert res is not None

# Handle response
print(res)

```
<!-- End Retries [retries] -->
Expand All @@ -279,10 +342,11 @@ By default, an API error will raise a errors.SDKError exception, which has the f

When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `get_config_text_sync_flow_async` method may raise the following exceptions:

| Error Type | Status Code | Content Type |
| ------------------- | ---------------------------- | ---------------- |
| errors.ErrorMessage | 401, 402, 403, 429, 500, 503 | application/json |
| errors.SDKError | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ------------------- | ------------------ | ---------------- |
| errors.ErrorMessage | 401, 402, 403, 429 | application/json |
| errors.ErrorMessage | 500, 503 | application/json |
| errors.SDKError | 4XX, 5XX | \*/\* |

### Example

Expand All @@ -297,14 +361,19 @@ with CodatSyncCommerce(
) as codat_sync_commerce:
res = None
try:

res = codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow(request={
"locale": shared.Locale.EN_US,
})

if res is not None:
# handle response
pass
assert res is not None

# Handle response
print(res)

except errors.ErrorMessage as e:
# handle e.data: errors.ErrorMessageData
raise(e)
except errors.ErrorMessage as e:
# handle e.data: errors.ErrorMessageData
raise(e)
Expand All @@ -319,7 +388,7 @@ with CodatSyncCommerce(

### Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
```python
from codat_sync_for_commerce import CodatSyncCommerce
from codat_sync_for_commerce.models import shared
Expand All @@ -330,13 +399,15 @@ with CodatSyncCommerce(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_sync_commerce:

res = codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow(request={
"locale": shared.Locale.EN_US,
})

if res is not None:
# handle response
pass
assert res is not None

# Handle response
print(res)

```
<!-- End Server Selection [server] -->
Expand Down Expand Up @@ -443,17 +514,49 @@ with CodatSyncCommerce(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_sync_commerce:

res = codat_sync_commerce.sync_flow_settings.get_config_text_sync_flow(request={
"locale": shared.Locale.EN_US,
})

if res is not None:
# handle response
pass
assert res is not None

# Handle response
print(res)

```
<!-- End Authentication [security] -->

<!-- Start Resource Management [resource-management] -->
## Resource Management

The `CodatSyncCommerce` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.

[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers

```python
from codat_sync_for_commerce import CodatSyncCommerce
from codat_sync_for_commerce.models import shared
def main():
with CodatSyncCommerce(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_sync_commerce:
# Rest of application here...


# Or when using async:
async def amain():
async with CodatSyncCommerce(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_sync_commerce:
# Rest of application here...
```
<!-- End Resource Management [resource-management] -->

<!-- Start Debugging [debug] -->
## Debugging

Expand Down
12 changes: 11 additions & 1 deletion sync-for-commerce/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,4 +598,14 @@ Based on:
### Generated
- [python v6.0.1] sync-for-commerce
### Releases
- [PyPI v6.0.1] https://pypi.org/project/codat-sync-for-commerce/6.0.1 - sync-for-commerce
- [PyPI v6.0.1] https://pypi.org/project/codat-sync-for-commerce/6.0.1 - sync-for-commerce

## 2025-02-21 15:52:55
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.500.0 (2.521.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v6.1.0] sync-for-commerce
### Releases
- [PyPI v6.1.0] https://pypi.org/project/codat-sync-for-commerce/6.1.0 - sync-for-commerce
Loading