docu-devs-api-client 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docu_devs_api_client-0.1/PKG-INFO +19 -0
- docu_devs_api_client-0.1/README.md +1 -0
- docu_devs_api_client-0.1/docu_devs_api_client/__init__.py +8 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/__init__.py +1 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/__pycache__/__init__.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/__init__.py +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/__pycache__/__init__.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/__pycache__/process_document.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/__pycache__/upload_document.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/__pycache__/upload_files.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/process_document.py +169 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/upload_document.py +155 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/upload_files.py +155 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/document/upload_template.py +107 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/job/__init__.py +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/job/__pycache__/__init__.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/job/__pycache__/result.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/job/__pycache__/status.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/job/result.py +140 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/job/status.py +142 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/settings/__init__.py +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/settings/settings.py +150 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/__init__.py +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/__pycache__/__init__.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/__pycache__/delete_template.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/__pycache__/fill.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/__pycache__/list_templates.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/__pycache__/metadata.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/delete_template.py +151 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/fill.py +106 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/list_templates.py +127 -0
- docu_devs_api_client-0.1/docu_devs_api_client/api/template/metadata.py +151 -0
- docu_devs_api_client-0.1/docu_devs_api_client/client.py +268 -0
- docu_devs_api_client-0.1/docu_devs_api_client/errors.py +16 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__init__.py +27 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/__init__.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/delete_template_body.cpython-312.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/delete_template_body.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/document_template.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/fill_body.cpython-312.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/fill_body.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/organization.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/pdf_field.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/processing_job.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/settings.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/template_fill_request.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/upload_command.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/upload_document_body.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/upload_files_body.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/upload_response.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/__pycache__/upload_template_body.cpython-313.pyc +0 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/delete_template_body.py +58 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/document_template.py +164 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/fill_body.py +66 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/organization.py +58 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/pdf_field.py +152 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/processing_job.py +170 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/settings.py +58 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/template_fill_request.py +58 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/upload_command.py +190 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/upload_document_body.py +76 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/upload_files_body.py +202 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/upload_response.py +66 -0
- docu_devs_api_client-0.1/docu_devs_api_client/models/upload_template_body.py +76 -0
- docu_devs_api_client-0.1/docu_devs_api_client/py.typed +1 -0
- docu_devs_api_client-0.1/docu_devs_api_client/types.py +45 -0
- docu_devs_api_client-0.1/pyproject.toml +27 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: docu-devs-api-client
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: A client library for accessing DocuDevs API
|
|
5
|
+
Requires-Python: >=3.8,<4.0
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: attrs (>=21.3.0)
|
|
14
|
+
Requires-Dist: httpx (>=0.20.0,<0.28.0)
|
|
15
|
+
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Docudevs api client
|
|
19
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Docudevs api client
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
Binary file
|
|
File without changes
|
docu_devs_api_client-0.1/docu_devs_api_client/api/document/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
docu_devs_api_client-0.1/docu_devs_api_client/api/document/__pycache__/upload_files.cpython-313.pyc
ADDED
|
Binary file
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.upload_command import UploadCommand
|
|
9
|
+
from ...models.upload_response import UploadResponse
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
guid: str,
|
|
15
|
+
*,
|
|
16
|
+
body: UploadCommand,
|
|
17
|
+
) -> Dict[str, Any]:
|
|
18
|
+
headers: Dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: Dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": f"/document/process/{guid}",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_body = body.to_dict()
|
|
26
|
+
|
|
27
|
+
_kwargs["json"] = _body
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
36
|
+
) -> Optional[UploadResponse]:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = UploadResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_200
|
|
41
|
+
if client.raise_on_unexpected_status:
|
|
42
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
43
|
+
else:
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _build_response(
|
|
48
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
49
|
+
) -> Response[UploadResponse]:
|
|
50
|
+
return Response(
|
|
51
|
+
status_code=HTTPStatus(response.status_code),
|
|
52
|
+
content=response.content,
|
|
53
|
+
headers=response.headers,
|
|
54
|
+
parsed=_parse_response(client=client, response=response),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def sync_detailed(
|
|
59
|
+
guid: str,
|
|
60
|
+
*,
|
|
61
|
+
client: Union[AuthenticatedClient, Client],
|
|
62
|
+
body: UploadCommand,
|
|
63
|
+
) -> Response[UploadResponse]:
|
|
64
|
+
"""
|
|
65
|
+
Args:
|
|
66
|
+
guid (str):
|
|
67
|
+
body (UploadCommand):
|
|
68
|
+
|
|
69
|
+
Raises:
|
|
70
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
71
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Response[UploadResponse]
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
kwargs = _get_kwargs(
|
|
78
|
+
guid=guid,
|
|
79
|
+
body=body,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
response = client.get_httpx_client().request(
|
|
83
|
+
**kwargs,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return _build_response(client=client, response=response)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync(
|
|
90
|
+
guid: str,
|
|
91
|
+
*,
|
|
92
|
+
client: Union[AuthenticatedClient, Client],
|
|
93
|
+
body: UploadCommand,
|
|
94
|
+
) -> Optional[UploadResponse]:
|
|
95
|
+
"""
|
|
96
|
+
Args:
|
|
97
|
+
guid (str):
|
|
98
|
+
body (UploadCommand):
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
UploadResponse
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
return sync_detailed(
|
|
109
|
+
guid=guid,
|
|
110
|
+
client=client,
|
|
111
|
+
body=body,
|
|
112
|
+
).parsed
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
async def asyncio_detailed(
|
|
116
|
+
guid: str,
|
|
117
|
+
*,
|
|
118
|
+
client: Union[AuthenticatedClient, Client],
|
|
119
|
+
body: UploadCommand,
|
|
120
|
+
) -> Response[UploadResponse]:
|
|
121
|
+
"""
|
|
122
|
+
Args:
|
|
123
|
+
guid (str):
|
|
124
|
+
body (UploadCommand):
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
128
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
Response[UploadResponse]
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
kwargs = _get_kwargs(
|
|
135
|
+
guid=guid,
|
|
136
|
+
body=body,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
140
|
+
|
|
141
|
+
return _build_response(client=client, response=response)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio(
|
|
145
|
+
guid: str,
|
|
146
|
+
*,
|
|
147
|
+
client: Union[AuthenticatedClient, Client],
|
|
148
|
+
body: UploadCommand,
|
|
149
|
+
) -> Optional[UploadResponse]:
|
|
150
|
+
"""
|
|
151
|
+
Args:
|
|
152
|
+
guid (str):
|
|
153
|
+
body (UploadCommand):
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
157
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
UploadResponse
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
await asyncio_detailed(
|
|
165
|
+
guid=guid,
|
|
166
|
+
client=client,
|
|
167
|
+
body=body,
|
|
168
|
+
)
|
|
169
|
+
).parsed
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.upload_document_body import UploadDocumentBody
|
|
9
|
+
from ...models.upload_response import UploadResponse
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: UploadDocumentBody,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
headers: Dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: Dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/document/upload",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_body = body.to_multipart()
|
|
25
|
+
|
|
26
|
+
_kwargs["files"] = _body
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
34
|
+
) -> Optional[UploadResponse]:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = UploadResponse.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_200
|
|
39
|
+
if client.raise_on_unexpected_status:
|
|
40
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
41
|
+
else:
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_response(
|
|
46
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
47
|
+
) -> Response[UploadResponse]:
|
|
48
|
+
return Response(
|
|
49
|
+
status_code=HTTPStatus(response.status_code),
|
|
50
|
+
content=response.content,
|
|
51
|
+
headers=response.headers,
|
|
52
|
+
parsed=_parse_response(client=client, response=response),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def sync_detailed(
|
|
57
|
+
*,
|
|
58
|
+
client: Union[AuthenticatedClient, Client],
|
|
59
|
+
body: UploadDocumentBody,
|
|
60
|
+
) -> Response[UploadResponse]:
|
|
61
|
+
"""
|
|
62
|
+
Args:
|
|
63
|
+
body (UploadDocumentBody):
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
67
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Response[UploadResponse]
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
kwargs = _get_kwargs(
|
|
74
|
+
body=body,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
response = client.get_httpx_client().request(
|
|
78
|
+
**kwargs,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
return _build_response(client=client, response=response)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def sync(
|
|
85
|
+
*,
|
|
86
|
+
client: Union[AuthenticatedClient, Client],
|
|
87
|
+
body: UploadDocumentBody,
|
|
88
|
+
) -> Optional[UploadResponse]:
|
|
89
|
+
"""
|
|
90
|
+
Args:
|
|
91
|
+
body (UploadDocumentBody):
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
UploadResponse
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
return sync_detailed(
|
|
102
|
+
client=client,
|
|
103
|
+
body=body,
|
|
104
|
+
).parsed
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
async def asyncio_detailed(
|
|
108
|
+
*,
|
|
109
|
+
client: Union[AuthenticatedClient, Client],
|
|
110
|
+
body: UploadDocumentBody,
|
|
111
|
+
) -> Response[UploadResponse]:
|
|
112
|
+
"""
|
|
113
|
+
Args:
|
|
114
|
+
body (UploadDocumentBody):
|
|
115
|
+
|
|
116
|
+
Raises:
|
|
117
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Response[UploadResponse]
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
kwargs = _get_kwargs(
|
|
125
|
+
body=body,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
129
|
+
|
|
130
|
+
return _build_response(client=client, response=response)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio(
|
|
134
|
+
*,
|
|
135
|
+
client: Union[AuthenticatedClient, Client],
|
|
136
|
+
body: UploadDocumentBody,
|
|
137
|
+
) -> Optional[UploadResponse]:
|
|
138
|
+
"""
|
|
139
|
+
Args:
|
|
140
|
+
body (UploadDocumentBody):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
UploadResponse
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
client=client,
|
|
153
|
+
body=body,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.upload_files_body import UploadFilesBody
|
|
9
|
+
from ...models.upload_response import UploadResponse
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: UploadFilesBody,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
headers: Dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: Dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/document/upload-files",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_body = body.to_multipart()
|
|
25
|
+
|
|
26
|
+
_kwargs["files"] = _body
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
34
|
+
) -> Optional[UploadResponse]:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = UploadResponse.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_200
|
|
39
|
+
if client.raise_on_unexpected_status:
|
|
40
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
41
|
+
else:
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_response(
|
|
46
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
47
|
+
) -> Response[UploadResponse]:
|
|
48
|
+
return Response(
|
|
49
|
+
status_code=HTTPStatus(response.status_code),
|
|
50
|
+
content=response.content,
|
|
51
|
+
headers=response.headers,
|
|
52
|
+
parsed=_parse_response(client=client, response=response),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def sync_detailed(
|
|
57
|
+
*,
|
|
58
|
+
client: Union[AuthenticatedClient, Client],
|
|
59
|
+
body: UploadFilesBody,
|
|
60
|
+
) -> Response[UploadResponse]:
|
|
61
|
+
"""
|
|
62
|
+
Args:
|
|
63
|
+
body (UploadFilesBody):
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
67
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Response[UploadResponse]
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
kwargs = _get_kwargs(
|
|
74
|
+
body=body,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
response = client.get_httpx_client().request(
|
|
78
|
+
**kwargs,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
return _build_response(client=client, response=response)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def sync(
|
|
85
|
+
*,
|
|
86
|
+
client: Union[AuthenticatedClient, Client],
|
|
87
|
+
body: UploadFilesBody,
|
|
88
|
+
) -> Optional[UploadResponse]:
|
|
89
|
+
"""
|
|
90
|
+
Args:
|
|
91
|
+
body (UploadFilesBody):
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
UploadResponse
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
return sync_detailed(
|
|
102
|
+
client=client,
|
|
103
|
+
body=body,
|
|
104
|
+
).parsed
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
async def asyncio_detailed(
|
|
108
|
+
*,
|
|
109
|
+
client: Union[AuthenticatedClient, Client],
|
|
110
|
+
body: UploadFilesBody,
|
|
111
|
+
) -> Response[UploadResponse]:
|
|
112
|
+
"""
|
|
113
|
+
Args:
|
|
114
|
+
body (UploadFilesBody):
|
|
115
|
+
|
|
116
|
+
Raises:
|
|
117
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Response[UploadResponse]
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
kwargs = _get_kwargs(
|
|
125
|
+
body=body,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
129
|
+
|
|
130
|
+
return _build_response(client=client, response=response)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio(
|
|
134
|
+
*,
|
|
135
|
+
client: Union[AuthenticatedClient, Client],
|
|
136
|
+
body: UploadFilesBody,
|
|
137
|
+
) -> Optional[UploadResponse]:
|
|
138
|
+
"""
|
|
139
|
+
Args:
|
|
140
|
+
body (UploadFilesBody):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
UploadResponse
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
client=client,
|
|
153
|
+
body=body,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.upload_template_body import UploadTemplateBody
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
name: str,
|
|
14
|
+
*,
|
|
15
|
+
body: UploadTemplateBody,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
headers: Dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: Dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": f"/template/{name}",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_body = body.to_multipart()
|
|
25
|
+
|
|
26
|
+
_kwargs["files"] = _body
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
|
33
|
+
if response.status_code == 200:
|
|
34
|
+
return None
|
|
35
|
+
if client.raise_on_unexpected_status:
|
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
37
|
+
else:
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
|
42
|
+
return Response(
|
|
43
|
+
status_code=HTTPStatus(response.status_code),
|
|
44
|
+
content=response.content,
|
|
45
|
+
headers=response.headers,
|
|
46
|
+
parsed=_parse_response(client=client, response=response),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def sync_detailed(
|
|
51
|
+
name: str,
|
|
52
|
+
*,
|
|
53
|
+
client: Union[AuthenticatedClient, Client],
|
|
54
|
+
body: UploadTemplateBody,
|
|
55
|
+
) -> Response[Any]:
|
|
56
|
+
"""
|
|
57
|
+
Args:
|
|
58
|
+
name (str):
|
|
59
|
+
body (UploadTemplateBody):
|
|
60
|
+
|
|
61
|
+
Raises:
|
|
62
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
63
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Response[Any]
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
kwargs = _get_kwargs(
|
|
70
|
+
name=name,
|
|
71
|
+
body=body,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.get_httpx_client().request(
|
|
75
|
+
**kwargs,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return _build_response(client=client, response=response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
async def asyncio_detailed(
|
|
82
|
+
name: str,
|
|
83
|
+
*,
|
|
84
|
+
client: Union[AuthenticatedClient, Client],
|
|
85
|
+
body: UploadTemplateBody,
|
|
86
|
+
) -> Response[Any]:
|
|
87
|
+
"""
|
|
88
|
+
Args:
|
|
89
|
+
name (str):
|
|
90
|
+
body (UploadTemplateBody):
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[Any]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
name=name,
|
|
102
|
+
body=body,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
106
|
+
|
|
107
|
+
return _build_response(client=client, response=response)
|
|
File without changes
|
|
Binary file
|
|
Binary file
|