Skip to content

Commit 3d98336

Browse files
authored
Merge pull request #173 from codatio/speakeasy-sdk-regen-1685718930
chore: speakeasy sdk regeneration - Generate Files SDK
2 parents 737b162 + 614dbe3 commit 3d98336

9 files changed

Lines changed: 89 additions & 63 deletions

File tree

files/RELEASES.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,28 @@ Based on:
398398
- OpenAPI Doc 2.1.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
399399
- Speakeasy CLI 1.40.3 (2.34.7) https://github.com/speakeasy-api/speakeasy
400400
### Releases
401-
- [PyPI v0.22.1] https://pypi.org/project/codat-files/0.22.1 - files
401+
- [PyPI v0.22.1] https://pypi.org/project/codat-files/0.22.1 - files
402+
403+
## 2023-06-02 15:15:27
404+
### Changes
405+
Based on:
406+
- OpenAPI Doc 2.1.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
407+
- Speakeasy CLI 1.42.2 (2.35.2) https://github.com/speakeasy-api/speakeasy
408+
### Releases
409+
- [PyPI v0.23.0] https://pypi.org/project/codat-files/0.23.0 - files
410+
411+
## 2023-06-03 00:00:49
412+
### Changes
413+
Based on:
414+
- OpenAPI Doc 2.1.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
415+
- Speakeasy CLI 1.43.0 (2.35.3) https://github.com/speakeasy-api/speakeasy
416+
### Releases
417+
- [PyPI v0.23.1] https://pypi.org/project/codat-files/0.23.1 - files
418+
419+
## 2023-06-06 20:45:25
420+
### Changes
421+
Based on:
422+
- OpenAPI Doc 2.1.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Files.yaml
423+
- Speakeasy CLI 1.44.2 (2.35.9) https://github.com/speakeasy-api/speakeasy
424+
### Releases
425+
- [PyPI v0.23.2] https://pypi.org/project/codat-files/0.23.2 - files

files/docs/codatfiles/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
An API for uploading and downloading files from 'File Upload' Integrations.
5+
Files API: An API for uploading and downloading files from 'File Upload' Integrations.
66

77
The Accounting file upload, Banking file upload, and Business documents file upload integrations provide simple file upload functionality.
88

files/files.gen

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
src/codatfiles/sdkconfiguration.py
12
src/codatfiles/files.py
23
src/codatfiles/sdk.py
34
.gitignore

files/gen.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ configVersion: 1.0.0
22
management:
33
docChecksum: a840628ec16624727f01593d82c33746
44
docVersion: 2.1.0
5-
speakeasyVersion: 1.40.3
6-
generationVersion: 2.34.7
5+
speakeasyVersion: 1.44.2
6+
generationVersion: 2.35.9
77
generation:
88
sdkClassName: CodatFiles
99
singleTagPerOp: false
1010
telemetryEnabled: true
1111
python:
12-
version: 0.22.1
12+
version: 0.23.2
1313
author: Speakeasy
1414
description: Python Client SDK Generated by Speakeasy
1515
maxMethodParams: 0

files/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setuptools.setup(
1212
name="codat-files",
13-
version="0.22.1",
13+
version="0.23.2",
1414
author="Speakeasy",
1515
description="Python Client SDK Generated by Speakeasy",
1616
long_description=long_description,

files/src/codatfiles/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
22

33
from .sdk import *
4+
from .sdkconfiguration import *

files/src/codatfiles/files.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
22

3-
import requests as requests_http
4-
from . import utils
3+
from .sdkconfiguration import SDKConfiguration
4+
from codatfiles import utils
55
from codatfiles.models import operations, shared
66
from typing import Optional
77

88
class Files:
99
r"""Endpoints to manage uploaded files."""
10-
_client: requests_http.Session
11-
_security_client: requests_http.Session
12-
_server_url: str
13-
_language: str
14-
_sdk_version: str
15-
_gen_version: str
10+
sdk_configuration: SDKConfiguration
1611

17-
def __init__(self, client: requests_http.Session, security_client: requests_http.Session, server_url: str, language: str, sdk_version: str, gen_version: str) -> None:
18-
self._client = client
19-
self._security_client = security_client
20-
self._server_url = server_url
21-
self._language = language
22-
self._sdk_version = sdk_version
23-
self._gen_version = gen_version
12+
def __init__(self, sdk_config: SDKConfiguration) -> None:
13+
self.sdk_configuration = sdk_config
2414

2515

2616
def download_files(self, request: operations.DownloadFilesRequest, retries: Optional[utils.RetryConfig] = None) -> operations.DownloadFilesResponse:
2717
r"""Download all files for a company
2818
You can specify a date to download specific files for.
2919
"""
30-
base_url = self._server_url
20+
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
3121

3222
url = utils.generate_url(operations.DownloadFilesRequest, base_url, '/companies/{companyId}/files/download', request)
3323
headers = {}
3424
query_params = utils.get_query_params(operations.DownloadFilesRequest, request)
3525
headers['Accept'] = 'application/json;q=1, application/json;q=0.7, application/octet-stream;q=0'
36-
headers['user-agent'] = f'speakeasy-sdk/{self._language} {self._sdk_version} {self._gen_version}'
26+
headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version}'
3727

38-
client = self._security_client
28+
client = self.sdk_configuration.security_client
3929

