Skip to content

Commit 1d18380

Browse files
authored
Merge pull request #547 from codatio/speakeasy-sdk-regen-1702562928
chore: 🐝 Update SDK - Generate Sync for Expenses library
2 parents 91352b6 + 8aaafaa commit 1d18380

File tree

374 files changed

+2657
-1592
lines changed

Some content is hidden

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

374 files changed

+2657
-1592
lines changed

sync-for-expenses/.gitattributes

100755100644
File mode changed.

sync-for-expenses/README.md

Lines changed: 243 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,46 @@
44
Embedded accounting integrations for corporate card providers.
55
<!-- End Codat Library Description -->
66

7-
<!-- Start SDK Installation -->
7+
<!-- Start SDK Installation [installation] -->
88
## SDK Installation
99

1010
```bash
1111
pip install codat-sync-for-expenses
1212
```
13-
<!-- End SDK Installation -->
13+
<!-- End SDK Installation [installation] -->
1414

1515
## Example Usage
16-
<!-- Start SDK Example Usage -->
16+
<!-- Start SDK Example Usage [usage] -->
17+
## SDK Example Usage
18+
19+
### Example
20+
1721
```python
1822
import codatsyncexpenses
19-
from codatsyncexpenses.models import operations, shared
20-
from decimal import Decimal
23+
from codatsyncexpenses.models import shared
2124

2225
s = codatsyncexpenses.CodatSyncExpenses(
2326
security=shared.Security(
2427
auth_header="Basic BASE_64_ENCODED(API_KEY)",
2528
),
2629
)
2730

28-
req = operations.CreateAccountRequest(
29-
account=shared.Account(
30-
currency='USD',
31-
current_balance=Decimal('0'),
32-
description='Invoices the business has issued but has not yet collected payment on.',
33-
fully_qualified_category='Asset.Current',
34-
fully_qualified_name='Cash On Hand',
35-
id='1b6266d1-1e44-46c5-8eb5-a8f98e03124e',
36-
metadata=shared.AccountMetadata(),
37-
modified_date='2022-10-23T00:00:00.000Z',
38-
name='Accounts Receivable',
39-
nominal_code='610',
40-
source_modified_date='2022-10-23T00:00:00.000Z',
41-
status=shared.AccountStatus.ACTIVE,
42-
supplemental_data=shared.SupplementalData(
43-
content={
44-
"Money": {
45-
"blue": 'shred',
46-
},
47-
},
48-
),
49-
type=shared.AccountType.ASSET,
50-
valid_datatype_links=[
51-
shared.AccountValidDataTypeLinks(
52-
links=[
53-
'abnormally',
54-
],
55-
),
56-
],
57-
),
58-
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
59-
connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',
31+
req = shared.CompanyRequestBody(
32+
description='Requested early access to the new financing scheme.',
33+
name='Bank of Dave',
6034
)
6135

62-
res = s.accounts.create(req)
36+
res = s.companies.create(req)
6337

64-
if res.create_account_response is not None:
38+
if res.company is not None:
6539
# handle response
6640
pass
6741
```
68-
<!-- End SDK Example Usage -->
42+
<!-- End SDK Example Usage [usage] -->
6943

70-
<!-- Start SDK Available Operations -->
44+
<!-- Start Available Resources and Operations [operations] -->
7145
## Available Resources and Operations
7246

