Skip to content

Commit b2c69ca

Browse files
authored
Merge pull request #550 from codatio/speakeasy-sdk-regen-1702644926
chore: 🐝 Update SDK - Generate Files library
2 parents 35a2f90 + c4356d7 commit b2c69ca

Some content is hidden

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

49 files changed

+653
-253
lines changed

previous-versions/files/.gitattributes

100755100644
File mode changed.

previous-versions/files/README.md

Lines changed: 214 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@
55
<!-- End Codat Library Description -->
66
Use Codat's Files API to upload your SMB customers' files.
77

8-
<!-- Start SDK Installation -->
8+
<!-- Start SDK Installation [installation] -->
99
## SDK Installation
1010

1111
```bash
1212
pip install codat-files
1313
```
14-
<!-- End SDK Installation -->
14+
<!-- End SDK Installation [installation] -->
1515

1616
## Example Usage
17-
<!-- Start SDK Example Usage -->
17+
<!-- Start SDK Example Usage [usage] -->
18+
## SDK Example Usage
19+
20+
### Example
21+
1822
```python
1923
import codatfiles
20-
from codatfiles.models import operations, shared
24+
from codatfiles.models import operations
2125

2226
s = codatfiles.CodatFiles(
2327
auth_header="Basic BASE_64_ENCODED(API_KEY)",
2428
)
2529

2630
req = operations.DownloadFilesRequest(
2731
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
28-
date_='2022-10-23T00:00:00.000Z',
32+
date_='2022-10-23T00:00:00Z',
2933
)
3034

3135
res = s.files.download_files(req)
@@ -34,26 +38,225 @@ if res.data is not None:
3438
# handle response
3539
pass
3640
```
37-
<!-- End SDK Example Usage -->
41+
<!-- End SDK Example Usage [usage] -->
3842

39-
<!-- Start SDK Available Operations -->
43+
<!-- Start Available Resources and Operations [operations] -->
4044
## Available Resources and Operations
4145

42-
4346
### [files](docs/sdks/files/README.md)
4447

