Skip to content

Commit

Permalink
Merge pull request #547 from codatio/speakeasy-sdk-regen-1702562928
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate Sync for Expenses library
  • Loading branch information
dcoplowe authored Dec 14, 2023
2 parents 91352b6 + 8aaafaa commit 1d18380
Show file tree
Hide file tree
Showing 374 changed files with 2,657 additions and 1,592 deletions.
Empty file modified sync-for-expenses/.gitattributes
100755 → 100644
Empty file.
315 changes: 243 additions & 72 deletions sync-for-expenses/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,46 @@
Embedded accounting integrations for corporate card providers.
<!-- End Codat Library Description -->

<!-- Start SDK Installation -->
<!-- Start SDK Installation [installation] -->
## SDK Installation

```bash
pip install codat-sync-for-expenses
```
<!-- End SDK Installation -->
<!-- End SDK Installation [installation] -->

## Example Usage
<!-- Start SDK Example Usage -->
<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage

### Example

```python
import codatsyncexpenses
from codatsyncexpenses.models import operations, shared
from decimal import Decimal
from codatsyncexpenses.models import shared

s = codatsyncexpenses.CodatSyncExpenses(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

req = operations.CreateAccountRequest(
account=shared.Account(
currency='USD',
current_balance=Decimal('0'),
description='Invoices the business has issued but has not yet collected payment on.',
fully_qualified_category='Asset.Current',
fully_qualified_name='Cash On Hand',
id='1b6266d1-1e44-46c5-8eb5-a8f98e03124e',
metadata=shared.AccountMetadata(),
modified_date='2022-10-23T00:00:00.000Z',
name='Accounts Receivable',
nominal_code='610',
source_modified_date='2022-10-23T00:00:00.000Z',
status=shared.AccountStatus.ACTIVE,
supplemental_data=shared.SupplementalData(
content={
"Money": {
"blue": 'shred',
},
},
),
type=shared.AccountType.ASSET,
valid_datatype_links=[
shared.AccountValidDataTypeLinks(
links=[
'abnormally',
],
),
],
),
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',
req = shared.CompanyRequestBody(
description='Requested early access to the new financing scheme.',
name='Bank of Dave',
)

res = s.accounts.create(req)
res = s.companies.create(req)

if res.create_account_response is not None:
if res.company is not None:
# handle response
pass
```
<!-- End SDK Example Usage -->
<!-- End SDK Example Usage [usage] -->

<!-- Start SDK Available Operations -->
<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations


### [accounts](docs/sdks/accounts/README.md)