73-
74-
### [accounts](docs/sdks/accounts/README.md)
75-
76-
* [create](docs/sdks/accounts/README.md#create) - Create account
77-
* [get_create_model](docs/sdks/accounts/README.md#get_create_model) - Get create account model
78-
7947
### [companies](docs/sdks/companies/README.md)
8048

8149
* [create](docs/sdks/companies/README.md#create) - Create company
@@ -84,12 +52,6 @@ if res.create_account_response is not None:
8452
* [list](docs/sdks/companies/README.md#list) - List companies
8553
* [update](docs/sdks/companies/README.md#update) - Update company
8654

87-
### [configuration](docs/sdks/configuration/README.md)
88-
89-
* [get](docs/sdks/configuration/README.md#get) - Get company configuration
90-
* [get_mapping_options](docs/sdks/configuration/README.md#get_mapping_options) - Mapping options
91-
* [set](docs/sdks/configuration/README.md#set) - Set company configuration
92-
9355
### [connections](docs/sdks/connections/README.md)
9456

9557
* [create](docs/sdks/connections/README.md#create) - Create connection
@@ -99,18 +61,24 @@ if res.create_account_response is not None:
9961
* [list](docs/sdks/connections/README.md#list) - List connections
10062
* [unlink](docs/sdks/connections/README.md#unlink) - Unlink connection
10163

64+
### [accounts](docs/sdks/accounts/README.md)
65+
66+
* [create](docs/sdks/accounts/README.md#create) - Create account
67+
* [get_create_model](docs/sdks/accounts/README.md#get_create_model) - Get create account model
68+
10269
### [customers](docs/sdks/customers/README.md)
10370

10471
* [create](docs/sdks/customers/README.md#create) - Create customer
10572
* [get](docs/sdks/customers/README.md#get) - Get customer
10673
* [list](docs/sdks/customers/README.md#list) - List customers
10774
* [update](docs/sdks/customers/README.md#update) - Update customer
10875

109-
### [expenses](docs/sdks/expenses/README.md)
76+
### [suppliers](docs/sdks/suppliers/README.md)
11077

111-
* [create](docs/sdks/expenses/README.md#create) - Create expense transaction
112-
* [update](docs/sdks/expenses/README.md#update) - Update expense-transactions
113-
* [upload_attachment](docs/sdks/expenses/README.md#upload_attachment) - Upload attachment
78+
* [create](docs/sdks/suppliers/README.md#create) - Create supplier
79+
* [get](docs/sdks/suppliers/README.md#get) - Get supplier
80+
* [list](docs/sdks/suppliers/README.md#list) - List suppliers
81+
* [update](docs/sdks/suppliers/README.md#update) - Update supplier
11482

11583
### [manage_data](docs/sdks/managedata/README.md)
11684

@@ -125,12 +93,17 @@ if res.create_account_response is not None:
12593
* [get](docs/sdks/pushoperations/README.md#get) - Get push operation
12694
* [list](docs/sdks/pushoperations/README.md#list) - List push operations
12795

128-
### [suppliers](docs/sdks/suppliers/README.md)
96+
### [configuration](docs/sdks/configuration/README.md)
12997

130-
* [create](docs/sdks/suppliers/README.md#create) - Create supplier
131-
* [get](docs/sdks/suppliers/README.md#get) - Get supplier
132-
* [list](docs/sdks/suppliers/README.md#list) - List suppliers
133-
* [update](docs/sdks/suppliers/README.md#update) - Update supplier
98+
* [get](docs/sdks/configuration/README.md#get) - Get company configuration
99+
* [get_mapping_options](docs/sdks/configuration/README.md#get_mapping_options) - Mapping options
100+
* [set](docs/sdks/configuration/README.md#set) - Set company configuration
101+
102+
### [expenses](docs/sdks/expenses/README.md)
103+
104+
* [create](docs/sdks/expenses/README.md#create) - Create expense transaction
105+
* [update](docs/sdks/expenses/README.md#update) - Update expense-transactions
106+
* [upload_attachment](docs/sdks/expenses/README.md#upload_attachment) - Upload attachment
134107

135108
### [sync](docs/sdks/sync/README.md)
136109

@@ -144,25 +117,223 @@ if res.create_account_response is not None:
144117

145118
* [get](docs/sdks/transactionstatus/README.md#get) - Get sync transaction
146119
* [list](docs/sdks/transactionstatus/README.md#list) - List sync transactions
147-
<!-- End SDK Available Operations -->
120+
<!-- End Available Resources and Operations [operations] -->
121+
122+
123+
124+
<!-- Start Retries [retries] -->
125+
## Retries
126+
127+
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.
128+
129+
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
130+
```python
131+
import codatsyncexpenses
132+
from codatsyncexpenses.models import shared
133+
from codatsyncexpenses.utils import BackoffStrategy, RetryConfig
134+
135+
s = codatsyncexpenses.CodatSyncExpenses(
136+
security=shared.Security(
137+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
138+
),
139+
)
140+
141+
req = shared.CompanyRequestBody(
142+
description='Requested early access to the new financing scheme.',
143+
name='Bank of Dave',
144+
)
145+
146+
res = s.companies.create(req,
147+
RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False))
148+
149+
if res.company is not None:
150+
# handle response
151+
pass
152+
```
153+
154+
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
155+
```python
156+
import codatsyncexpenses
157+
from codatsyncexpenses.models import shared
158+
from codatsyncexpenses.utils import BackoffStrategy, RetryConfig
159+
160+
s = codatsyncexpenses.CodatSyncExpenses(
161+
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)
162+
security=shared.Security(
163+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
164+
),
165+
)
166+
167+
req = shared.CompanyRequestBody(
168+
description='Requested early access to the new financing scheme.',
169+
name='Bank of Dave',
170+
)
171+
172+
res = s.companies.create(req)
173+
174+
if res.company is not None:
175+
# handle response
176+
pass
177+
```
178+
<!-- End Retries [retries] -->
179+
180+
<!-- Start Error Handling [errors] -->
181+
## Error Handling
182+
183+
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.
184+
185+
| Error Object | Status Code | Content Type |
186+
| --------------------------- | --------------------------- | --------------------------- |
187+
| errors.ErrorMessage | 400,401,402,403,429,500,503 | application/json |
188+
| errors.SDKError | 400-600 | */* |
189+
190+
### Example
191+
192+
```python
193+
import codatsyncexpenses
194+
from codatsyncexpenses.models import shared
195+
196+
s = codatsyncexpenses.CodatSyncExpenses(
197+
security=shared.Security(
198+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
199+
),
200+
)
201+
202+
req = shared.CompanyRequestBody(
203+
description='Requested early access to the new financing scheme.',
204+
name='Bank of Dave',
205+
)
206+
207+
res = None
208+
try:
209+
res = s.companies.create(req)
210+
except errors.ErrorMessage as e:
211+
print(e) # handle exception
212+
raise(e)
213+
except errors.SDKError as e:
214+
print(e) # handle exception
215+
raise(e)
216+
217+
if res.company is not None:
218+
# handle response
219+
pass
220+
```
221+
<!-- End Error Handling [errors] -->
222+
223+
<!-- Start Server Selection [server] -->
224+
## Server Selection
225+
226+
### Select Server by Index
227+
228+
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:
229+
230+
| # | Server | Variables |
231+
| - | ------ | --------- |
232+
| 0 | `https://api.codat.io` | None |
233+
234+
#### Example
235+
236+
```python
237+
import codatsyncexpenses
238+
from codatsyncexpenses.models import shared
239+
240+
s = codatsyncexpenses.CodatSyncExpenses(
241+
server_idx=0,
242+
security=shared.Security(
243+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
244+
),
245+
)
246+
247+
req = shared.CompanyRequestBody(
248+
description='Requested early access to the new financing scheme.',
249+
name='Bank of Dave',
250+
)
251+
252+
res = s.companies.create(req)
253+
254+
if res.company is not None:
255+
# handle response
256+
pass
257+
```
258+
259+
260+
### Override Server URL Per-Client
148261

149-
<!-- Start Dev Containers -->
262+
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:
263+
```python
264+
import codatsyncexpenses
265+
from codatsyncexpenses.models import shared
266+
267+
s = codatsyncexpenses.CodatSyncExpenses(
268+
server_url="https://api.codat.io",
269+
security=shared.Security(
270+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
271+
),
272+
)
150273

151-
<!-- End Dev Containers -->
274+
req = shared.CompanyRequestBody(
275+
description='Requested early access to the new financing scheme.',
276+
name='Bank of Dave',
277+
)
152278

279+
res = s.companies.create(req)
153280

281+
if res.company is not None:
282+
# handle response
283+
pass
284+
```
285+
<!-- End Server Selection [server] -->
154286

155-
<!-- Start Pagination -->
156-
# Pagination
287+
<!-- Start Custom HTTP Client [http-client] -->
288+
## Custom HTTP Client
157289

158-
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
159-
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
160-
return value of `Next` is `None`, then there are no more pages to be fetched.
290+
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.
161291

162-
Here's an example of one such pagination call:
292+
For example, you could specify a header for every request that this sdk makes as follows:
293+
```python
294+
import codatsyncexpenses
295+
import requests
163296

297+
http_client = requests.Session()
298+
http_client.headers.update({'x-custom-header': 'someValue'})
299+
s = codatsyncexpenses.CodatSyncExpenses(client: http_client)
300+
```
301+
<!-- End Custom HTTP Client [http-client] -->
164302

165-
<!-- End Pagination -->
303+
<!-- Start Authentication [security] -->
304+
## Authentication
305+
306+
### Per-Client Security Schemes
307+
308+
This SDK supports the following security scheme globally:
309+
310+
| Name | Type | Scheme |
311+
| ------------- | ------------- | ------------- |
312+
| `auth_header` | apiKey | API key |
313+
314+
You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. For example:
315+
```python
316+
import codatsyncexpenses
317+
from codatsyncexpenses.models import shared
318+
319+
s = codatsyncexpenses.CodatSyncExpenses(
320+
security=shared.Security(
321+
auth_header="Basic BASE_64_ENCODED(API_KEY)",
322+
),
323+
)
324+
325+
req = shared.CompanyRequestBody(
326+
description='Requested early access to the new financing scheme.',
327+
name='Bank of Dave',
328+
)
329+
330+
res = s.companies.create(req)
331+
332+
if res.company is not None:
333+
# handle response
334+
pass
335+
```
336+
<!-- End Authentication [security] -->
166337

167338
<!-- Placeholder for Future Speakeasy SDK Sections -->
168339

0 commit comments

Comments
 (0)