Skip to content

Commit 1ce8e47

Browse files
Merge pull request #22 from codatio/speakeasy-sdk-regen-1677684866
chore: speakeasy sdk regeneration - Generate Files SDK
2 parents f76233b + 79468ae commit 1ce8e47

File tree

19 files changed

+1257
-1
lines changed

19 files changed

+1257
-1
lines changed

files/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# codat-files
2+
3+
<!-- Start SDK Installation -->
4+
## SDK Installation
5+
6+
```bash
7+
pip install codat-files
8+
```
9+
<!-- End SDK Installation -->
10+
11+
## SDK Example Usage
12+
<!-- Start SDK Example Usage -->
13+
```python
14+
import codat
15+
from codat.models import operations, shared
16+
17+
s = codat.Codat()
18+
s.config_security(
19+
security=shared.Security(
20+
api_key="YOUR_API_KEY_HERE",
21+
)
22+
)
23+
24+
req = operations.DownloadFilesRequest(
25+
security=operations.DownloadFilesSecurity(
26+
api_key="YOUR_API_KEY_HERE",
27+
),
28+
path_params=operations.DownloadFilesPathParams(
29+
company_id="unde",
30+
),
31+
query_params=operations.DownloadFilesQueryParams(
32+
date_="2022-07-28T14:41:43.209Z",
33+
),
34+
)
35+
36+
res = s.files.download_files(req)
37+
38+
if res.status_code == 200:
39+
# handle response
40+
```
41+
<!-- End SDK Example Usage -->
42+
43+
<!-- Start SDK Available Operations -->
44+
## SDK Available Operations
45+
46+
47+
### files
48+
49+
* `download_files` - Download all files for a company
50+
* `list_files` - List all files uploaded by a company
51+
* `upload_files` - Upload files for a company
52+
<!-- End SDK Available Operations -->
53+
54+
### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)

files/RELEASES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
## 2023-03-01 15:34:24
4+
### Changes
5+
Based on:
6+
- OpenAPI Doc 2.1.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
7+
- Speakeasy CLI 1.7.0 https://github.com/speakeasy-api/speakeasy
8+
### Releases
9+
- [PyPI v0.1.0] https://pypi.org/project/codat-files/0.1.0 - files
10+
11+
## 2023-03-02 00:00:47
12+
### Changes
13+
Based on:
14+
- OpenAPI Doc 2.1.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
15+
- Speakeasy CLI 1.7.1 https://github.com/speakeasy-api/speakeasy
16+
### Releases
17+
- [PyPI v0.1.1] https://pypi.org/project/codat-files/0.1.1 - files

files/USAGE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- Start SDK Example Usage -->
2+
```python
3+
import codat
4+
from codat.models import operations, shared
5+
6+
s = codat.Codat()
7+
s.config_security(
8+
security=shared.Security(
9+
api_key="YOUR_API_KEY_HERE",
10+
)
11+
)
12+
13+
req = operations.DownloadFilesRequest(
14+
security=operations.DownloadFilesSecurity(
15+
api_key="YOUR_API_KEY_HERE",
16+
),
17+
path_params=operations.DownloadFilesPathParams(
18+
company_id="unde",
19+
),
20+
query_params=operations.DownloadFilesQueryParams(
21+
date_="2022-07-28T14:41:43.209Z",
22+
),
23+
)
24+
25+
res = s.files.download_files(req)
26+
27+
if res.status_code == 200:
28+
# handle response
29+
```
30+
<!-- End SDK Example Usage -->

files/files.gen

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
src/codat/files.py
2+
src/codat/sdk.py
3+
setup.py
4+
src/codat/__init__.py
5+
src/codat/models/__init__.py
6+
src/codat/utils/__init__.py
7+
src/codat/utils/retries.py
8+
src/codat/utils/utils.py
9+
src/codat/models/operations/download_files.py
10+
src/codat/models/operations/list_files.py
11+
src/codat/models/operations/upload_files.py
12+
src/codat/models/operations/__init__.py
13+
src/codat/models/shared/security.py
14+
src/codat/models/shared/__init__.py
15+
USAGE.md

files/gen.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
configVersion: 1.0.0
2+
management:
3+
docChecksum: cca5233035a11c68cfe55b187722a245
4+
docVersion: 2.1.0
5+
speakeasyVersion: 1.7.1
26
generation:
7+
telemetryEnabled: false
38
sdkClassName: codat
49
sdkFlattening: true
510
python:
6-
version: 0.0.1
11+
version: 0.1.1
12+
author: Speakeasy
13+
description: Python Client SDK Generated by Speakeasy
714
packageName: codat-files