* [create](docs/sdks/accounts/README.md#create) - Create account
* [get_create_model](docs/sdks/accounts/README.md#get_create_model) - Get create account model

### [companies](docs/sdks/companies/README.md)

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

### [configuration](docs/sdks/configuration/README.md)

* [get](docs/sdks/configuration/README.md#get) - Get company configuration
* [get_mapping_options](docs/sdks/configuration/README.md#get_mapping_options) - Mapping options
* [set](docs/sdks/configuration/README.md#set) - Set company configuration

### [connections](docs/sdks/connections/README.md)

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

### [accounts](docs/sdks/accounts/README.md)

* [create](docs/sdks/accounts/README.md#create) - Create account
* [get_create_model](docs/sdks/accounts/README.md#get_create_model) - Get create account model

### [customers](docs/sdks/customers/README.md)

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

### [expenses](docs/sdks/expenses/README.md)
### [suppliers](docs/sdks/suppliers/README.md)

* [create](docs/sdks/expenses/README.md#create) - Create expense transaction
* [update](docs/sdks/expenses/README.md#update) - Update expense-transactions
* [upload_attachment](docs/sdks/expenses/README.md#upload_attachment) - Upload attachment
* [create](docs/sdks/suppliers/README.md#create) - Create supplier
* [get](docs/sdks/suppliers/README.md#get) - Get supplier
* [list](docs/sdks/suppliers/README.md#list) - List suppliers
* [update](docs/sdks/suppliers/README.md#update) - Update supplier

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

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

### [suppliers](docs/sdks/suppliers/README.md)
### [configuration](docs/sdks/configuration/README.md)

* [create](docs/sdks/suppliers/README.md#create) - Create supplier
* [get](docs/sdks/suppliers/README.md#get) - Get supplier
* [list](docs/sdks/suppliers/README.md#list) - List suppliers
* [update](docs/sdks/suppliers/README.md#update) - Update supplier
* [get](docs/sdks/configuration/README.md#get) - Get company configuration
* [get_mapping_options](docs/sdks/configuration/README.md#get_mapping_options) - Mapping options
* [set](docs/sdks/configuration/README.md#set) - Set company configuration

### [expenses](docs/sdks/expenses/README.md)

* [create](docs/sdks/expenses/README.md#create) - Create expense transaction
* [update](docs/sdks/expenses/README.md#update) - Update expense-transactions
* [upload_attachment](docs/sdks/expenses/README.md#upload_attachment) - Upload attachment

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

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

* [get](docs/sdks/transactionstatus/README.md#get) - Get sync transaction
* [list](docs/sdks/transactionstatus/README.md#list) - List sync transactions
<!-- End SDK Available Operations -->
<!-- End Available Resources and Operations [operations] -->



<!-- Start Retries [retries] -->
## Retries

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.

To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
```python
import codatsyncexpenses
from codatsyncexpenses.models import shared
from codatsyncexpenses.utils import BackoffStrategy, RetryConfig

s = codatsyncexpenses.CodatSyncExpenses(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

req = shared.CompanyRequestBody(
description='Requested early access to the new financing scheme.',
name='Bank of Dave',
)

res = s.companies.create(req,
RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False))

if res.company is not None:
# handle response
pass
```

If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
```python
import codatsyncexpenses
from codatsyncexpenses.models import shared
from codatsyncexpenses.utils import BackoffStrategy, RetryConfig

s = codatsyncexpenses.CodatSyncExpenses(
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

req = shared.CompanyRequestBody(
description='Requested early access to the new financing scheme.',
name='Bank of Dave',
)

res = s.companies.create(req)

if res.company is not None:
# handle response
pass
```
<!-- End Retries [retries] -->

<!-- Start Error Handling [errors] -->
## Error Handling

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.

| Error Object | Status Code | Content Type |
| --------------------------- | --------------------------- | --------------------------- |
| errors.ErrorMessage | 400,401,402,403,429,500,503 | application/json |
| errors.SDKError | 400-600 | */* |

### Example

```python
import codatsyncexpenses
from codatsyncexpenses.models import shared

s = codatsyncexpenses.CodatSyncExpenses(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

req = shared.CompanyRequestBody(
description='Requested early access to the new financing scheme.',
name='Bank of Dave',
)

res = None
try:
res = s.companies.create(req)
except errors.ErrorMessage as e:
print(e) # handle exception
raise(e)
except errors.SDKError as e:
print(e) # handle exception
raise(e)

if res.company is not None:
# handle response
pass
```
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
## Server Selection

### Select Server by Index

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:

| # | Server | Variables |
| - | ------ | --------- |
| 0 | `https://api.codat.io` | None |

#### Example

```python
import codatsyncexpenses
from codatsyncexpenses.models import shared

s = codatsyncexpenses.CodatSyncExpenses(
server_idx=0,
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

req = shared.CompanyRequestBody(
description='Requested early access to the new financing scheme.',
name='Bank of Dave',
)

res = s.companies.create(req)

if res.company is not None:
# handle response
pass
```


### Override Server URL Per-Client

<!-- Start Dev Containers -->
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:
```python
import codatsyncexpenses
from codatsyncexpenses.models import shared

s = codatsyncexpenses.CodatSyncExpenses(
server_url="https://api.codat.io",
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

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

res = s.companies.create(req)

if res.company is not None:
# handle response
pass
```
<!-- End Server Selection [server] -->

<!-- Start Pagination -->
# Pagination
<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client

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

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

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

<!-- End Pagination -->
<!-- Start Authentication [security] -->
## Authentication

### Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name | Type | Scheme |
| ------------- | ------------- | ------------- |
| `auth_header` | apiKey | API key |

You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. For example:
```python
import codatsyncexpenses
from codatsyncexpenses.models import shared

s = codatsyncexpenses.CodatSyncExpenses(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)

req = shared.CompanyRequestBody(
description='Requested early access to the new financing scheme.',
name='Bank of Dave',
)

res = s.companies.create(req)

if res.company is not None:
# handle response
pass
```
<!-- End Authentication [security] -->

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

Expand Down
Loading

0 comments on commit 1d18380

Please sign in to comment.