athena-intelligence 0.1.126__py3-none-any.whl → 0.1.184__py3-none-any.whl
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.
- athena/__init__.py +28 -3
- athena/agents/__init__.py +2 -0
- athena/agents/client.py +51 -95
- athena/agents/drive/__init__.py +2 -0
- athena/agents/drive/client.py +31 -80
- athena/agents/drive/raw_client.py +155 -0
- athena/agents/general/__init__.py +2 -0
- athena/agents/general/client.py +91 -238
- athena/agents/general/raw_client.py +369 -0
- athena/agents/raw_client.py +176 -0
- athena/agents/research/__init__.py +2 -0
- athena/agents/research/client.py +31 -80
- athena/agents/research/raw_client.py +155 -0
- athena/agents/sql/__init__.py +2 -0
- athena/agents/sql/client.py +31 -80
- athena/agents/sql/raw_client.py +155 -0
- athena/assets/__init__.py +4 -0
- athena/assets/client.py +144 -0
- athena/assets/raw_client.py +164 -0
- athena/base_client.py +25 -11
- athena/client.py +1 -1
- athena/core/__init__.py +5 -0
- athena/core/api_error.py +13 -5
- athena/core/client_wrapper.py +33 -8
- athena/core/force_multipart.py +16 -0
- athena/core/http_client.py +70 -26
- athena/core/http_response.py +55 -0
- athena/core/jsonable_encoder.py +0 -1
- athena/core/pydantic_utilities.py +70 -111
- athena/core/serialization.py +7 -3
- athena/errors/__init__.py +2 -0
- athena/errors/bad_request_error.py +4 -2
- athena/errors/content_too_large_error.py +4 -2
- athena/errors/internal_server_error.py +4 -3
- athena/errors/not_found_error.py +4 -2
- athena/errors/unauthorized_error.py +4 -3
- athena/errors/unprocessable_entity_error.py +4 -3
- athena/errors/unsupported_media_type_error.py +4 -2
- athena/query/__init__.py +2 -0
- athena/query/client.py +39 -219
- athena/query/raw_client.py +344 -0
- athena/query/types/__init__.py +2 -0
- athena/tools/__init__.py +2 -0
- athena/tools/calendar/__init__.py +2 -0
- athena/tools/calendar/client.py +35 -79
- athena/tools/calendar/raw_client.py +172 -0
- athena/tools/client.py +267 -653
- athena/tools/email/__init__.py +2 -0
- athena/tools/email/client.py +39 -115
- athena/tools/email/raw_client.py +248 -0
- athena/tools/raw_client.py +1328 -0
- athena/tools/structured_data_extractor/__init__.py +2 -0
- athena/tools/structured_data_extractor/client.py +42 -96
- athena/tools/structured_data_extractor/raw_client.py +240 -0
- athena/tools/tasks/__init__.py +2 -0
- athena/tools/tasks/client.py +31 -43
- athena/tools/tasks/raw_client.py +96 -0
- athena/tools/types/__init__.py +2 -0
- athena/types/__init__.py +28 -2
- athena/types/asset_content_request_out.py +26 -0
- athena/types/asset_node.py +3 -3
- athena/types/asset_not_found_error.py +2 -2
- athena/types/asset_screenshot_response_out.py +43 -0
- athena/types/chunk.py +3 -3
- athena/types/chunk_content_item.py +3 -2
- athena/types/chunk_result.py +3 -3
- athena/types/content.py +7 -0
- athena/types/custom_agent_response.py +2 -2
- athena/types/data_frame_request_out.py +3 -3
- athena/types/data_frame_unknown_format_error.py +2 -2
- athena/types/document_chunk.py +2 -2
- athena/types/drive_agent_response.py +2 -2
- athena/types/file_chunk_request_out.py +3 -3
- athena/types/file_too_large_error.py +2 -2
- athena/types/folder_response.py +10 -4
- athena/types/general_agent_config.py +4 -3
- athena/types/general_agent_config_enabled_tools_item.py +1 -2
- athena/types/general_agent_request.py +15 -4
- athena/types/general_agent_response.py +4 -3
- athena/types/general_agent_response_message.py +100 -0
- athena/types/general_agent_response_message_kwargs.py +74 -0
- athena/types/{tool.py → id.py} +1 -1
- athena/types/image_url_content.py +2 -2
- athena/types/input_message.py +29 -0
- athena/types/input_message_content_item.py +39 -0
- athena/types/paginated_assets_out.py +52 -0
- athena/types/parent_folder_error.py +2 -2
- athena/types/prompt_message.py +3 -3
- athena/types/public_asset_out.py +97 -0
- athena/types/research_agent_response.py +2 -2
- athena/types/save_asset_request_out.py +2 -2
- athena/types/sql_agent_response.py +2 -2
- athena/types/structured_data_extractor_response.py +3 -3
- athena/types/text_content.py +2 -2
- athena/types/type.py +1 -1
- {athena_intelligence-0.1.126.dist-info → athena_intelligence-0.1.184.dist-info}/METADATA +3 -7
- athena_intelligence-0.1.184.dist-info/RECORD +112 -0
- {athena_intelligence-0.1.126.dist-info → athena_intelligence-0.1.184.dist-info}/WHEEL +1 -1
- athena_intelligence-0.1.126.dist-info/RECORD +0 -87
athena/tools/client.py
CHANGED
@@ -1,37 +1,22 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
import typing
|
4
|
-
|
5
|
-
from
|
6
|
-
from .
|
7
|
-
from .structured_data_extractor.client import StructuredDataExtractorClient
|
8
|
-
from .tasks.client import TasksClient
|
4
|
+
|
5
|
+
from .. import core
|
6
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
7
|
from ..core.request_options import RequestOptions
|
8
|
+
from ..types.asset_content_request_out import AssetContentRequestOut
|
9
|
+
from ..types.asset_screenshot_response_out import AssetScreenshotResponseOut
|
10
|
+
from ..types.data_frame_request_out import DataFrameRequestOut
|
10
11
|
from ..types.file_chunk_request_out import FileChunkRequestOut
|
11
|
-
from ..core.pydantic_utilities import parse_obj_as
|
12
|
-
from ..errors.unauthorized_error import UnauthorizedError
|
13
|
-
from ..errors.not_found_error import NotFoundError
|
14
|
-
from ..types.asset_not_found_error import AssetNotFoundError
|
15
|
-
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
16
|
-
from json.decoder import JSONDecodeError
|
17
|
-
from ..core.api_error import ApiError
|
18
12
|
from ..types.folder_response import FolderResponse
|
19
|
-
from ..errors.bad_request_error import BadRequestError
|
20
|
-
from ..types.parent_folder_error import ParentFolderError
|
21
|
-
from .types.tools_data_frame_request_columns_item import ToolsDataFrameRequestColumnsItem
|
22
|
-
from ..types.data_frame_request_out import DataFrameRequestOut
|
23
|
-
from ..errors.unsupported_media_type_error import UnsupportedMediaTypeError
|
24
|
-
from ..types.data_frame_unknown_format_error import DataFrameUnknownFormatError
|
25
|
-
from ..errors.internal_server_error import InternalServerError
|
26
|
-
from .. import core
|
27
13
|
from ..types.save_asset_request_out import SaveAssetRequestOut
|
28
|
-
from
|
29
|
-
from
|
30
|
-
from
|
31
|
-
from .
|
32
|
-
from .
|
33
|
-
from .
|
34
|
-
from .tasks.client import AsyncTasksClient
|
14
|
+
from .calendar.client import AsyncCalendarClient, CalendarClient
|
15
|
+
from .email.client import AsyncEmailClient, EmailClient
|
16
|
+
from .raw_client import AsyncRawToolsClient, RawToolsClient
|
17
|
+
from .structured_data_extractor.client import AsyncStructuredDataExtractorClient, StructuredDataExtractorClient
|
18
|
+
from .tasks.client import AsyncTasksClient, TasksClient
|
19
|
+
from .types.tools_data_frame_request_columns_item import ToolsDataFrameRequestColumnsItem
|
35
20
|
|
36
21
|
# this is used as the default value for optional parameters
|
37
22
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -39,11 +24,25 @@ OMIT = typing.cast(typing.Any, ...)
|
|
39
24
|
|
40
25
|
class ToolsClient:
|
41
26
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
42
|
-
self.
|
43
|
-
self.calendar = CalendarClient(client_wrapper=
|
44
|
-
|
45
|
-
self.
|
46
|
-
|
27
|
+
self._raw_client = RawToolsClient(client_wrapper=client_wrapper)
|
28
|
+
self.calendar = CalendarClient(client_wrapper=client_wrapper)
|
29
|
+
|
30
|
+
self.email = EmailClient(client_wrapper=client_wrapper)
|
31
|
+
|
32
|
+
self.structured_data_extractor = StructuredDataExtractorClient(client_wrapper=client_wrapper)
|
33
|
+
|
34
|
+
self.tasks = TasksClient(client_wrapper=client_wrapper)
|
35
|
+
|
36
|
+
@property
|
37
|
+
def with_raw_response(self) -> RawToolsClient:
|
38
|
+
"""
|
39
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
40
|
+
|
41
|
+
Returns
|
42
|
+
-------
|
43
|
+
RawToolsClient
|
44
|
+
"""
|
45
|
+
return self._raw_client
|
47
46
|
|
48
47
|
def get_asset_chunks(
|
49
48
|
self, *, asset_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
|
@@ -78,75 +77,97 @@ class ToolsClient:
|
|
78
77
|
],
|
79
78
|
)
|
80
79
|
"""
|
81
|
-
_response = self.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
80
|
+
_response = self._raw_client.get_asset_chunks(asset_ids=asset_ids, request_options=request_options)
|
81
|
+
return _response.data
|
82
|
+
|
83
|
+
def get_asset_content(
|
84
|
+
self, *, asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
85
|
+
) -> AssetContentRequestOut:
|
86
|
+
"""
|
87
|
+
Get the content of an asset.
|
88
|
+
|
89
|
+
Parameters
|
90
|
+
----------
|
91
|
+
asset_id : str
|
92
|
+
|
93
|
+
request_options : typing.Optional[RequestOptions]
|
94
|
+
Request-specific configuration.
|
95
|
+
|
96
|
+
Returns
|
97
|
+
-------
|
98
|
+
AssetContentRequestOut
|
99
|
+
Successful Response
|
100
|
+
|
101
|
+
Examples
|
102
|
+
--------
|
103
|
+
from athena import Athena
|
104
|
+
|
105
|
+
client = Athena(
|
106
|
+
api_key="YOUR_API_KEY",
|
92
107
|
)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
108
|
+
client.tools.get_asset_content(
|
109
|
+
asset_id="asset_id",
|
110
|
+
)
|
111
|
+
"""
|
112
|
+
_response = self._raw_client.get_asset_content(asset_id=asset_id, request_options=request_options)
|
113
|
+
return _response.data
|
114
|
+
|
115
|
+
def get_asset_screenshot(
|
116
|
+
self,
|
117
|
+
*,
|
118
|
+
asset_id: str,
|
119
|
+
page_number: typing.Optional[int] = None,
|
120
|
+
request_options: typing.Optional[RequestOptions] = None,
|
121
|
+
) -> AssetScreenshotResponseOut:
|
122
|
+
"""
|
123
|
+
Get a screenshot of a specific page from an asset.
|
124
|
+
|
125
|
+
Parameters
|
126
|
+
----------
|
127
|
+
asset_id : str
|
128
|
+
|
129
|
+
page_number : typing.Optional[int]
|
130
|
+
|
131
|
+
request_options : typing.Optional[RequestOptions]
|
132
|
+
Request-specific configuration.
|
133
|
+
|
134
|
+
Returns
|
135
|
+
-------
|
136
|
+
AssetScreenshotResponseOut
|
137
|
+
Successful Response
|
138
|
+
|
139
|
+
Examples
|
140
|
+
--------
|
141
|
+
from athena import Athena
|
142
|
+
|
143
|
+
client = Athena(
|
144
|
+
api_key="YOUR_API_KEY",
|
145
|
+
)
|
146
|
+
client.tools.get_asset_screenshot(
|
147
|
+
asset_id="asset_id",
|
148
|
+
)
|
149
|
+
"""
|
150
|
+
_response = self._raw_client.get_asset_screenshot(
|
151
|
+
asset_id=asset_id, page_number=page_number, request_options=request_options
|
152
|
+
)
|
153
|
+
return _response.data
|
136
154
|
|
137
155
|
def list_contents(
|
138
156
|
self,
|
139
157
|
*,
|
158
|
+
asset_id: typing.Optional[str] = None,
|
140
159
|
folder_id: typing.Optional[str] = None,
|
141
160
|
include_asset_details: typing.Optional[bool] = None,
|
142
161
|
include_system_files: typing.Optional[bool] = None,
|
143
162
|
request_options: typing.Optional[RequestOptions] = None,
|
144
163
|
) -> FolderResponse:
|
145
164
|
"""
|
146
|
-
List contents of
|
165
|
+
List contents of an asset (Folder, Collection, Project) or entire workspace in a tree structure.
|
147
166
|
|
148
167
|
Parameters
|
149
168
|
----------
|
169
|
+
asset_id : typing.Optional[str]
|
170
|
+
|
150
171
|
folder_id : typing.Optional[str]
|
151
172
|
|
152
173
|
include_asset_details : typing.Optional[bool]
|
@@ -170,69 +191,14 @@ class ToolsClient:
|
|
170
191
|
)
|
171
192
|
client.tools.list_contents()
|
172
193
|
"""
|
173
|
-
_response = self.
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
"include_asset_details": include_asset_details,
|
179
|
-
"include_system_files": include_system_files,
|
180
|
-
},
|
194
|
+
_response = self._raw_client.list_contents(
|
195
|
+
asset_id=asset_id,
|
196
|
+
folder_id=folder_id,
|
197
|
+
include_asset_details=include_asset_details,
|
198
|
+
include_system_files=include_system_files,
|
181
199
|
request_options=request_options,
|
182
200
|
)
|
183
|
-
|
184
|
-
if 200 <= _response.status_code < 300:
|
185
|
-
return typing.cast(
|
186
|
-
FolderResponse,
|
187
|
-
parse_obj_as(
|
188
|
-
type_=FolderResponse, # type: ignore
|
189
|
-
object_=_response.json(),
|
190
|
-
),
|
191
|
-
)
|
192
|
-
if _response.status_code == 400:
|
193
|
-
raise BadRequestError(
|
194
|
-
typing.cast(
|
195
|
-
ParentFolderError,
|
196
|
-
parse_obj_as(
|
197
|
-
type_=ParentFolderError, # type: ignore
|
198
|
-
object_=_response.json(),
|
199
|
-
),
|
200
|
-
)
|
201
|
-
)
|
202
|
-
if _response.status_code == 401:
|
203
|
-
raise UnauthorizedError(
|
204
|
-
typing.cast(
|
205
|
-
typing.Optional[typing.Any],
|
206
|
-
parse_obj_as(
|
207
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
208
|
-
object_=_response.json(),
|
209
|
-
),
|
210
|
-
)
|
211
|
-
)
|
212
|
-
if _response.status_code == 404:
|
213
|
-
raise NotFoundError(
|
214
|
-
typing.cast(
|
215
|
-
AssetNotFoundError,
|
216
|
-
parse_obj_as(
|
217
|
-
type_=AssetNotFoundError, # type: ignore
|
218
|
-
object_=_response.json(),
|
219
|
-
),
|
220
|
-
)
|
221
|
-
)
|
222
|
-
if _response.status_code == 422:
|
223
|
-
raise UnprocessableEntityError(
|
224
|
-
typing.cast(
|
225
|
-
typing.Optional[typing.Any],
|
226
|
-
parse_obj_as(
|
227
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
228
|
-
object_=_response.json(),
|
229
|
-
),
|
230
|
-
)
|
231
|
-
)
|
232
|
-
_response_json = _response.json()
|
233
|
-
except JSONDecodeError:
|
234
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
235
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
201
|
+
return _response.data
|
236
202
|
|
237
203
|
def data_frame(
|
238
204
|
self,
|
@@ -243,7 +209,7 @@ class ToolsClient:
|
|
243
209
|
columns: typing.Optional[
|
244
210
|
typing.Union[ToolsDataFrameRequestColumnsItem, typing.Sequence[ToolsDataFrameRequestColumnsItem]]
|
245
211
|
] = None,
|
246
|
-
sheet_name: typing.Optional[
|
212
|
+
sheet_name: typing.Optional[str] = None,
|
247
213
|
separator: typing.Optional[str] = None,
|
248
214
|
request_options: typing.Optional[RequestOptions] = None,
|
249
215
|
) -> DataFrameRequestOut:
|
@@ -259,7 +225,7 @@ class ToolsClient:
|
|
259
225
|
columns : typing.Optional[typing.Union[ToolsDataFrameRequestColumnsItem, typing.Sequence[ToolsDataFrameRequestColumnsItem]]]
|
260
226
|
should be a list of strings or a list of integers
|
261
227
|
|
262
|
-
sheet_name : typing.Optional[
|
228
|
+
sheet_name : typing.Optional[str]
|
263
229
|
only for excel files
|
264
230
|
|
265
231
|
separator : typing.Optional[str]
|
@@ -284,82 +250,16 @@ class ToolsClient:
|
|
284
250
|
asset_id="asset_id",
|
285
251
|
)
|
286
252
|
"""
|
287
|
-
_response = self.
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
"columns": columns,
|
295
|
-
"sheet_name": sheet_name,
|
296
|
-
"separator": separator,
|
297
|
-
},
|
253
|
+
_response = self._raw_client.data_frame(
|
254
|
+
asset_id=asset_id,
|
255
|
+
row_limit=row_limit,
|
256
|
+
index_column=index_column,
|
257
|
+
columns=columns,
|
258
|
+
sheet_name=sheet_name,
|
259
|
+
separator=separator,
|
298
260
|
request_options=request_options,
|
299
261
|
)
|
300
|
-
|
301
|
-
if 200 <= _response.status_code < 300:
|
302
|
-
return typing.cast(
|
303
|
-
DataFrameRequestOut,
|
304
|
-
parse_obj_as(
|
305
|
-
type_=DataFrameRequestOut, # type: ignore
|
306
|
-
object_=_response.json(),
|
307
|
-
),
|
308
|
-
)
|
309
|
-
if _response.status_code == 401:
|
310
|
-
raise UnauthorizedError(
|
311
|
-
typing.cast(
|
312
|
-
typing.Optional[typing.Any],
|
313
|
-
parse_obj_as(
|
314
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
315
|
-
object_=_response.json(),
|
316
|
-
),
|
317
|
-
)
|
318
|
-
)
|
319
|
-
if _response.status_code == 404:
|
320
|
-
raise NotFoundError(
|
321
|
-
typing.cast(
|
322
|
-
AssetNotFoundError,
|
323
|
-
parse_obj_as(
|
324
|
-
type_=AssetNotFoundError, # type: ignore
|
325
|
-
object_=_response.json(),
|
326
|
-
),
|
327
|
-
)
|
328
|
-
)
|
329
|
-
if _response.status_code == 415:
|
330
|
-
raise UnsupportedMediaTypeError(
|
331
|
-
typing.cast(
|
332
|
-
DataFrameUnknownFormatError,
|
333
|
-
parse_obj_as(
|
334
|
-
type_=DataFrameUnknownFormatError, # type: ignore
|
335
|
-
object_=_response.json(),
|
336
|
-
),
|
337
|
-
)
|
338
|
-
)
|
339
|
-
if _response.status_code == 422:
|
340
|
-
raise UnprocessableEntityError(
|
341
|
-
typing.cast(
|
342
|
-
typing.Optional[typing.Any],
|
343
|
-
parse_obj_as(
|
344
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
345
|
-
object_=_response.json(),
|
346
|
-
),
|
347
|
-
)
|
348
|
-
)
|
349
|
-
if _response.status_code == 500:
|
350
|
-
raise InternalServerError(
|
351
|
-
typing.cast(
|
352
|
-
typing.Optional[typing.Any],
|
353
|
-
parse_obj_as(
|
354
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
355
|
-
object_=_response.json(),
|
356
|
-
),
|
357
|
-
)
|
358
|
-
)
|
359
|
-
_response_json = _response.json()
|
360
|
-
except JSONDecodeError:
|
361
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
362
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
262
|
+
return _response.data
|
363
263
|
|
364
264
|
def raw_data(
|
365
265
|
self, *, asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
@@ -374,70 +274,13 @@ class ToolsClient:
|
|
374
274
|
request_options : typing.Optional[RequestOptions]
|
375
275
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
376
276
|
|
377
|
-
|
378
|
-
|
277
|
+
Returns
|
278
|
+
-------
|
379
279
|
typing.Iterator[bytes]
|
380
280
|
Stream the file in original format.
|
381
281
|
"""
|
382
|
-
with self.
|
383
|
-
|
384
|
-
method="GET",
|
385
|
-
params={
|
386
|
-
"asset_id": asset_id,
|
387
|
-
},
|
388
|
-
request_options=request_options,
|
389
|
-
) as _response:
|
390
|
-
try:
|
391
|
-
if 200 <= _response.status_code < 300:
|
392
|
-
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
|
393
|
-
for _chunk in _response.iter_bytes(chunk_size=_chunk_size):
|
394
|
-
yield _chunk
|
395
|
-
return
|
396
|
-
_response.read()
|
397
|
-
if _response.status_code == 401:
|
398
|
-
raise UnauthorizedError(
|
399
|
-
typing.cast(
|
400
|
-
typing.Optional[typing.Any],
|
401
|
-
parse_obj_as(
|
402
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
403
|
-
object_=_response.json(),
|
404
|
-
),
|
405
|
-
)
|
406
|
-
)
|
407
|
-
if _response.status_code == 404:
|
408
|
-
raise NotFoundError(
|
409
|
-
typing.cast(
|
410
|
-
AssetNotFoundError,
|
411
|
-
parse_obj_as(
|
412
|
-
type_=AssetNotFoundError, # type: ignore
|
413
|
-
object_=_response.json(),
|
414
|
-
),
|
415
|
-
)
|
416
|
-
)
|
417
|
-
if _response.status_code == 422:
|
418
|
-
raise UnprocessableEntityError(
|
419
|
-
typing.cast(
|
420
|
-
typing.Optional[typing.Any],
|
421
|
-
parse_obj_as(
|
422
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
423
|
-
object_=_response.json(),
|
424
|
-
),
|
425
|
-
)
|
426
|
-
)
|
427
|
-
if _response.status_code == 500:
|
428
|
-
raise InternalServerError(
|
429
|
-
typing.cast(
|
430
|
-
typing.Optional[typing.Any],
|
431
|
-
parse_obj_as(
|
432
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
433
|
-
object_=_response.json(),
|
434
|
-
),
|
435
|
-
)
|
436
|
-
)
|
437
|
-
_response_json = _response.json()
|
438
|
-
except JSONDecodeError:
|
439
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
440
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
282
|
+
with self._raw_client.raw_data(asset_id=asset_id, request_options=request_options) as r:
|
283
|
+
yield from r.data
|
441
284
|
|
442
285
|
def save_asset(
|
443
286
|
self,
|
@@ -472,71 +315,33 @@ class ToolsClient:
|
|
472
315
|
)
|
473
316
|
client.tools.save_asset()
|
474
317
|
"""
|
475
|
-
_response = self.
|
476
|
-
|
477
|
-
method="POST",
|
478
|
-
params={
|
479
|
-
"parent_folder_id": parent_folder_id,
|
480
|
-
},
|
481
|
-
data={},
|
482
|
-
files={
|
483
|
-
"file": file,
|
484
|
-
},
|
485
|
-
request_options=request_options,
|
486
|
-
omit=OMIT,
|
318
|
+
_response = self._raw_client.save_asset(
|
319
|
+
file=file, parent_folder_id=parent_folder_id, request_options=request_options
|
487
320
|
)
|
488
|
-
|
489
|
-
if 200 <= _response.status_code < 300:
|
490
|
-
return typing.cast(
|
491
|
-
SaveAssetRequestOut,
|
492
|
-
parse_obj_as(
|
493
|
-
type_=SaveAssetRequestOut, # type: ignore
|
494
|
-
object_=_response.json(),
|
495
|
-
),
|
496
|
-
)
|
497
|
-
if _response.status_code == 400:
|
498
|
-
raise BadRequestError(
|
499
|
-
typing.cast(
|
500
|
-
ParentFolderError,
|
501
|
-
parse_obj_as(
|
502
|
-
type_=ParentFolderError, # type: ignore
|
503
|
-
object_=_response.json(),
|
504
|
-
),
|
505
|
-
)
|
506
|
-
)
|
507
|
-
if _response.status_code == 413:
|
508
|
-
raise ContentTooLargeError(
|
509
|
-
typing.cast(
|
510
|
-
FileTooLargeError,
|
511
|
-
parse_obj_as(
|
512
|
-
type_=FileTooLargeError, # type: ignore
|
513
|
-
object_=_response.json(),
|
514
|
-
),
|
515
|
-
)
|
516
|
-
)
|
517
|
-
if _response.status_code == 422:
|
518
|
-
raise UnprocessableEntityError(
|
519
|
-
typing.cast(
|
520
|
-
typing.Optional[typing.Any],
|
521
|
-
parse_obj_as(
|
522
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
523
|
-
object_=_response.json(),
|
524
|
-
),
|
525
|
-
)
|
526
|
-
)
|
527
|
-
_response_json = _response.json()
|
528
|
-
except JSONDecodeError:
|
529
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
530
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
321
|
+
return _response.data
|
531
322
|
|
532
323
|
|
533
324
|
class AsyncToolsClient:
|
534
325
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
535
|
-
self.
|
536
|
-
self.calendar = AsyncCalendarClient(client_wrapper=
|
537
|
-
|
538
|
-
self.
|
539
|
-
|
326
|
+
self._raw_client = AsyncRawToolsClient(client_wrapper=client_wrapper)
|
327
|
+
self.calendar = AsyncCalendarClient(client_wrapper=client_wrapper)
|
328
|
+
|
329
|
+
self.email = AsyncEmailClient(client_wrapper=client_wrapper)
|
330
|
+
|
331
|
+
self.structured_data_extractor = AsyncStructuredDataExtractorClient(client_wrapper=client_wrapper)
|
332
|
+
|
333
|
+
self.tasks = AsyncTasksClient(client_wrapper=client_wrapper)
|
334
|
+
|
335
|
+
@property
|
336
|
+
def with_raw_response(self) -> AsyncRawToolsClient:
|
337
|
+
"""
|
338
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
339
|
+
|
340
|
+
Returns
|
341
|
+
-------
|
342
|
+
AsyncRawToolsClient
|
343
|
+
"""
|
344
|
+
return self._raw_client
|
540
345
|
|
541
346
|
async def get_asset_chunks(
|
542
347
|
self, *, asset_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
|
@@ -579,75 +384,113 @@ class AsyncToolsClient:
|
|
579
384
|
|
580
385
|
asyncio.run(main())
|
581
386
|
"""
|
582
|
-
_response = await self.
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
387
|
+
_response = await self._raw_client.get_asset_chunks(asset_ids=asset_ids, request_options=request_options)
|
388
|
+
return _response.data
|
389
|
+
|
390
|
+
async def get_asset_content(
|
391
|
+
self, *, asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
392
|
+
) -> AssetContentRequestOut:
|
393
|
+
"""
|
394
|
+
Get the content of an asset.
|
395
|
+
|
396
|
+
Parameters
|
397
|
+
----------
|
398
|
+
asset_id : str
|
399
|
+
|
400
|
+
request_options : typing.Optional[RequestOptions]
|
401
|
+
Request-specific configuration.
|
402
|
+
|
403
|
+
Returns
|
404
|
+
-------
|
405
|
+
AssetContentRequestOut
|
406
|
+
Successful Response
|
407
|
+
|
408
|
+
Examples
|
409
|
+
--------
|
410
|
+
import asyncio
|
411
|
+
|
412
|
+
from athena import AsyncAthena
|
413
|
+
|
414
|
+
client = AsyncAthena(
|
415
|
+
api_key="YOUR_API_KEY",
|
416
|
+
)
|
417
|
+
|
418
|
+
|
419
|
+
async def main() -> None:
|
420
|
+
await client.tools.get_asset_content(
|
421
|
+
asset_id="asset_id",
|
422
|
+
)
|
423
|
+
|
424
|
+
|
425
|
+
asyncio.run(main())
|
426
|
+
"""
|
427
|
+
_response = await self._raw_client.get_asset_content(asset_id=asset_id, request_options=request_options)
|
428
|
+
return _response.data
|
429
|
+
|
430
|
+
async def get_asset_screenshot(
|
431
|
+
self,
|
432
|
+
*,
|
433
|
+
asset_id: str,
|
434
|
+
page_number: typing.Optional[int] = None,
|
435
|
+
request_options: typing.Optional[RequestOptions] = None,
|
436
|
+
) -> AssetScreenshotResponseOut:
|
437
|
+
"""
|
438
|
+
Get a screenshot of a specific page from an asset.
|
439
|
+
|
440
|
+
Parameters
|
441
|
+
----------
|
442
|
+
asset_id : str
|
443
|
+
|
444
|
+
page_number : typing.Optional[int]
|
445
|
+
|
446
|
+
request_options : typing.Optional[RequestOptions]
|
447
|
+
Request-specific configuration.
|
448
|
+
|
449
|
+
Returns
|
450
|
+
-------
|
451
|
+
AssetScreenshotResponseOut
|
452
|
+
Successful Response
|
453
|
+
|
454
|
+
Examples
|
455
|
+
--------
|
456
|
+
import asyncio
|
457
|
+
|
458
|
+
from athena import AsyncAthena
|
459
|
+
|
460
|
+
client = AsyncAthena(
|
461
|
+
api_key="YOUR_API_KEY",
|
462
|
+
)
|
463
|
+
|
464
|
+
|
465
|
+
async def main() -> None:
|
466
|
+
await client.tools.get_asset_screenshot(
|
467
|
+
asset_id="asset_id",
|
468
|
+
)
|
469
|
+
|
470
|
+
|
471
|
+
asyncio.run(main())
|
472
|
+
"""
|
473
|
+
_response = await self._raw_client.get_asset_screenshot(
|
474
|
+
asset_id=asset_id, page_number=page_number, request_options=request_options
|
593
475
|
)
|
594
|
-
|
595
|
-
if 200 <= _response.status_code < 300:
|
596
|
-
return typing.cast(
|
597
|
-
FileChunkRequestOut,
|
598
|
-
parse_obj_as(
|
599
|
-
type_=FileChunkRequestOut, # type: ignore
|
600
|
-
object_=_response.json(),
|
601
|
-
),
|
602
|
-
)
|
603
|
-
if _response.status_code == 401:
|
604
|
-
raise UnauthorizedError(
|
605
|
-
typing.cast(
|
606
|
-
typing.Optional[typing.Any],
|
607
|
-
parse_obj_as(
|
608
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
609
|
-
object_=_response.json(),
|
610
|
-
),
|
611
|
-
)
|
612
|
-
)
|
613
|
-
if _response.status_code == 404:
|
614
|
-
raise NotFoundError(
|
615
|
-
typing.cast(
|
616
|
-
AssetNotFoundError,
|
617
|
-
parse_obj_as(
|
618
|
-
type_=AssetNotFoundError, # type: ignore
|
619
|
-
object_=_response.json(),
|
620
|
-
),
|
621
|
-
)
|
622
|
-
)
|
623
|
-
if _response.status_code == 422:
|
624
|
-
raise UnprocessableEntityError(
|
625
|
-
typing.cast(
|
626
|
-
typing.Optional[typing.Any],
|
627
|
-
parse_obj_as(
|
628
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
629
|
-
object_=_response.json(),
|
630
|
-
),
|
631
|
-
)
|
632
|
-
)
|
633
|
-
_response_json = _response.json()
|
634
|
-
except JSONDecodeError:
|
635
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
636
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
476
|
+
return _response.data
|
637
477
|
|
638
478
|
async def list_contents(
|
639
479
|
self,
|
640
480
|
*,
|
481
|
+
asset_id: typing.Optional[str] = None,
|
641
482
|
folder_id: typing.Optional[str] = None,
|
642
483
|
include_asset_details: typing.Optional[bool] = None,
|
643
484
|
include_system_files: typing.Optional[bool] = None,
|
644
485
|
request_options: typing.Optional[RequestOptions] = None,
|
645
486
|
) -> FolderResponse:
|
646
487
|
"""
|
647
|
-
List contents of
|
488
|
+
List contents of an asset (Folder, Collection, Project) or entire workspace in a tree structure.
|
648
489
|
|
649
490
|
Parameters
|
650
491
|
----------
|
492
|
+
asset_id : typing.Optional[str]
|
493
|
+
|
651
494
|
folder_id : typing.Optional[str]
|
652
495
|
|
653
496
|
include_asset_details : typing.Optional[bool]
|
@@ -679,69 +522,14 @@ class AsyncToolsClient:
|
|
679
522
|
|
680
523
|
asyncio.run(main())
|
681
524
|
"""
|
682
|
-
_response = await self.
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
"include_asset_details": include_asset_details,
|
688
|
-
"include_system_files": include_system_files,
|
689
|
-
},
|
525
|
+
_response = await self._raw_client.list_contents(
|
526
|
+
asset_id=asset_id,
|
527
|
+
folder_id=folder_id,
|
528
|
+
include_asset_details=include_asset_details,
|
529
|
+
include_system_files=include_system_files,
|
690
530
|
request_options=request_options,
|
691
531
|
)
|
692
|
-
|
693
|
-
if 200 <= _response.status_code < 300:
|
694
|
-
return typing.cast(
|
695
|
-
FolderResponse,
|
696
|
-
parse_obj_as(
|
697
|
-
type_=FolderResponse, # type: ignore
|
698
|
-
object_=_response.json(),
|
699
|
-
),
|
700
|
-
)
|
701
|
-
if _response.status_code == 400:
|
702
|
-
raise BadRequestError(
|
703
|
-
typing.cast(
|
704
|
-
ParentFolderError,
|
705
|
-
parse_obj_as(
|
706
|
-
type_=ParentFolderError, # type: ignore
|
707
|
-
object_=_response.json(),
|
708
|
-
),
|
709
|
-
)
|
710
|
-
)
|
711
|
-
if _response.status_code == 401:
|
712
|
-
raise UnauthorizedError(
|
713
|
-
typing.cast(
|
714
|
-
typing.Optional[typing.Any],
|
715
|
-
parse_obj_as(
|
716
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
717
|
-
object_=_response.json(),
|
718
|
-
),
|
719
|
-
)
|
720
|
-
)
|
721
|
-
if _response.status_code == 404:
|
722
|
-
raise NotFoundError(
|
723
|
-
typing.cast(
|
724
|
-
AssetNotFoundError,
|
725
|
-
parse_obj_as(
|
726
|
-
type_=AssetNotFoundError, # type: ignore
|
727
|
-
object_=_response.json(),
|
728
|
-
),
|
729
|
-
)
|
730
|
-
)
|
731
|
-
if _response.status_code == 422:
|
732
|
-
raise UnprocessableEntityError(
|
733
|
-
typing.cast(
|
734
|
-
typing.Optional[typing.Any],
|
735
|
-
parse_obj_as(
|
736
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
737
|
-
object_=_response.json(),
|
738
|
-
),
|
739
|
-
)
|
740
|
-
)
|
741
|
-
_response_json = _response.json()
|
742
|
-
except JSONDecodeError:
|
743
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
744
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
532
|
+
return _response.data
|
745
533
|
|
746
534
|
async def data_frame(
|
747
535
|
self,
|
@@ -752,7 +540,7 @@ class AsyncToolsClient:
|
|
752
540
|
columns: typing.Optional[
|
753
541
|
typing.Union[ToolsDataFrameRequestColumnsItem, typing.Sequence[ToolsDataFrameRequestColumnsItem]]
|
754
542
|
] = None,
|
755
|
-
sheet_name: typing.Optional[
|
543
|
+
sheet_name: typing.Optional[str] = None,
|
756
544
|
separator: typing.Optional[str] = None,
|
757
545
|
request_options: typing.Optional[RequestOptions] = None,
|
758
546
|
) -> DataFrameRequestOut:
|
@@ -768,7 +556,7 @@ class AsyncToolsClient:
|
|
768
556
|
columns : typing.Optional[typing.Union[ToolsDataFrameRequestColumnsItem, typing.Sequence[ToolsDataFrameRequestColumnsItem]]]
|
769
557
|
should be a list of strings or a list of integers
|
770
558
|
|
771
|
-
sheet_name : typing.Optional[
|
559
|
+
sheet_name : typing.Optional[str]
|
772
560
|
only for excel files
|
773
561
|
|
774
562
|
separator : typing.Optional[str]
|
@@ -801,82 +589,16 @@ class AsyncToolsClient:
|
|
801
589
|
|
802
590
|
asyncio.run(main())
|
803
591
|
"""
|
804
|
-
_response = await self.
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
"columns": columns,
|
812
|
-
"sheet_name": sheet_name,
|
813
|
-
"separator": separator,
|
814
|
-
},
|
592
|
+
_response = await self._raw_client.data_frame(
|
593
|
+
asset_id=asset_id,
|
594
|
+
row_limit=row_limit,
|
595
|
+
index_column=index_column,
|
596
|
+
columns=columns,
|
597
|
+
sheet_name=sheet_name,
|
598
|
+
separator=separator,
|
815
599
|
request_options=request_options,
|
816
600
|
)
|
817
|
-
|
818
|
-
if 200 <= _response.status_code < 300:
|
819
|
-
return typing.cast(
|
820
|
-
DataFrameRequestOut,
|
821
|
-
parse_obj_as(
|
822
|
-
type_=DataFrameRequestOut, # type: ignore
|
823
|
-
object_=_response.json(),
|
824
|
-
),
|
825
|
-
)
|
826
|
-
if _response.status_code == 401:
|
827
|
-
raise UnauthorizedError(
|
828
|
-
typing.cast(
|
829
|
-
typing.Optional[typing.Any],
|
830
|
-
parse_obj_as(
|
831
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
832
|
-
object_=_response.json(),
|
833
|
-
),
|
834
|
-
)
|
835
|
-
)
|
836
|
-
if _response.status_code == 404:
|
837
|
-
raise NotFoundError(
|
838
|
-
typing.cast(
|
839
|
-
AssetNotFoundError,
|
840
|
-
parse_obj_as(
|
841
|
-
type_=AssetNotFoundError, # type: ignore
|
842
|
-
object_=_response.json(),
|
843
|
-
),
|
844
|
-
)
|
845
|
-
)
|
846
|
-
if _response.status_code == 415:
|
847
|
-
raise UnsupportedMediaTypeError(
|
848
|
-
typing.cast(
|
849
|
-
DataFrameUnknownFormatError,
|
850
|
-
parse_obj_as(
|
851
|
-
type_=DataFrameUnknownFormatError, # type: ignore
|
852
|
-
object_=_response.json(),
|
853
|
-
),
|
854
|
-
)
|
855
|
-
)
|
856
|
-
if _response.status_code == 422:
|
857
|
-
raise UnprocessableEntityError(
|
858
|
-
typing.cast(
|
859
|
-
typing.Optional[typing.Any],
|
860
|
-
parse_obj_as(
|
861
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
862
|
-
object_=_response.json(),
|
863
|
-
),
|
864
|
-
)
|
865
|
-
)
|
866
|
-
if _response.status_code == 500:
|
867
|
-
raise InternalServerError(
|
868
|
-
typing.cast(
|
869
|
-
typing.Optional[typing.Any],
|
870
|
-
parse_obj_as(
|
871
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
872
|
-
object_=_response.json(),
|
873
|
-
),
|
874
|
-
)
|
875
|
-
)
|
876
|
-
_response_json = _response.json()
|
877
|
-
except JSONDecodeError:
|
878
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
879
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
601
|
+
return _response.data
|
880
602
|
|
881
603
|
async def raw_data(
|
882
604
|
self, *, asset_id: str, request_options: typing.Optional[RequestOptions] = None
|
@@ -891,70 +613,14 @@ class AsyncToolsClient:
|
|
891
613
|
request_options : typing.Optional[RequestOptions]
|
892
614
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
893
615
|
|
894
|
-
|
895
|
-
|
616
|
+
Returns
|
617
|
+
-------
|
896
618
|
typing.AsyncIterator[bytes]
|
897
619
|
Stream the file in original format.
|
898
620
|
"""
|
899
|
-
async with self.
|
900
|
-
|
901
|
-
|
902
|
-
params={
|
903
|
-
"asset_id": asset_id,
|
904
|
-
},
|
905
|
-
request_options=request_options,
|
906
|
-
) as _response:
|
907
|
-
try:
|
908
|
-
if 200 <= _response.status_code < 300:
|
909
|
-
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
|
910
|
-
async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size):
|
911
|
-
yield _chunk
|
912
|
-
return
|
913
|
-
await _response.aread()
|
914
|
-
if _response.status_code == 401:
|
915
|
-
raise UnauthorizedError(
|
916
|
-
typing.cast(
|
917
|
-
typing.Optional[typing.Any],
|
918
|
-
parse_obj_as(
|
919
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
920
|
-
object_=_response.json(),
|
921
|
-
),
|
922
|
-
)
|
923
|
-
)
|
924
|
-
if _response.status_code == 404:
|
925
|
-
raise NotFoundError(
|
926
|
-
typing.cast(
|
927
|
-
AssetNotFoundError,
|
928
|
-
parse_obj_as(
|
929
|
-
type_=AssetNotFoundError, # type: ignore
|
930
|
-
object_=_response.json(),
|
931
|
-
),
|
932
|
-
)
|
933
|
-
)
|
934
|
-
if _response.status_code == 422:
|
935
|
-
raise UnprocessableEntityError(
|
936
|
-
typing.cast(
|
937
|
-
typing.Optional[typing.Any],
|
938
|
-
parse_obj_as(
|
939
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
940
|
-
object_=_response.json(),
|
941
|
-
),
|
942
|
-
)
|
943
|
-
)
|
944
|
-
if _response.status_code == 500:
|
945
|
-
raise InternalServerError(
|
946
|
-
typing.cast(
|
947
|
-
typing.Optional[typing.Any],
|
948
|
-
parse_obj_as(
|
949
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
950
|
-
object_=_response.json(),
|
951
|
-
),
|
952
|
-
)
|
953
|
-
)
|
954
|
-
_response_json = _response.json()
|
955
|
-
except JSONDecodeError:
|
956
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
957
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
621
|
+
async with self._raw_client.raw_data(asset_id=asset_id, request_options=request_options) as r:
|
622
|
+
async for _chunk in r.data:
|
623
|
+
yield _chunk
|
958
624
|
|
959
625
|
async def save_asset(
|
960
626
|
self,
|
@@ -997,59 +663,7 @@ class AsyncToolsClient:
|
|
997
663
|
|
998
664
|
asyncio.run(main())
|
999
665
|
"""
|
1000
|
-
_response = await self.
|
1001
|
-
|
1002
|
-
method="POST",
|
1003
|
-
params={
|
1004
|
-
"parent_folder_id": parent_folder_id,
|
1005
|
-
},
|
1006
|
-
data={},
|
1007
|
-
files={
|
1008
|
-
"file": file,
|
1009
|
-
},
|
1010
|
-
request_options=request_options,
|
1011
|
-
omit=OMIT,
|
666
|
+
_response = await self._raw_client.save_asset(
|
667
|
+
file=file, parent_folder_id=parent_folder_id, request_options=request_options
|
1012
668
|
)
|
1013
|
-
|
1014
|
-
if 200 <= _response.status_code < 300:
|
1015
|
-
return typing.cast(
|
1016
|
-
SaveAssetRequestOut,
|
1017
|
-
parse_obj_as(
|
1018
|
-
type_=SaveAssetRequestOut, # type: ignore
|
1019
|
-
object_=_response.json(),
|
1020
|
-
),
|
1021
|
-
)
|
1022
|
-
if _response.status_code == 400:
|
1023
|
-
raise BadRequestError(
|
1024
|
-
typing.cast(
|
1025
|
-
ParentFolderError,
|
1026
|
-
parse_obj_as(
|
1027
|
-
type_=ParentFolderError, # type: ignore
|
1028
|
-
object_=_response.json(),
|
1029
|
-
),
|
1030
|
-
)
|
1031
|
-
)
|
1032
|
-
if _response.status_code == 413:
|
1033
|
-
raise ContentTooLargeError(
|
1034
|
-
typing.cast(
|
1035
|
-
FileTooLargeError,
|
1036
|
-
parse_obj_as(
|
1037
|
-
type_=FileTooLargeError, # type: ignore
|
1038
|
-
object_=_response.json(),
|
1039
|
-
),
|
1040
|
-
)
|
1041
|
-
)
|
1042
|
-
if _response.status_code == 422:
|
1043
|
-
raise UnprocessableEntityError(
|
1044
|
-
typing.cast(
|
1045
|
-
typing.Optional[typing.Any],
|
1046
|
-
parse_obj_as(
|
1047
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
1048
|
-
object_=_response.json(),
|
1049
|
-
),
|
1050
|
-
)
|
1051
|
-
)
|
1052
|
-
_response_json = _response.json()
|
1053
|
-
except JSONDecodeError:
|
1054
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
1055
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
669
|
+
return _response.data
|