Skip to content

Commit

Permalink
Merge pull request #550 from codatio/speakeasy-sdk-regen-1702644926
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate Files library
  • Loading branch information
dcoplowe authored Dec 15, 2023
2 parents 35a2f90 + c4356d7 commit b2c69ca
Show file tree
Hide file tree
Showing 49 changed files with 653 additions and 253 deletions.
Empty file modified previous-versions/files/.gitattributes
100755 β†’ 100644
Empty file.
225 changes: 214 additions & 11 deletions previous-versions/files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@
<!-- End Codat Library Description -->
Use Codat's Files API to upload your SMB customers' files.

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

```bash
pip install codat-files
```
<!-- End SDK Installation -->
<!-- End SDK Installation [installation] -->

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

### Example

```python
import codatfiles
from codatfiles.models import operations, shared
from codatfiles.models import operations

s = codatfiles.CodatFiles(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

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

res = s.files.download_files(req)
Expand All @@ -34,26 +38,225 @@ if res.data 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


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

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



<!-- Start Dev Containers -->
<!-- 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 codatfiles
from codatfiles.models import operations
from codatfiles.utils import BackoffStrategy, RetryConfig

s = codatfiles.CodatFiles(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

<!-- End Dev Containers -->
req = operations.DownloadFilesRequest(
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
date_='2022-10-23T00:00:00Z',
)

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

if res.data 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 codatfiles
from codatfiles.models import operations
from codatfiles.utils import BackoffStrategy, RetryConfig

s = codatfiles.CodatFiles(
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

req = operations.DownloadFilesRequest(
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
date_='2022-10-23T00:00:00Z',
)

res = s.files.download_files(req)

if res.data 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.Schema | 400,401,402,404,429,500,503 | application/json |
| errors.DownloadFilesErrorMessage | 403 | application/json |
| errors.SDKError | 400-600 | */* |

### Example

```python
import codatfiles
from codatfiles.models import operations

s = codatfiles.CodatFiles(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

req = operations.DownloadFilesRequest(
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
date_='2022-10-23T00:00:00Z',
)

res = None
try:
res = s.files.download_files(req)
except errors.Schema as e:
print(e) # handle exception
raise(e)
except errors.DownloadFilesErrorMessage as e:
print(e) # handle exception
raise(e)
except errors.SDKError as e:
print(e) # handle exception
raise(e)

if res.data 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 codatfiles
from codatfiles.models import operations

s = codatfiles.CodatFiles(
server_idx=0,
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

req = operations.DownloadFilesRequest(
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
date_='2022-10-23T00:00:00Z',
)

res = s.files.download_files(req)

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


### 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:
```python
import codatfiles
from codatfiles.models import operations

s = codatfiles.CodatFiles(
server_url="https://api.codat.io",
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

req = operations.DownloadFilesRequest(
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
date_='2022-10-23T00:00:00Z',
)

res = s.files.download_files(req)

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

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

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.

For example, you could specify a header for every request that this sdk makes as follows:
```python
import codatfiles
import requests

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

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

### Per-Client Security Schemes

This SDK supports the following security scheme globally:

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

To authenticate with the API the `auth_header` parameter must be set when initializing the SDK client instance. For example:
```python
import codatfiles
from codatfiles.models import operations

s = codatfiles.CodatFiles(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

req = operations.DownloadFilesRequest(
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
date_='2022-10-23T00:00:00Z',
)

res = s.files.download_files(req)

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

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

Expand Down
12 changes: 11 additions & 1 deletion previous-versions/files/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ Based on:
### Generated
- [python v0.1.0] previous-versions/files
### Releases
- [PyPI v0.1.0] https://pypi.org/project/codat-files/0.1.0 - previous-versions/files
- [PyPI v0.1.0] https://pypi.org/project/codat-files/0.1.0 - previous-versions/files

## 2023-12-15 12:55:21
### Changes
Based on:
- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
- Speakeasy CLI 1.126.3 (2.214.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.2.0] previous-versions/files
### Releases
- [PyPI v0.2.0] https://pypi.org/project/codat-files/0.2.0 - previous-versions/files
10 changes: 4 additions & 6 deletions previous-versions/files/USAGE.md
100755 β†’ 100644
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<!-- Start SDK Example Usage -->


<!-- Start SDK Example Usage [usage] -->
```python
import codatfiles
from codatfiles.models import operations, shared
from codatfiles.models import operations

s = codatfiles.CodatFiles(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
)

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

res = s.files.download_files(req)
Expand All @@ -20,4 +18,4 @@ if res.data is not None:
# handle response
pass
```
<!-- End SDK Example Usage -->
<!-- End SDK Example Usage [usage] -->
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# DownloadFilesErrorMessage

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


## Fields

| Field | Type | Required | Description |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. |
| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. |
| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ListFilesErrorMessage

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


## Fields

| Field | Type | Required | Description |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. |
| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. |
| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Schema

Your API request was not properly authorized.


## Fields

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# UploadFilesErrorMessage

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


## Fields

| Field | Type | Required | Description |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. |
| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. |
| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. |
Expand Down
2 changes: 1 addition & 1 deletion previous-versions/files/docs/models/operations/downloadfilesrequest.md
100755 β†’ 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
| Field | Type | Required | Description | Example |
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 |
| `date_` | *Optional[str]* | :heavy_minus_sign: | Only download files uploaded on this date. | 2022-10-23T00:00:00.000Z |
| `date_` | *Optional[str]* | :heavy_minus_sign: | Only download files uploaded on this date. | 2022-10-23 00:00:00 +0000 UTC |
Loading

0 comments on commit b2c69ca

Please sign in to comment.