files/setup.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import setuptools
2+
3+
try:
4+
with open("README.md", "r") as fh:
5+
long_description = fh.read()
6+
except FileNotFoundError:
7+
long_description = ""
8+
9+
setuptools.setup(
10+
name="codat-files",
11+
version="0.1.1",
12+
author="Speakeasy",
13+
description="Python Client SDK Generated by Speakeasy",
14+
long_description=long_description,
15+
long_description_content_type="text/markdown",
16+
packages=setuptools.find_packages(where="src"),
17+
install_requires=[
18+
"certifi==2022.12.07",
19+
"charset-normalizer==2.1.1",
20+
"dataclasses-json-speakeasy==0.5.8",
21+
"idna==3.3",
22+
"marshmallow==3.17.1",
23+
"marshmallow-enum==1.5.1",
24+
"mypy-extensions==0.4.3",
25+
"packaging==21.3",
26+
"pyparsing==3.0.9",
27+
"python-dateutil==2.8.2",
28+
"requests==2.28.1",
29+
"six==1.16.0",
30+
"typing-inspect==0.8.0",
31+
"typing_extensions==4.3.0",
32+
"urllib3==1.26.12",
33+
],
34+
package_dir={'': 'src'},
35+
python_requires='>=3.9'
36+
)

files/src/codat/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .sdk import *

files/src/codat/files.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import requests
2+
from . import utils
3+
from codat.models import operations
4+
from typing import Optional
5+
6+
class Files:
7+
_client: requests.Session
8+
_security_client: requests.Session
9+
_server_url: str
10+
_language: str
11+
_sdk_version: str
12+
_gen_version: str
13+
14+
def __init__(self, client: requests.Session, security_client: requests.Session, server_url: str, language: str, sdk_version: str, gen_version: str) -> None:
15+
self._client = client
16+
self._security_client = security_client
17+
self._server_url = server_url
18+
self._language = language
19+
self._sdk_version = sdk_version
20+
self._gen_version = gen_version
21+
22+
23+
def download_files(self, request: operations.DownloadFilesRequest) -> operations.DownloadFilesResponse:
24+
r"""Download all files for a company
25+
You can specify a date to download specific files for.
26+
"""
27+
28+
base_url = self._server_url
29+
30+
url = utils.generate_url(base_url, "/companies/{companyId}/files/download", request.path_params)
31+
32+
query_params = utils.get_query_params(request.query_params)
33+
34+
client = utils.configure_security_client(self._client, request.security)
35+
36+
r = client.request("GET", url, params=query_params)
37+
content_type = r.headers.get("Content-Type")
38+
39+
res = operations.DownloadFilesResponse(status_code=r.status_code, content_type=content_type)
40+
41+
if r.status_code == 200:
42+
pass
43+
44+
return res
45+
46+
47+
def list_files(self, request: operations.ListFilesRequest) -> operations.ListFilesResponse:
48+
r"""List all files uploaded by a company
49+
Returns an array of files that have been uploaded for a given company.
50+
"""
51+
52+
base_url = self._server_url
53+
54+
url = utils.generate_url(base_url, "/companies/{companyId}/files", request.path_params)
55+
56+
57+
client = utils.configure_security_client(self._client, request.security)
58+
59+
r = client.request("GET", url)
60+
content_type = r.headers.get("Content-Type")
61+
62+
res = operations.ListFilesResponse(status_code=r.status_code, content_type=content_type)
63+
64+
if r.status_code == 200:
65+
if utils.match_content_type(content_type, "application/json"):
66+
out = utils.unmarshal_json(r.text, Optional[list[operations.ListFilesFile]])
67+
res.files = out
68+
69+
return res
70+
71+
72+
def upload_files(self, request: operations.UploadFilesRequest) -> operations.UploadFilesResponse:
73+
r"""Upload files for a company
74+
Upload files
75+
"""
76+
77+
base_url = self._server_url
78+
79+
url = utils.generate_url(base_url, "/companies/{companyId}/connections/{connectionId}/files", request.path_params)
80+
81+
82+
client = utils.configure_security_client(self._client, request.security)
83+
84+
r = client.request("POST", url)
85+
content_type = r.headers.get("Content-Type")
86+
87+
res = operations.UploadFilesResponse(status_code=r.status_code, content_type=content_type)
88+
89+
if r.status_code == 200:
90+
pass
91+
92+
return res
93+
94+

files/src/codat/models/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from .download_files import *
2+
from .list_files import *
3+
from .upload_files import *
4+
5+
__all__ = ["DownloadFilesPathParams","DownloadFilesQueryParams","DownloadFilesRequest","DownloadFilesResponse","DownloadFilesSecurity","ListFilesFile","ListFilesPathParams","ListFilesRequest","ListFilesResponse","ListFilesSecurity","UploadFilesPathParams","UploadFilesRequest","UploadFilesResponse","UploadFilesSecurity"]

0 commit comments

Comments
 (0)