Skip to content

Commit f69caf8

Browse files
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.501.1 (#637)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
1 parent 8dbb050 commit f69caf8

File tree

110 files changed

+3543
-3980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+3543
-3980
lines changed

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.500.0
1+
speakeasyVersion: 1.501.1
22
sources:
33
accounting-source:
44
sourceNamespace: accounting-source
@@ -60,11 +60,11 @@ sources:
6060
- 3.0.0
6161
platform-source:
6262
sourceNamespace: platform-source
63-
sourceRevisionDigest: sha256:ecd1f862f240b1eb7ee0586b1b0cdfe6f27f4c7f20a3f4145b7d1caf7cf42d3c
64-
sourceBlobDigest: sha256:ea673ea0d97789f88bfd38d9bdf61b7d7ff32fa279048bad39f2a596c189ab71
63+
sourceRevisionDigest: sha256:a697995f3e5983a5a433c52684c782549cb30aa89c0dd4cd73ac6f467bbce37f
64+
sourceBlobDigest: sha256:dc1ccf37d641b103d26cf64de70b1aabb2088e4db1830f69504229dc3bd0c292
6565
tags:
6666
- latest
67-
- speakeasy-sdk-regen-1735895812
67+
- speakeasy-sdk-regen-1740412291
6868
- 3.0.0
6969
sync-for-commerce-source:
7070
sourceNamespace: sync-for-commerce-source
@@ -145,10 +145,10 @@ targets:
145145
platform-library:
146146
source: platform-source
147147
sourceNamespace: platform-source
148-
sourceRevisionDigest: sha256:ecd1f862f240b1eb7ee0586b1b0cdfe6f27f4c7f20a3f4145b7d1caf7cf42d3c
149-
sourceBlobDigest: sha256:ea673ea0d97789f88bfd38d9bdf61b7d7ff32fa279048bad39f2a596c189ab71
148+
sourceRevisionDigest: sha256:a697995f3e5983a5a433c52684c782549cb30aa89c0dd4cd73ac6f467bbce37f
149+
sourceBlobDigest: sha256:dc1ccf37d641b103d26cf64de70b1aabb2088e4db1830f69504229dc3bd0c292
150150
codeSamplesNamespace: platform-source-python-code-samples
151-
codeSamplesRevisionDigest: sha256:b9bbe90d08ee3ae11af84f4debcafad021cc61cc622c0e02b04c6580cafba28f
151+
codeSamplesRevisionDigest: sha256:15ee379377d5e8e7a2ab704fee37c614d97cb1899affd7a28439c908322096de
152152
sync-for-commerce-library:
153153
source: sync-for-commerce-source
154154
sourceNamespace: sync-for-commerce-source

platform/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.speakeasy/reports
12
.venv/
23
pyrightconfig.json
34
README-PYPI.md

platform/.speakeasy/gen.lock

Lines changed: 282 additions & 311 deletions
Large diffs are not rendered by default.

platform/.speakeasy/gen.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ generation:
44
usageSnippets:
55
optionalPropertyRendering: withExample
66
fixes:
7-
nameResolutionDec2023: false
7+
nameResolutionFeb2025: false
88
parameterOrderingFeb2024: false
99
requestResponseComponentNamesFeb2024: false
10+
securityFeb2025: false
1011
auth:
1112
oAuth2ClientCredentialsEnabled: false
1213
oAuth2PasswordEnabled: false
1314
telemetryEnabled: true
1415
python:
15-
version: 4.1.0
16+
version: 4.2.0
1617
additionalDependencies:
1718
dev: {}
1819
main: {}
@@ -22,6 +23,7 @@ python:
2223
clientServerStatusCodesAsErrors: true
2324
defaultErrorName: SDKError
2425
description: Manage the building blocks of Codat, including companies, connections, and more.
26+
enableCustomCodeRegions: false
2527
enumFormat: enum
2628
fixFlags:
2729
responseRequiredSep2024: false
@@ -42,5 +44,6 @@ python:
4244
outputModelSuffix: output
4345
packageName: codat-platform
4446
projectUrls: {}
47+
pytestTimeout: 0
4548
responseFormat: flat
4649
templateVersion: v2

platform/README.md

Lines changed: 116 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ These end points cover creating and managing your companies, data connections, a
4949
* [Server Selection](#server-selection)
5050
* [Custom HTTP Client](#custom-http-client)
5151
* [Authentication](#authentication)
52+
* [Resource Management](#resource-management)
5253
* [Debugging](#debugging)
5354
* [Support](#support)
5455

@@ -57,6 +58,11 @@ These end points cover creating and managing your companies, data connections, a
5758
<!-- Start SDK Installation [installation] -->
5859
## SDK Installation
5960

61+
> [!NOTE]
62+
> **Python version upgrade policy**
63+
>
64+
> 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.
65+
6066
The SDK can be installed with either *pip* or *poetry* package managers.
6167

6268
### PIP
@@ -74,6 +80,37 @@ pip install codat-platform
7480
```bash
7581
poetry add codat-platform
7682
```
83+
84+
### Shell and script usage with `uv`
85+
86+
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:
87+
88+
```shell
89+
uvx --from codat-platform python
90+
```
91+
92+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
93+
94+
```python
95+
#!/usr/bin/env -S uv run --script
96+
# /// script
97+
# requires-python = ">=3.9"
98+
# dependencies = [
99+
# "codat-platform",
100+
# ]
101+
# ///
102+
103+
from codat_platform import CodatPlatform
104+
105+
sdk = CodatPlatform(
106+
# SDK arguments
107+
)
108+
109+
# Rest of script here...
110+
```
111+
112+
Once that is saved to a file, you can run it with `uv run script.py` where
113+
`script.py` can be replaced with the actual file name.
77114
<!-- End SDK Installation [installation] -->
78115

79116
## Example Usage
@@ -95,26 +132,19 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
95132
```python
96133
# Synchronous Example
97134
from codat_platform import CodatPlatform
98-
from codat_platform.models import shared
99135

100-
with CodatPlatform() as codat_platform:
101-
102-
codat_platform.company_data_connection_status_changed(request=shared.ConnectionStatusChangedWebhook(
103-
alert_id="a9367074-b5c3-42c4-9be4-be129f43577e",
104-
client_id="bae71d36-ff47-420a-b4a6-f8c9ddf41140",
105-
client_name="Bank of Dave",
106-
company_id="8a210b68-6988-11ed-a1eb-0242ac120002",
107-
data=shared.ConnectionStatusChangedWebhookData(
108-
data_connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171",
109-
new_status=shared.DataConnectionStatus.LINKED,
110-
old_status=shared.DataConnectionStatus.PENDING_AUTH,
111-
platform_key="gbol",
112-
),
113-
data_connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171",
114-
message="Data connection for SandBox status changed from PendingAuth to Linked",
115-
rule_id="70af3071-65d9-4ec3-b3cb-5283e8d55dac",
116-
rule_type="DataConnectionStatusChanged",
117-
))
136+
with CodatPlatform() as cp_client:
137+
138+
cp_client.client_rate_limit_reached(request={
139+
"event_type": "client.rateLimit.reached",
140+
"generated_date": "2024-09-01T00:00:00Z",
141+
"id": "743ec94a-8aa4-44bb-8bd4-e1855ee0e74b",
142+
"payload": {
143+
"daily_quota": 12000,
144+
"expiry_date": "2024-09-01T12:14:14Z",
145+
"quota_remaining": 0,
146+
},
147+
})
118148

119149
# Use the SDK ...
120150
```
@@ -126,27 +156,20 @@ The same SDK client can also be used to make asychronous requests by importing a
126156
# Asynchronous Example
127157
import asyncio
128158
from codat_platform import CodatPlatform
129-
from codat_platform.models import shared
130159

131160
async def main():
132-
async with CodatPlatform() as codat_platform:
133-
134-
await codat_platform.company_data_connection_status_changed_async(request=shared.ConnectionStatusChangedWebhook(
135-
alert_id="a9367074-b5c3-42c4-9be4-be129f43577e",
136-
client_id="bae71d36-ff47-420a-b4a6-f8c9ddf41140",
137-
client_name="Bank of Dave",
138-
company_id="8a210b68-6988-11ed-a1eb-0242ac120002",
139-
data=shared.ConnectionStatusChangedWebhookData(
140-
data_connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171",
141-
new_status=shared.DataConnectionStatus.LINKED,
142-
old_status=shared.DataConnectionStatus.PENDING_AUTH,
143-
platform_key="gbol",
144-
),
145-
data_connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171",
146-
message="Data connection for SandBox status changed from PendingAuth to Linked",
147-
rule_id="70af3071-65d9-4ec3-b3cb-5283e8d55dac",
148-
rule_type="DataConnectionStatusChanged",
149-
))
161+
async with CodatPlatform() as cp_client:
162+
163+
await cp_client.client_rate_limit_reached_async(request={
164+
"event_type": "client.rateLimit.reached",
165+
"generated_date": "2024-09-01T00:00:00Z",
166+
"id": "743ec94a-8aa4-44bb-8bd4-e1855ee0e74b",
167+
"payload": {
168+
"daily_quota": 12000,
169+
"expiry_date": "2024-09-01T12:14:14Z",
170+
"quota_remaining": 0,
171+
},
172+
})
150173

151174
# Use the SDK ...
152175

@@ -170,6 +193,7 @@ asyncio.run(main())
170193
* [get_access_token](docs/sdks/companies/README.md#get_access_token) - Get company access token
171194
* [list](docs/sdks/companies/README.md#list) - List companies
172195
* [remove_product](docs/sdks/companies/README.md#remove_product) - Remove product
196+
* [replace](docs/sdks/companies/README.md#replace) - Replace company
173197
* [update](docs/sdks/companies/README.md#update) - Update company
174198

175199
### [~~connection_management~~](docs/sdks/connectionmanagement/README.md)
@@ -185,10 +209,10 @@ asyncio.run(main())
185209
* [unlink](docs/sdks/connections/README.md#unlink) - Unlink connection
186210
* [update_authorization](docs/sdks/connections/README.md#update_authorization) - Update authorization
187211

188-
### [cors](docs/sdks/cors/README.md)
212+
### [~~cors~~](docs/sdks/cors/README.md)
189213

190-
* [get](docs/sdks/cors/README.md#get) - Get CORS settings
191-
* [set](docs/sdks/cors/README.md#set) - Set CORS settings
214+
* [~~get~~](docs/sdks/cors/README.md#get) - Get CORS settings (old) :warning: **Deprecated** Use [get](docs/sdks/settings/README.md#get) instead.
215+
* [~~set~~](docs/sdks/cors/README.md#set) - Set CORS settings (old) :warning: **Deprecated** Use [set](docs/sdks/settings/README.md#set) instead.
192216

193217
### [custom_data_type](docs/sdks/customdatatype/README.md)
194218

@@ -221,9 +245,11 @@ asyncio.run(main())
221245

222246
* [create_api_key](docs/sdks/settings/README.md#create_api_key) - Create API key
223247
* [delete_api_key](docs/sdks/settings/README.md#delete_api_key) - Delete API key
248+
* [get](docs/sdks/settings/README.md#get) - Get CORS settings
224249
* [get_profile](docs/sdks/settings/README.md#get_profile) - Get profile
225250
* [get_sync_settings](docs/sdks/settings/README.md#get_sync_settings) - Get sync settings
226251
* [list_api_keys](docs/sdks/settings/README.md#list_api_keys) - List API keys
252+
* [set](docs/sdks/settings/README.md#set) - Set CORS settings
227253
* [update_profile](docs/sdks/settings/README.md#update_profile) - Update profile
228254
* [update_sync_settings](docs/sdks/settings/README.md#update_sync_settings) - Update all sync settings
229255

@@ -234,11 +260,8 @@ asyncio.run(main())
234260

235261
### [webhooks](docs/sdks/webhooks/README.md)
236262

237-
* [~~create~~](docs/sdks/webhooks/README.md#create) - Create webhook (legacy) :warning: **Deprecated**
238263
* [create_consumer](docs/sdks/webhooks/README.md#create_consumer) - Create webhook consumer
239264
* [delete_consumer](docs/sdks/webhooks/README.md#delete_consumer) - Delete webhook consumer
240-
* [~~get~~](docs/sdks/webhooks/README.md#get) - Get webhook (legacy) :warning: **Deprecated**
241-
* [~~list~~](docs/sdks/webhooks/README.md#list) - List webhooks (legacy) :warning: **Deprecated**
242265
* [list_consumers](docs/sdks/webhooks/README.md#list_consumers) - List webhook consumers
243266

244267
</details>
@@ -261,9 +284,9 @@ with CodatPlatform(
261284
security=shared.Security(
262285
auth_header="Basic BASE_64_ENCODED(API_KEY)",
263286
),
264-
) as codat_platform:
287+
) as cp_client:
265288

266-
res = codat_platform.settings.create_api_key(request={
289+
res = cp_client.settings.create_api_key(request={
267290
"name": "azure-invoice-finance-processor",
268291
},
269292
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
@@ -286,9 +309,9 @@ with CodatPlatform(
286309
security=shared.Security(
287310
auth_header="Basic BASE_64_ENCODED(API_KEY)",
288311
),
289-
) as codat_platform:
312+
) as cp_client:
290313

291-
res = codat_platform.settings.create_api_key(request={
314+
res = cp_client.settings.create_api_key(request={
292315
"name": "azure-invoice-finance-processor",
293316
})
294317

@@ -316,10 +339,11 @@ By default, an API error will raise a errors.SDKError exception, which has the f
316339

317340
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 `create_api_key_async` method may raise the following exceptions:
318341

319-
| Error Type | Status Code | Content Type |
320-
| ------------------- | -------------------------------------- | ---------------- |
321-
| errors.ErrorMessage | 400, 401, 402, 403, 409, 429, 500, 503 | application/json |
322-
| errors.SDKError | 4XX, 5XX | \*/\* |
342+
| Error Type | Status Code | Content Type |
343+
| ------------------- | ---------------------------- | ---------------- |
344+
| errors.ErrorMessage | 400, 401, 402, 403, 409, 429 | application/json |
345+
| errors.ErrorMessage | 500, 503 | application/json |
346+
| errors.SDKError | 4XX, 5XX | \*/\* |
323347

324348
### Example
325349

@@ -331,11 +355,11 @@ with CodatPlatform(
331355
security=shared.Security(
332356
auth_header="Basic BASE_64_ENCODED(API_KEY)",
333357
),
334-
) as codat_platform:
358+
) as cp_client:
335359
res = None
336360
try:
337361

338-
res = codat_platform.settings.create_api_key(request={
362+
res = cp_client.settings.create_api_key(request={
339363
"name": "azure-invoice-finance-processor",
340364
})
341365

@@ -344,6 +368,9 @@ with CodatPlatform(
344368
# Handle response
345369
print(res)
346370

371+
except errors.ErrorMessage as e:
372+
# handle e.data: errors.ErrorMessageData
373+
raise(e)
347374
except errors.ErrorMessage as e:
348375
# handle e.data: errors.ErrorMessageData
349376
raise(e)
@@ -358,7 +385,7 @@ with CodatPlatform(
358385

359386
### Override Server URL Per-Client
360387

361-
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:
388+
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:
362389
```python
363390
from codat_platform import CodatPlatform
364391
from codat_platform.models import shared
@@ -368,9 +395,9 @@ with CodatPlatform(
368395
security=shared.Security(
369396
auth_header="Basic BASE_64_ENCODED(API_KEY)",
370397
),
371-
) as codat_platform:
398+
) as cp_client:
372399

373-
res = codat_platform.settings.create_api_key(request={
400+
res = cp_client.settings.create_api_key(request={
374401
"name": "azure-invoice-finance-processor",
375402
})
376403

@@ -483,9 +510,9 @@ with CodatPlatform(
483510
security=shared.Security(
484511
auth_header="Basic BASE_64_ENCODED(API_KEY)",
485512
),
486-
) as codat_platform:
513+
) as cp_client:
487514

488-
res = codat_platform.settings.create_api_key(request={
515+
res = cp_client.settings.create_api_key(request={
489516
"name": "azure-invoice-finance-processor",
490517
})
491518

@@ -497,6 +524,36 @@ with CodatPlatform(
497524
```
498525
<!-- End Authentication [security] -->
499526

527+
<!-- Start Resource Management [resource-management] -->
528+
## Resource Management
529+
530+
The `CodatPlatform` 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.
531+
532+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
533+
534+
```python
535+
from codat_platform import CodatPlatform
536+
from codat_platform.models import shared
537+
def main():
538+
with CodatPlatform(
539+
security=shared.Security(
540+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
541+
),
542+
) as cp_client:
543+
# Rest of application here...
544+
545+
546+
# Or when using async:
547+
async def amain():
548+
async with CodatPlatform(
549+
security=shared.Security(
550+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
551+
),
552+
) as cp_client:
553+
# Rest of application here...
554+
```
555+
<!-- End Resource Management [resource-management] -->
556+
500557
<!-- Start Debugging [debug] -->
501558
## Debugging
502559

0 commit comments

Comments
 (0)