4030
retry_config = retries
4131
if retry_config is None:
@@ -74,14 +64,14 @@ def list_files(self, request: operations.ListFilesRequest, retries: Optional[uti
7464
r"""List all files uploaded by a company
7565
Returns an array of files that have been uploaded for a given company.
7666
"""
77-
base_url = self._server_url
67+
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
7868

7969
url = utils.generate_url(operations.ListFilesRequest, base_url, '/companies/{companyId}/files', request)
8070
headers = {}
8171
headers['Accept'] = 'application/json;q=1, application/json;q=0.7, application/json;q=0'
82-
headers['user-agent'] = f'speakeasy-sdk/{self._language} {self._sdk_version} {self._gen_version}'
72+
headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version}'
8373

84-
client = self._security_client
74+
client = self.sdk_configuration.security_client
8575

8676
retry_config = retries
8777
if retry_config is None:
@@ -121,17 +111,17 @@ def upload_files(self, request: operations.UploadFilesRequest, retries: Optional
121111
r"""Upload files for a company
122112
Upload files
123113
"""
124-
base_url = self._server_url
114+
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
125115

126116
url = utils.generate_url(operations.UploadFilesRequest, base_url, '/companies/{companyId}/connections/{connectionId}/files', request)
127117
headers = {}
128118
req_content_type, data, form = utils.serialize_request_body(request, "request_body", 'multipart')
129119
if req_content_type not in ('multipart/form-data', 'multipart/mixed'):
130120
headers['content-type'] = req_content_type
131121
headers['Accept'] = 'application/json;q=1, application/json;q=0'
132-
headers['user-agent'] = f'speakeasy-sdk/{self._language} {self._sdk_version} {self._gen_version}'
122+
headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version}'
133123

134-
client = self._security_client
124+
client = self.sdk_configuration.security_client
135125

136126
retry_config = retries
137127
if retry_config is None:

files/src/codatfiles/sdk.py

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
22

33
import requests as requests_http
4-
from . import utils
54
from .files import Files
5+
from .sdkconfiguration import SDKConfiguration
6+
from codatfiles import utils
67
from codatfiles.models import shared
78

8-
SERVERS = [
9-
"https://api.codat.io",
10-
r"""Production"""
11-
]
12-
"""Contains the list of servers available to the SDK"""
13-
149
class CodatFiles:
15-
r"""An API for uploading and downloading files from 'File Upload' Integrations.
10+
r"""Files API: An API for uploading and downloading files from 'File Upload' Integrations.
1611
1712
The Accounting file upload, Banking file upload, and Business documents file upload integrations provide simple file upload functionality.
1813
@@ -23,15 +18,11 @@ class CodatFiles:
2318
files: Files
2419
r"""Endpoints to manage uploaded files."""
2520

26-
_client: requests_http.Session
27-
_security_client: requests_http.Session
28-
_server_url: str = SERVERS[0]
29-
_language: str = "python"
30-
_sdk_version: str = "0.22.1"
31-
_gen_version: str = "2.34.7"
21+
sdk_configuration: SDKConfiguration
3222

3323
def __init__(self,
3424
security: shared.Security = None,
25+
server_idx: int = None,
3526
server_url: str = None,
3627
url_params: dict[str, str] = None,
3728
client: requests_http.Session = None
@@ -40,38 +31,28 @@ def __init__(self,
4031
4132
:param security: The security details required for authentication
4233
:type security: shared.Security
34+
:param server_idx: The index of the server to use for all operations
35+
:type server_idx: int
4336
:param server_url: The server URL to use for all operations
4437
:type server_url: str
4538
:param url_params: Parameters to optionally template the server URL with
4639
:type url_params: dict[str, str]
4740
:param client: The requests.Session HTTP client to use for all operations
4841
:type client: requests_http.Session
4942
"""
50-
self._client = requests_http.Session()
43+
if client is None:
44+
client = requests_http.Session()
5145

46+
security_client = utils.configure_security_client(client, security)
5247

5348
if server_url is not None:
5449
if url_params is not None:
55-
self._server_url = utils.template_url(server_url, url_params)
56-
else:
57-
self._server_url = server_url
58-
59-
if client is not None:
60-
self._client = client
61-
62-
self._security_client = utils.configure_security_client(self._client, security)
63-
50+
server_url = utils.template_url(server_url, url_params)
6451

52+
self.sdk_configuration = SDKConfiguration(client, security_client, server_url, server_idx)
53+
6554
self._init_sdks()
6655

6756
def _init_sdks(self):
68-
self.files = Files(
69-
self._client,
70-
self._security_client,
71-
self._server_url,
72-
self._language,
73-
self._sdk_version,
74-
self._gen_version
75-
)
76-
57+
self.files = Files(self.sdk_configuration)
7758

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
2+
3+
import requests
4+
from dataclasses import dataclass
5+
6+
7+
SERVERS = [
8+
'https://api.codat.io',
9+
# Production
10+
]
11+
"""Contains the list of servers available to the SDK"""
12+
13+
@dataclass
14+
class SDKConfiguration:
15+
client: requests.Session
16+
security_client: requests.Session
17+
server_url: str = ''
18+
server_idx: int = 0
19+
language: str = 'python'
20+
sdk_version: str = '0.23.2'
21+
gen_version: str = '2.35.9'
22+
23+
def get_server_details(self) -> tuple[str, dict[str, str]]:
24+
if self.server_url:
25+
return self.server_url.removesuffix('/'), {}
26+
if self.server_idx is None:
27+
self.server_idx = 0
28+
29+
return SERVERS[self.server_idx], {}

0 commit comments

Comments
 (0)