4548
* [download_files](docs/sdks/files/README.md#download_files) - Download all files for a company
4649
* [list_files](docs/sdks/files/README.md#list_files) - List all files uploaded by a company
4750
* [upload_files](docs/sdks/files/README.md#upload_files) - Upload files for a company
48-
<!-- End SDK Available Operations -->
51+
<!-- End Available Resources and Operations [operations] -->
4952

5053

5154

52-
<!-- Start Dev Containers -->
55+
<!-- Start Retries [retries] -->
56+
## Retries
5357

58+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
5459

60+
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
61+
```python
62+
import codatfiles
63+
from codatfiles.models import operations
64+
from codatfiles.utils import BackoffStrategy, RetryConfig
65+
66+
s = codatfiles.CodatFiles(
67+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
68+
)
5569

56-
<!-- End Dev Containers -->
70+
req = operations.DownloadFilesRequest(
71+
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
72+
date_='2022-10-23T00:00:00Z',
73+
)
74+
75+
res = s.files.download_files(req,
76+
RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False))
77+
78+
if res.data is not None:
79+
# handle response
80+
pass
81+
```
82+
83+
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
84+
```python
85+
import codatfiles
86+
from codatfiles.models import operations
87+
from codatfiles.utils import BackoffStrategy, RetryConfig
88+
89+
s = codatfiles.CodatFiles(
90+
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)
91+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
92+
)
93+
94+
req = operations.DownloadFilesRequest(
95+
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
96+
date_='2022-10-23T00:00:00Z',
97+
)
98+
99+
res = s.files.download_files(req)
100+
101+
if res.data is not None:
102+
# handle response
103+
pass
104+
```
105+
<!-- End Retries [retries] -->
106+
107+
<!-- Start Error Handling [errors] -->
108+
## Error Handling
109+
110+
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
111+
112+
| Error Object | Status Code | Content Type |
113+
| -------------------------------- | -------------------------------- | -------------------------------- |
114+
| errors.Schema | 400,401,402,404,429,500,503 | application/json |
115+
| errors.DownloadFilesErrorMessage | 403 | application/json |
116+
| errors.SDKError | 400-600 | */* |
117+
118+
### Example
119+
120+
```python
121+
import codatfiles
122+
from codatfiles.models import operations
123+
124+
s = codatfiles.CodatFiles(
125+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
126+
)
127+
128+
req = operations.DownloadFilesRequest(
129+
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
130+
date_='2022-10-23T00:00:00Z',
131+
)
132+
133+
res = None
134+
try:
135+
res = s.files.download_files(req)
136+
except errors.Schema as e:
137+
print(e) # handle exception
138+
raise(e)
139+
except errors.DownloadFilesErrorMessage as e:
140+
print(e) # handle exception
141+
raise(e)
142+
except errors.SDKError as e:
143+
print(e) # handle exception
144+
raise(e)
145+
146+
if res.data is not None:
147+
# handle response
148+
pass
149+
```
150+
<!-- End Error Handling [errors] -->
151+
152+
<!-- Start Server Selection [server] -->
153+
## Server Selection
154+
155+
### Select Server by Index
156+
157+
You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
158+
159+
| # | Server | Variables |
160+
| - | ------ | --------- |
161+
| 0 | `https://api.codat.io` | None |
162+
163+
#### Example
164+
165+
```python
166+
import codatfiles
167+
from codatfiles.models import operations
168+
169+
s = codatfiles.CodatFiles(
170+
server_idx=0,
171+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
172+
)
173+
174+
req = operations.DownloadFilesRequest(
175+
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
176+
date_='2022-10-23T00:00:00Z',
177+
)
178+
179+
res = s.files.download_files(req)
180+
181+
if res.data is not None:
182+
# handle response
183+
pass
184+
```
185+
186+
187+
### Override Server URL Per-Client
188+
189+
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:
190+
```python
191+
import codatfiles
192+
from codatfiles.models import operations
193+
194+
s = codatfiles.CodatFiles(
195+
server_url="https://api.codat.io",
196+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
197+
)
198+
199+
req = operations.DownloadFilesRequest(
200+
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
201+
date_='2022-10-23T00:00:00Z',
202+
)
203+
204+
res = s.files.download_files(req)
205+
206+
if res.data is not None:
207+
# handle response
208+
pass
209+
```
210+
<!-- End Server Selection [server] -->
211+
212+
<!-- Start Custom HTTP Client [http-client] -->
213+
## Custom HTTP Client
214+
215+
The Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `requests.Session` object.
216+
217+
For example, you could specify a header for every request that this sdk makes as follows:
218+
```python
219+
import codatfiles
220+
import requests
221+
222+
http_client = requests.Session()
223+
http_client.headers.update({'x-custom-header': 'someValue'})
224+
s = codatfiles.CodatFiles(client: http_client)
225+
```
226+
<!-- End Custom HTTP Client [http-client] -->
227+
228+
<!-- Start Authentication [security] -->
229+
## Authentication
230+
231+
### Per-Client Security Schemes
232+
233+
This SDK supports the following security scheme globally:
234+
235+
| Name | Type | Scheme |
236+
| ------------- | ------------- | ------------- |
237+
| `auth_header` | apiKey | API key |
238+
239+
To authenticate with the API the `auth_header` parameter must be set when initializing the SDK client instance. For example:
240+
```python
241+
import codatfiles
242+
from codatfiles.models import operations
243+
244+
s = codatfiles.CodatFiles(
245+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
246+
)
247+
248+
req = operations.DownloadFilesRequest(
249+
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
250+
date_='2022-10-23T00:00:00Z',
251+
)
252+
253+
res = s.files.download_files(req)
254+
255+
if res.data is not None:
256+
# handle response
257+
pass
258+
```
259+
<!-- End Authentication [security] -->
57260

58261
<!-- Placeholder for Future Speakeasy SDK Sections -->
59262

previous-versions/files/RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,14 @@ Based on:
88
### Generated
99
- [python v0.1.0] previous-versions/files
1010
### Releases
11-
- [PyPI v0.1.0] https://pypi.org/project/codat-files/0.1.0 - previous-versions/files
11+
- [PyPI v0.1.0] https://pypi.org/project/codat-files/0.1.0 - previous-versions/files
12+
13+
## 2023-12-15 12:55:21
14+
### Changes
15+
Based on:
16+
- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
17+
- Speakeasy CLI 1.126.3 (2.214.3) https://github.com/speakeasy-api/speakeasy
18+
### Generated
19+
- [python v0.2.0] previous-versions/files
20+
### Releases
21+
- [PyPI v0.2.0] https://pypi.org/project/codat-files/0.2.0 - previous-versions/files

previous-versions/files/USAGE.md

100755100644
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
<!-- Start SDK Example Usage -->
2-
3-
1+
<!-- Start SDK Example Usage [usage] -->
42
```python
53
import codatfiles
6-
from codatfiles.models import operations, shared
4+
from codatfiles.models import operations
75

86
s = codatfiles.CodatFiles(
97
auth_header="Basic BASE_64_ENCODED(API_KEY)",
108
)
119

1210
req = operations.DownloadFilesRequest(
1311
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
14-
date_='2022-10-23T00:00:00.000Z',
12+
date_='2022-10-23T00:00:00Z',
1513
)
1614

1715
res = s.files.download_files(req)
@@ -20,4 +18,4 @@ if res.data is not None:
2018
# handle response
2119
pass
2220
```
23-
<!-- End SDK Example Usage -->
21+
<!-- End SDK Example Usage [usage] -->

previous-versions/files/docs/models/operations/downloadfileserrormessage.md renamed to previous-versions/files/docs/models/errors/downloadfileserrormessage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# DownloadFilesErrorMessage
22

3-
One or more of the resources you referenced could not be found.
4-
This might be because your company or data connection id is wrong, or was already deleted.
3+
You are using an outdated API key or a key not associated with that resource.
54

65

76
## Fields
87

98
| Field | Type | Required | Description |
109
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
10+
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
1111
| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. |
1212
| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. |
1313
| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. |

previous-versions/files/docs/models/operations/listfileserrormessage.md renamed to previous-versions/files/docs/models/errors/listfileserrormessage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# ListFilesErrorMessage
22

3-
One or more of the resources you referenced could not be found.
4-
This might be because your company or data connection id is wrong, or was already deleted.
3+
You are using an outdated API key or a key not associated with that resource.
54

65

76
## Fields
87

98
| Field | Type | Required | Description |
109
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
10+
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
1111
| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. |
1212
| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. |
1313
| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. |

previous-versions/files/docs/models/shared/schema.md renamed to previous-versions/files/docs/models/errors/schema.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Schema
22

3+
Your API request was not properly authorized.
4+
35

46
## Fields
57

previous-versions/files/docs/models/operations/uploadfileserrormessage.md renamed to previous-versions/files/docs/models/errors/uploadfileserrormessage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# UploadFilesErrorMessage
22

3-
One or more of the resources you referenced could not be found.
4-
This might be because your company or data connection id is wrong, or was already deleted.
3+
You are using an outdated API key or a key not associated with that resource.
54

65

76
## Fields
87

98
| Field | Type | Required | Description |
109
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
10+
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
1111
| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. |
1212
| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. |
1313
| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. |

previous-versions/files/docs/models/operations/downloadfilesrequest.md

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
| Field | Type | Required | Description | Example |
77
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
88
| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
9-
| `date_` | *Optional[str]* | :heavy_minus_sign: | Only download files uploaded on this date. | 2022-10-23T00:00:00.000Z |
9+
| `date_` | *Optional[str]* | :heavy_minus_sign: | Only download files uploaded on this date. | 2022-10-23 00:00:00 +0000 UTC |

0 commit comments

Comments
 (0)