mistralai 1.9.1__py3-none-any.whl → 1.9.2__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.
- mistralai/_version.py +2 -2
- mistralai/accesses.py +672 -0
- mistralai/beta.py +4 -0
- mistralai/documents.py +2136 -0
- mistralai/files.py +2 -2
- mistralai/libraries.py +1041 -0
- mistralai/models/__init__.py +232 -8
- mistralai/models/basemodelcard.py +5 -2
- mistralai/models/conversationevents.py +6 -0
- mistralai/models/conversationhistory.py +4 -4
- mistralai/models/documentout.py +105 -0
- mistralai/models/documenttextcontent.py +13 -0
- mistralai/models/documentupdatein.py +44 -0
- mistralai/models/entitytype.py +9 -0
- mistralai/models/file.py +33 -0
- mistralai/models/files_api_routes_upload_fileop.py +2 -27
- mistralai/models/ftmodelcard.py +5 -3
- mistralai/models/inputentries.py +4 -4
- mistralai/models/libraries_delete_v1op.py +16 -0
- mistralai/models/libraries_documents_delete_v1op.py +21 -0
- mistralai/models/libraries_documents_get_extracted_text_signed_url_v1op.py +21 -0
- mistralai/models/libraries_documents_get_signed_url_v1op.py +21 -0
- mistralai/models/libraries_documents_get_status_v1op.py +21 -0
- mistralai/models/libraries_documents_get_text_content_v1op.py +21 -0
- mistralai/models/libraries_documents_get_v1op.py +21 -0
- mistralai/models/libraries_documents_list_v1op.py +78 -0
- mistralai/models/libraries_documents_reprocess_v1op.py +21 -0
- mistralai/models/libraries_documents_update_v1op.py +28 -0
- mistralai/models/libraries_documents_upload_v1op.py +56 -0
- mistralai/models/libraries_get_v1op.py +16 -0
- mistralai/models/libraries_share_create_v1op.py +22 -0
- mistralai/models/libraries_share_delete_v1op.py +23 -0
- mistralai/models/libraries_share_list_v1op.py +16 -0
- mistralai/models/libraries_update_v1op.py +23 -0
- mistralai/models/libraryin.py +50 -0
- mistralai/models/libraryinupdate.py +47 -0
- mistralai/models/libraryout.py +107 -0
- mistralai/models/listdocumentout.py +19 -0
- mistralai/models/listlibraryout.py +15 -0
- mistralai/models/listsharingout.py +15 -0
- mistralai/models/messageinputentry.py +14 -4
- mistralai/models/paginationinfo.py +25 -0
- mistralai/models/processingstatusout.py +16 -0
- mistralai/models/shareenum.py +8 -0
- mistralai/models/sharingdelete.py +26 -0
- mistralai/models/sharingin.py +30 -0
- mistralai/models/sharingout.py +59 -0
- mistralai/models/ssetypes.py +1 -0
- mistralai/models/toolexecutiondeltaevent.py +34 -0
- mistralai/models/toolexecutionentry.py +3 -0
- mistralai/models/toolexecutionstartedevent.py +3 -0
- mistralai/models/toolreferencechunk.py +7 -4
- {mistralai-1.9.1.dist-info → mistralai-1.9.2.dist-info}/METADATA +29 -2
- {mistralai-1.9.1.dist-info → mistralai-1.9.2.dist-info}/RECORD +56 -19
- {mistralai-1.9.1.dist-info → mistralai-1.9.2.dist-info}/LICENSE +0 -0
- {mistralai-1.9.1.dist-info → mistralai-1.9.2.dist-info}/WHEEL +0 -0
mistralai/libraries.py
ADDED
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from .sdkconfiguration import SDKConfiguration
|
|
5
|
+
from mistralai import models, utils
|
|
6
|
+
from mistralai._hooks import HookContext
|
|
7
|
+
from mistralai.accesses import Accesses
|
|
8
|
+
from mistralai.documents import Documents
|
|
9
|
+
from mistralai.types import OptionalNullable, UNSET
|
|
10
|
+
from mistralai.utils import get_security_from_env
|
|
11
|
+
from typing import Any, Mapping, Optional
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Libraries(BaseSDK):
|
|
15
|
+
r"""(beta) Libraries API for indexing documents to enhance agent capabilities."""
|
|
16
|
+
|
|
17
|
+
documents: Documents
|
|
18
|
+
accesses: Accesses
|
|
19
|
+
|
|
20
|
+
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
21
|
+
BaseSDK.__init__(self, sdk_config)
|
|
22
|
+
self.sdk_configuration = sdk_config
|
|
23
|
+
self._init_sdks()
|
|
24
|
+
|
|
25
|
+
def _init_sdks(self):
|
|
26
|
+
self.documents = Documents(self.sdk_configuration)
|
|
27
|
+
self.accesses = Accesses(self.sdk_configuration)
|
|
28
|
+
|
|
29
|
+
def list(
|
|
30
|
+
self,
|
|
31
|
+
*,
|
|
32
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
33
|
+
server_url: Optional[str] = None,
|
|
34
|
+
timeout_ms: Optional[int] = None,
|
|
35
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
36
|
+
) -> models.ListLibraryOut:
|
|
37
|
+
r"""List all libraries you have access to.
|
|
38
|
+
|
|
39
|
+
List all libraries that you have created or have been shared with you.
|
|
40
|
+
|
|
41
|
+
:param retries: Override the default retry configuration for this method
|
|
42
|
+
:param server_url: Override the default server URL for this method
|
|
43
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
44
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
45
|
+
"""
|
|
46
|
+
base_url = None
|
|
47
|
+
url_variables = None
|
|
48
|
+
if timeout_ms is None:
|
|
49
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
+
|
|
51
|
+
if server_url is not None:
|
|
52
|
+
base_url = server_url
|
|
53
|
+
else:
|
|
54
|
+
base_url = self._get_url(base_url, url_variables)
|
|
55
|
+
req = self._build_request(
|
|
56
|
+
method="GET",
|
|
57
|
+
path="/v1/libraries",
|
|
58
|
+
base_url=base_url,
|
|
59
|
+
url_variables=url_variables,
|
|
60
|
+
request=None,
|
|
61
|
+
request_body_required=False,
|
|
62
|
+
request_has_path_params=False,
|
|
63
|
+
request_has_query_params=True,
|
|
64
|
+
user_agent_header="user-agent",
|
|
65
|
+
accept_header_value="application/json",
|
|
66
|
+
http_headers=http_headers,
|
|
67
|
+
security=self.sdk_configuration.security,
|
|
68
|
+
timeout_ms=timeout_ms,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
if retries == UNSET:
|
|
72
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
73
|
+
retries = self.sdk_configuration.retry_config
|
|
74
|
+
|
|
75
|
+
retry_config = None
|
|
76
|
+
if isinstance(retries, utils.RetryConfig):
|
|
77
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
78
|
+
|
|
79
|
+
http_res = self.do_request(
|
|
80
|
+
hook_ctx=HookContext(
|
|
81
|
+
config=self.sdk_configuration,
|
|
82
|
+
base_url=base_url or "",
|
|
83
|
+
operation_id="libraries_list_v1",
|
|
84
|
+
oauth2_scopes=[],
|
|
85
|
+
security_source=get_security_from_env(
|
|
86
|
+
self.sdk_configuration.security, models.Security
|
|
87
|
+
),
|
|
88
|
+
),
|
|
89
|
+
request=req,
|
|
90
|
+
error_status_codes=["4XX", "5XX"],
|
|
91
|
+
retry_config=retry_config,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
95
|
+
return utils.unmarshal_json(http_res.text, models.ListLibraryOut)
|
|
96
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
97
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
98
|
+
raise models.SDKError(
|
|
99
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
100
|
+
)
|
|
101
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
102
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
103
|
+
raise models.SDKError(
|
|
104
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
content_type = http_res.headers.get("Content-Type")
|
|
108
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
109
|
+
raise models.SDKError(
|
|
110
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
111
|
+
http_res.status_code,
|
|
112
|
+
http_res_text,
|
|
113
|
+
http_res,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
async def list_async(
|
|
117
|
+
self,
|
|
118
|
+
*,
|
|
119
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
120
|
+
server_url: Optional[str] = None,
|
|
121
|
+
timeout_ms: Optional[int] = None,
|
|
122
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
123
|
+
) -> models.ListLibraryOut:
|
|
124
|
+
r"""List all libraries you have access to.
|
|
125
|
+
|
|
126
|
+
List all libraries that you have created or have been shared with you.
|
|
127
|
+
|
|
128
|
+
:param retries: Override the default retry configuration for this method
|
|
129
|
+
:param server_url: Override the default server URL for this method
|
|
130
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
131
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
132
|
+
"""
|
|
133
|
+
base_url = None
|
|
134
|
+
url_variables = None
|
|
135
|
+
if timeout_ms is None:
|
|
136
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
137
|
+
|
|
138
|
+
if server_url is not None:
|
|
139
|
+
base_url = server_url
|
|
140
|
+
else:
|
|
141
|
+
base_url = self._get_url(base_url, url_variables)
|
|
142
|
+
req = self._build_request_async(
|
|
143
|
+
method="GET",
|
|
144
|
+
path="/v1/libraries",
|
|
145
|
+
base_url=base_url,
|
|
146
|
+
url_variables=url_variables,
|
|
147
|
+
request=None,
|
|
148
|
+
request_body_required=False,
|
|
149
|
+
request_has_path_params=False,
|
|
150
|
+
request_has_query_params=True,
|
|
151
|
+
user_agent_header="user-agent",
|
|
152
|
+
accept_header_value="application/json",
|
|
153
|
+
http_headers=http_headers,
|
|
154
|
+
security=self.sdk_configuration.security,
|
|
155
|
+
timeout_ms=timeout_ms,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
if retries == UNSET:
|
|
159
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
160
|
+
retries = self.sdk_configuration.retry_config
|
|
161
|
+
|
|
162
|
+
retry_config = None
|
|
163
|
+
if isinstance(retries, utils.RetryConfig):
|
|
164
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
165
|
+
|
|
166
|
+
http_res = await self.do_request_async(
|
|
167
|
+
hook_ctx=HookContext(
|
|
168
|
+
config=self.sdk_configuration,
|
|
169
|
+
base_url=base_url or "",
|
|
170
|
+
operation_id="libraries_list_v1",
|
|
171
|
+
oauth2_scopes=[],
|
|
172
|
+
security_source=get_security_from_env(
|
|
173
|
+
self.sdk_configuration.security, models.Security
|
|
174
|
+
),
|
|
175
|
+
),
|
|
176
|
+
request=req,
|
|
177
|
+
error_status_codes=["4XX", "5XX"],
|
|
178
|
+
retry_config=retry_config,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
182
|
+
return utils.unmarshal_json(http_res.text, models.ListLibraryOut)
|
|
183
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
184
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
185
|
+
raise models.SDKError(
|
|
186
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
187
|
+
)
|
|
188
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
189
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
190
|
+
raise models.SDKError(
|
|
191
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
content_type = http_res.headers.get("Content-Type")
|
|
195
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
196
|
+
raise models.SDKError(
|
|
197
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
198
|
+
http_res.status_code,
|
|
199
|
+
http_res_text,
|
|
200
|
+
http_res,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
def create(
|
|
204
|
+
self,
|
|
205
|
+
*,
|
|
206
|
+
name: str,
|
|
207
|
+
description: OptionalNullable[str] = UNSET,
|
|
208
|
+
chunk_size: OptionalNullable[int] = UNSET,
|
|
209
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
210
|
+
server_url: Optional[str] = None,
|
|
211
|
+
timeout_ms: Optional[int] = None,
|
|
212
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
213
|
+
) -> models.LibraryOut:
|
|
214
|
+
r"""Create a new Library.
|
|
215
|
+
|
|
216
|
+
Create a new Library, you will be marked as the owner and only you will have the possibility to share it with others. When first created this will only be accessible by you.
|
|
217
|
+
|
|
218
|
+
:param name:
|
|
219
|
+
:param description:
|
|
220
|
+
:param chunk_size:
|
|
221
|
+
:param retries: Override the default retry configuration for this method
|
|
222
|
+
:param server_url: Override the default server URL for this method
|
|
223
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
224
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
225
|
+
"""
|
|
226
|
+
base_url = None
|
|
227
|
+
url_variables = None
|
|
228
|
+
if timeout_ms is None:
|
|
229
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
230
|
+
|
|
231
|
+
if server_url is not None:
|
|
232
|
+
base_url = server_url
|
|
233
|
+
else:
|
|
234
|
+
base_url = self._get_url(base_url, url_variables)
|
|
235
|
+
|
|
236
|
+
request = models.LibraryIn(
|
|
237
|
+
name=name,
|
|
238
|
+
description=description,
|
|
239
|
+
chunk_size=chunk_size,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
req = self._build_request(
|
|
243
|
+
method="POST",
|
|
244
|
+
path="/v1/libraries",
|
|
245
|
+
base_url=base_url,
|
|
246
|
+
url_variables=url_variables,
|
|
247
|
+
request=request,
|
|
248
|
+
request_body_required=True,
|
|
249
|
+
request_has_path_params=False,
|
|
250
|
+
request_has_query_params=True,
|
|
251
|
+
user_agent_header="user-agent",
|
|
252
|
+
accept_header_value="application/json",
|
|
253
|
+
http_headers=http_headers,
|
|
254
|
+
security=self.sdk_configuration.security,
|
|
255
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
256
|
+
request, False, False, "json", models.LibraryIn
|
|
257
|
+
),
|
|
258
|
+
timeout_ms=timeout_ms,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
if retries == UNSET:
|
|
262
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
263
|
+
retries = self.sdk_configuration.retry_config
|
|
264
|
+
|
|
265
|
+
retry_config = None
|
|
266
|
+
if isinstance(retries, utils.RetryConfig):
|
|
267
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
268
|
+
|
|
269
|
+
http_res = self.do_request(
|
|
270
|
+
hook_ctx=HookContext(
|
|
271
|
+
config=self.sdk_configuration,
|
|
272
|
+
base_url=base_url or "",
|
|
273
|
+
operation_id="libraries_create_v1",
|
|
274
|
+
oauth2_scopes=[],
|
|
275
|
+
security_source=get_security_from_env(
|
|
276
|
+
self.sdk_configuration.security, models.Security
|
|
277
|
+
),
|
|
278
|
+
),
|
|
279
|
+
request=req,
|
|
280
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
281
|
+
retry_config=retry_config,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
response_data: Any = None
|
|
285
|
+
if utils.match_response(http_res, "201", "application/json"):
|
|
286
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
287
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
288
|
+
response_data = utils.unmarshal_json(
|
|
289
|
+
http_res.text, models.HTTPValidationErrorData
|
|
290
|
+
)
|
|
291
|
+
raise models.HTTPValidationError(data=response_data)
|
|
292
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
293
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
294
|
+
raise models.SDKError(
|
|
295
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
296
|
+
)
|
|
297
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
298
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
299
|
+
raise models.SDKError(
|
|
300
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
content_type = http_res.headers.get("Content-Type")
|
|
304
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
305
|
+
raise models.SDKError(
|
|
306
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
307
|
+
http_res.status_code,
|
|
308
|
+
http_res_text,
|
|
309
|
+
http_res,
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
async def create_async(
|
|
313
|
+
self,
|
|
314
|
+
*,
|
|
315
|
+
name: str,
|
|
316
|
+
description: OptionalNullable[str] = UNSET,
|
|
317
|
+
chunk_size: OptionalNullable[int] = UNSET,
|
|
318
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
319
|
+
server_url: Optional[str] = None,
|
|
320
|
+
timeout_ms: Optional[int] = None,
|
|
321
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
322
|
+
) -> models.LibraryOut:
|
|
323
|
+
r"""Create a new Library.
|
|
324
|
+
|
|
325
|
+
Create a new Library, you will be marked as the owner and only you will have the possibility to share it with others. When first created this will only be accessible by you.
|
|
326
|
+
|
|
327
|
+
:param name:
|
|
328
|
+
:param description:
|
|
329
|
+
:param chunk_size:
|
|
330
|
+
:param retries: Override the default retry configuration for this method
|
|
331
|
+
:param server_url: Override the default server URL for this method
|
|
332
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
333
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
334
|
+
"""
|
|
335
|
+
base_url = None
|
|
336
|
+
url_variables = None
|
|
337
|
+
if timeout_ms is None:
|
|
338
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
339
|
+
|
|
340
|
+
if server_url is not None:
|
|
341
|
+
base_url = server_url
|
|
342
|
+
else:
|
|
343
|
+
base_url = self._get_url(base_url, url_variables)
|
|
344
|
+
|
|
345
|
+
request = models.LibraryIn(
|
|
346
|
+
name=name,
|
|
347
|
+
description=description,
|
|
348
|
+
chunk_size=chunk_size,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
req = self._build_request_async(
|
|
352
|
+
method="POST",
|
|
353
|
+
path="/v1/libraries",
|
|
354
|
+
base_url=base_url,
|
|
355
|
+
url_variables=url_variables,
|
|
356
|
+
request=request,
|
|
357
|
+
request_body_required=True,
|
|
358
|
+
request_has_path_params=False,
|
|
359
|
+
request_has_query_params=True,
|
|
360
|
+
user_agent_header="user-agent",
|
|
361
|
+
accept_header_value="application/json",
|
|
362
|
+
http_headers=http_headers,
|
|
363
|
+
security=self.sdk_configuration.security,
|
|
364
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
365
|
+
request, False, False, "json", models.LibraryIn
|
|
366
|
+
),
|
|
367
|
+
timeout_ms=timeout_ms,
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
if retries == UNSET:
|
|
371
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
372
|
+
retries = self.sdk_configuration.retry_config
|
|
373
|
+
|
|
374
|
+
retry_config = None
|
|
375
|
+
if isinstance(retries, utils.RetryConfig):
|
|
376
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
377
|
+
|
|
378
|
+
http_res = await self.do_request_async(
|
|
379
|
+
hook_ctx=HookContext(
|
|
380
|
+
config=self.sdk_configuration,
|
|
381
|
+
base_url=base_url or "",
|
|
382
|
+
operation_id="libraries_create_v1",
|
|
383
|
+
oauth2_scopes=[],
|
|
384
|
+
security_source=get_security_from_env(
|
|
385
|
+
self.sdk_configuration.security, models.Security
|
|
386
|
+
),
|
|
387
|
+
),
|
|
388
|
+
request=req,
|
|
389
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
390
|
+
retry_config=retry_config,
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
response_data: Any = None
|
|
394
|
+
if utils.match_response(http_res, "201", "application/json"):
|
|
395
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
396
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
397
|
+
response_data = utils.unmarshal_json(
|
|
398
|
+
http_res.text, models.HTTPValidationErrorData
|
|
399
|
+
)
|
|
400
|
+
raise models.HTTPValidationError(data=response_data)
|
|
401
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
402
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
403
|
+
raise models.SDKError(
|
|
404
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
405
|
+
)
|
|
406
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
407
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
408
|
+
raise models.SDKError(
|
|
409
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
content_type = http_res.headers.get("Content-Type")
|
|
413
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
414
|
+
raise models.SDKError(
|
|
415
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
416
|
+
http_res.status_code,
|
|
417
|
+
http_res_text,
|
|
418
|
+
http_res,
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
def get(
|
|
422
|
+
self,
|
|
423
|
+
*,
|
|
424
|
+
library_id: str,
|
|
425
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
426
|
+
server_url: Optional[str] = None,
|
|
427
|
+
timeout_ms: Optional[int] = None,
|
|
428
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
429
|
+
) -> models.LibraryOut:
|
|
430
|
+
r"""Detailed information about a specific Library.
|
|
431
|
+
|
|
432
|
+
Given a library id, details information about that Library.
|
|
433
|
+
|
|
434
|
+
:param library_id:
|
|
435
|
+
:param retries: Override the default retry configuration for this method
|
|
436
|
+
:param server_url: Override the default server URL for this method
|
|
437
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
438
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
439
|
+
"""
|
|
440
|
+
base_url = None
|
|
441
|
+
url_variables = None
|
|
442
|
+
if timeout_ms is None:
|
|
443
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
444
|
+
|
|
445
|
+
if server_url is not None:
|
|
446
|
+
base_url = server_url
|
|
447
|
+
else:
|
|
448
|
+
base_url = self._get_url(base_url, url_variables)
|
|
449
|
+
|
|
450
|
+
request = models.LibrariesGetV1Request(
|
|
451
|
+
library_id=library_id,
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
req = self._build_request(
|
|
455
|
+
method="GET",
|
|
456
|
+
path="/v1/libraries/{library_id}",
|
|
457
|
+
base_url=base_url,
|
|
458
|
+
url_variables=url_variables,
|
|
459
|
+
request=request,
|
|
460
|
+
request_body_required=False,
|
|
461
|
+
request_has_path_params=True,
|
|
462
|
+
request_has_query_params=True,
|
|
463
|
+
user_agent_header="user-agent",
|
|
464
|
+
accept_header_value="application/json",
|
|
465
|
+
http_headers=http_headers,
|
|
466
|
+
security=self.sdk_configuration.security,
|
|
467
|
+
timeout_ms=timeout_ms,
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
if retries == UNSET:
|
|
471
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
472
|
+
retries = self.sdk_configuration.retry_config
|
|
473
|
+
|
|
474
|
+
retry_config = None
|
|
475
|
+
if isinstance(retries, utils.RetryConfig):
|
|
476
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
477
|
+
|
|
478
|
+
http_res = self.do_request(
|
|
479
|
+
hook_ctx=HookContext(
|
|
480
|
+
config=self.sdk_configuration,
|
|
481
|
+
base_url=base_url or "",
|
|
482
|
+
operation_id="libraries_get_v1",
|
|
483
|
+
oauth2_scopes=[],
|
|
484
|
+
security_source=get_security_from_env(
|
|
485
|
+
self.sdk_configuration.security, models.Security
|
|
486
|
+
),
|
|
487
|
+
),
|
|
488
|
+
request=req,
|
|
489
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
490
|
+
retry_config=retry_config,
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
response_data: Any = None
|
|
494
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
495
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
496
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
497
|
+
response_data = utils.unmarshal_json(
|
|
498
|
+
http_res.text, models.HTTPValidationErrorData
|
|
499
|
+
)
|
|
500
|
+
raise models.HTTPValidationError(data=response_data)
|
|
501
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
502
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
503
|
+
raise models.SDKError(
|
|
504
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
505
|
+
)
|
|
506
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
507
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
508
|
+
raise models.SDKError(
|
|
509
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
content_type = http_res.headers.get("Content-Type")
|
|
513
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
514
|
+
raise models.SDKError(
|
|
515
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
516
|
+
http_res.status_code,
|
|
517
|
+
http_res_text,
|
|
518
|
+
http_res,
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
async def get_async(
|
|
522
|
+
self,
|
|
523
|
+
*,
|
|
524
|
+
library_id: str,
|
|
525
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
526
|
+
server_url: Optional[str] = None,
|
|
527
|
+
timeout_ms: Optional[int] = None,
|
|
528
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
529
|
+
) -> models.LibraryOut:
|
|
530
|
+
r"""Detailed information about a specific Library.
|
|
531
|
+
|
|
532
|
+
Given a library id, details information about that Library.
|
|
533
|
+
|
|
534
|
+
:param library_id:
|
|
535
|
+
:param retries: Override the default retry configuration for this method
|
|
536
|
+
:param server_url: Override the default server URL for this method
|
|
537
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
538
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
539
|
+
"""
|
|
540
|
+
base_url = None
|
|
541
|
+
url_variables = None
|
|
542
|
+
if timeout_ms is None:
|
|
543
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
544
|
+
|
|
545
|
+
if server_url is not None:
|
|
546
|
+
base_url = server_url
|
|
547
|
+
else:
|
|
548
|
+
base_url = self._get_url(base_url, url_variables)
|
|
549
|
+
|
|
550
|
+
request = models.LibrariesGetV1Request(
|
|
551
|
+
library_id=library_id,
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
req = self._build_request_async(
|
|
555
|
+
method="GET",
|
|
556
|
+
path="/v1/libraries/{library_id}",
|
|
557
|
+
base_url=base_url,
|
|
558
|
+
url_variables=url_variables,
|
|
559
|
+
request=request,
|
|
560
|
+
request_body_required=False,
|
|
561
|
+
request_has_path_params=True,
|
|
562
|
+
request_has_query_params=True,
|
|
563
|
+
user_agent_header="user-agent",
|
|
564
|
+
accept_header_value="application/json",
|
|
565
|
+
http_headers=http_headers,
|
|
566
|
+
security=self.sdk_configuration.security,
|
|
567
|
+
timeout_ms=timeout_ms,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
if retries == UNSET:
|
|
571
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
572
|
+
retries = self.sdk_configuration.retry_config
|
|
573
|
+
|
|
574
|
+
retry_config = None
|
|
575
|
+
if isinstance(retries, utils.RetryConfig):
|
|
576
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
577
|
+
|
|
578
|
+
http_res = await self.do_request_async(
|
|
579
|
+
hook_ctx=HookContext(
|
|
580
|
+
config=self.sdk_configuration,
|
|
581
|
+
base_url=base_url or "",
|
|
582
|
+
operation_id="libraries_get_v1",
|
|
583
|
+
oauth2_scopes=[],
|
|
584
|
+
security_source=get_security_from_env(
|
|
585
|
+
self.sdk_configuration.security, models.Security
|
|
586
|
+
),
|
|
587
|
+
),
|
|
588
|
+
request=req,
|
|
589
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
590
|
+
retry_config=retry_config,
|
|
591
|
+
)
|
|
592
|
+
|
|
593
|
+
response_data: Any = None
|
|
594
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
595
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
596
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
597
|
+
response_data = utils.unmarshal_json(
|
|
598
|
+
http_res.text, models.HTTPValidationErrorData
|
|
599
|
+
)
|
|
600
|
+
raise models.HTTPValidationError(data=response_data)
|
|
601
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
602
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
603
|
+
raise models.SDKError(
|
|
604
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
605
|
+
)
|
|
606
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
607
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
608
|
+
raise models.SDKError(
|
|
609
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
content_type = http_res.headers.get("Content-Type")
|
|
613
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
614
|
+
raise models.SDKError(
|
|
615
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
616
|
+
http_res.status_code,
|
|
617
|
+
http_res_text,
|
|
618
|
+
http_res,
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
def delete(
|
|
622
|
+
self,
|
|
623
|
+
*,
|
|
624
|
+
library_id: str,
|
|
625
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
626
|
+
server_url: Optional[str] = None,
|
|
627
|
+
timeout_ms: Optional[int] = None,
|
|
628
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
629
|
+
) -> models.LibraryOut:
|
|
630
|
+
r"""Delete a library and all of it's document.
|
|
631
|
+
|
|
632
|
+
Given a library id, deletes it together with all documents that have been uploaded to that library.
|
|
633
|
+
|
|
634
|
+
:param library_id:
|
|
635
|
+
:param retries: Override the default retry configuration for this method
|
|
636
|
+
:param server_url: Override the default server URL for this method
|
|
637
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
638
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
639
|
+
"""
|
|
640
|
+
base_url = None
|
|
641
|
+
url_variables = None
|
|
642
|
+
if timeout_ms is None:
|
|
643
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
644
|
+
|
|
645
|
+
if server_url is not None:
|
|
646
|
+
base_url = server_url
|
|
647
|
+
else:
|
|
648
|
+
base_url = self._get_url(base_url, url_variables)
|
|
649
|
+
|
|
650
|
+
request = models.LibrariesDeleteV1Request(
|
|
651
|
+
library_id=library_id,
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
req = self._build_request(
|
|
655
|
+
method="DELETE",
|
|
656
|
+
path="/v1/libraries/{library_id}",
|
|
657
|
+
base_url=base_url,
|
|
658
|
+
url_variables=url_variables,
|
|
659
|
+
request=request,
|
|
660
|
+
request_body_required=False,
|
|
661
|
+
request_has_path_params=True,
|
|
662
|
+
request_has_query_params=True,
|
|
663
|
+
user_agent_header="user-agent",
|
|
664
|
+
accept_header_value="application/json",
|
|
665
|
+
http_headers=http_headers,
|
|
666
|
+
security=self.sdk_configuration.security,
|
|
667
|
+
timeout_ms=timeout_ms,
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
if retries == UNSET:
|
|
671
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
672
|
+
retries = self.sdk_configuration.retry_config
|
|
673
|
+
|
|
674
|
+
retry_config = None
|
|
675
|
+
if isinstance(retries, utils.RetryConfig):
|
|
676
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
677
|
+
|
|
678
|
+
http_res = self.do_request(
|
|
679
|
+
hook_ctx=HookContext(
|
|
680
|
+
config=self.sdk_configuration,
|
|
681
|
+
base_url=base_url or "",
|
|
682
|
+
operation_id="libraries_delete_v1",
|
|
683
|
+
oauth2_scopes=[],
|
|
684
|
+
security_source=get_security_from_env(
|
|
685
|
+
self.sdk_configuration.security, models.Security
|
|
686
|
+
),
|
|
687
|
+
),
|
|
688
|
+
request=req,
|
|
689
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
690
|
+
retry_config=retry_config,
|
|
691
|
+
)
|
|
692
|
+
|
|
693
|
+
response_data: Any = None
|
|
694
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
695
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
696
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
697
|
+
response_data = utils.unmarshal_json(
|
|
698
|
+
http_res.text, models.HTTPValidationErrorData
|
|
699
|
+
)
|
|
700
|
+
raise models.HTTPValidationError(data=response_data)
|
|
701
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
702
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
703
|
+
raise models.SDKError(
|
|
704
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
705
|
+
)
|
|
706
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
707
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
708
|
+
raise models.SDKError(
|
|
709
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
710
|
+
)
|
|
711
|
+
|
|
712
|
+
content_type = http_res.headers.get("Content-Type")
|
|
713
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
714
|
+
raise models.SDKError(
|
|
715
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
716
|
+
http_res.status_code,
|
|
717
|
+
http_res_text,
|
|
718
|
+
http_res,
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
async def delete_async(
|
|
722
|
+
self,
|
|
723
|
+
*,
|
|
724
|
+
library_id: str,
|
|
725
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
726
|
+
server_url: Optional[str] = None,
|
|
727
|
+
timeout_ms: Optional[int] = None,
|
|
728
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
729
|
+
) -> models.LibraryOut:
|
|
730
|
+
r"""Delete a library and all of it's document.
|
|
731
|
+
|
|
732
|
+
Given a library id, deletes it together with all documents that have been uploaded to that library.
|
|
733
|
+
|
|
734
|
+
:param library_id:
|
|
735
|
+
:param retries: Override the default retry configuration for this method
|
|
736
|
+
:param server_url: Override the default server URL for this method
|
|
737
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
738
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
739
|
+
"""
|
|
740
|
+
base_url = None
|
|
741
|
+
url_variables = None
|
|
742
|
+
if timeout_ms is None:
|
|
743
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
744
|
+
|
|
745
|
+
if server_url is not None:
|
|
746
|
+
base_url = server_url
|
|
747
|
+
else:
|
|
748
|
+
base_url = self._get_url(base_url, url_variables)
|
|
749
|
+
|
|
750
|
+
request = models.LibrariesDeleteV1Request(
|
|
751
|
+
library_id=library_id,
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
req = self._build_request_async(
|
|
755
|
+
method="DELETE",
|
|
756
|
+
path="/v1/libraries/{library_id}",
|
|
757
|
+
base_url=base_url,
|
|
758
|
+
url_variables=url_variables,
|
|
759
|
+
request=request,
|
|
760
|
+
request_body_required=False,
|
|
761
|
+
request_has_path_params=True,
|
|
762
|
+
request_has_query_params=True,
|
|
763
|
+
user_agent_header="user-agent",
|
|
764
|
+
accept_header_value="application/json",
|
|
765
|
+
http_headers=http_headers,
|
|
766
|
+
security=self.sdk_configuration.security,
|
|
767
|
+
timeout_ms=timeout_ms,
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
if retries == UNSET:
|
|
771
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
772
|
+
retries = self.sdk_configuration.retry_config
|
|
773
|
+
|
|
774
|
+
retry_config = None
|
|
775
|
+
if isinstance(retries, utils.RetryConfig):
|
|
776
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
777
|
+
|
|
778
|
+
http_res = await self.do_request_async(
|
|
779
|
+
hook_ctx=HookContext(
|
|
780
|
+
config=self.sdk_configuration,
|
|
781
|
+
base_url=base_url or "",
|
|
782
|
+
operation_id="libraries_delete_v1",
|
|
783
|
+
oauth2_scopes=[],
|
|
784
|
+
security_source=get_security_from_env(
|
|
785
|
+
self.sdk_configuration.security, models.Security
|
|
786
|
+
),
|
|
787
|
+
),
|
|
788
|
+
request=req,
|
|
789
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
790
|
+
retry_config=retry_config,
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
response_data: Any = None
|
|
794
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
795
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
796
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
797
|
+
response_data = utils.unmarshal_json(
|
|
798
|
+
http_res.text, models.HTTPValidationErrorData
|
|
799
|
+
)
|
|
800
|
+
raise models.HTTPValidationError(data=response_data)
|
|
801
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
802
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
803
|
+
raise models.SDKError(
|
|
804
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
805
|
+
)
|
|
806
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
807
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
808
|
+
raise models.SDKError(
|
|
809
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
810
|
+
)
|
|
811
|
+
|
|
812
|
+
content_type = http_res.headers.get("Content-Type")
|
|
813
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
814
|
+
raise models.SDKError(
|
|
815
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
816
|
+
http_res.status_code,
|
|
817
|
+
http_res_text,
|
|
818
|
+
http_res,
|
|
819
|
+
)
|
|
820
|
+
|
|
821
|
+
def update(
|
|
822
|
+
self,
|
|
823
|
+
*,
|
|
824
|
+
library_id: str,
|
|
825
|
+
name: OptionalNullable[str] = UNSET,
|
|
826
|
+
description: OptionalNullable[str] = UNSET,
|
|
827
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
828
|
+
server_url: Optional[str] = None,
|
|
829
|
+
timeout_ms: Optional[int] = None,
|
|
830
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
831
|
+
) -> models.LibraryOut:
|
|
832
|
+
r"""Update a library.
|
|
833
|
+
|
|
834
|
+
Given a library id, you can update the name and description.
|
|
835
|
+
|
|
836
|
+
:param library_id:
|
|
837
|
+
:param name:
|
|
838
|
+
:param description:
|
|
839
|
+
:param retries: Override the default retry configuration for this method
|
|
840
|
+
:param server_url: Override the default server URL for this method
|
|
841
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
842
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
843
|
+
"""
|
|
844
|
+
base_url = None
|
|
845
|
+
url_variables = None
|
|
846
|
+
if timeout_ms is None:
|
|
847
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
848
|
+
|
|
849
|
+
if server_url is not None:
|
|
850
|
+
base_url = server_url
|
|
851
|
+
else:
|
|
852
|
+
base_url = self._get_url(base_url, url_variables)
|
|
853
|
+
|
|
854
|
+
request = models.LibrariesUpdateV1Request(
|
|
855
|
+
library_id=library_id,
|
|
856
|
+
library_in_update=models.LibraryInUpdate(
|
|
857
|
+
name=name,
|
|
858
|
+
description=description,
|
|
859
|
+
),
|
|
860
|
+
)
|
|
861
|
+
|
|
862
|
+
req = self._build_request(
|
|
863
|
+
method="PUT",
|
|
864
|
+
path="/v1/libraries/{library_id}",
|
|
865
|
+
base_url=base_url,
|
|
866
|
+
url_variables=url_variables,
|
|
867
|
+
request=request,
|
|
868
|
+
request_body_required=True,
|
|
869
|
+
request_has_path_params=True,
|
|
870
|
+
request_has_query_params=True,
|
|
871
|
+
user_agent_header="user-agent",
|
|
872
|
+
accept_header_value="application/json",
|
|
873
|
+
http_headers=http_headers,
|
|
874
|
+
security=self.sdk_configuration.security,
|
|
875
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
876
|
+
request.library_in_update, False, False, "json", models.LibraryInUpdate
|
|
877
|
+
),
|
|
878
|
+
timeout_ms=timeout_ms,
|
|
879
|
+
)
|
|
880
|
+
|
|
881
|
+
if retries == UNSET:
|
|
882
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
883
|
+
retries = self.sdk_configuration.retry_config
|
|
884
|
+
|
|
885
|
+
retry_config = None
|
|
886
|
+
if isinstance(retries, utils.RetryConfig):
|
|
887
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
888
|
+
|
|
889
|
+
http_res = self.do_request(
|
|
890
|
+
hook_ctx=HookContext(
|
|
891
|
+
config=self.sdk_configuration,
|
|
892
|
+
base_url=base_url or "",
|
|
893
|
+
operation_id="libraries_update_v1",
|
|
894
|
+
oauth2_scopes=[],
|
|
895
|
+
security_source=get_security_from_env(
|
|
896
|
+
self.sdk_configuration.security, models.Security
|
|
897
|
+
),
|
|
898
|
+
),
|
|
899
|
+
request=req,
|
|
900
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
901
|
+
retry_config=retry_config,
|
|
902
|
+
)
|
|
903
|
+
|
|
904
|
+
response_data: Any = None
|
|
905
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
906
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
907
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
908
|
+
response_data = utils.unmarshal_json(
|
|
909
|
+
http_res.text, models.HTTPValidationErrorData
|
|
910
|
+
)
|
|
911
|
+
raise models.HTTPValidationError(data=response_data)
|
|
912
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
913
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
914
|
+
raise models.SDKError(
|
|
915
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
916
|
+
)
|
|
917
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
918
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
919
|
+
raise models.SDKError(
|
|
920
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
921
|
+
)
|
|
922
|
+
|
|
923
|
+
content_type = http_res.headers.get("Content-Type")
|
|
924
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
925
|
+
raise models.SDKError(
|
|
926
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
927
|
+
http_res.status_code,
|
|
928
|
+
http_res_text,
|
|
929
|
+
http_res,
|
|
930
|
+
)
|
|
931
|
+
|
|
932
|
+
async def update_async(
|
|
933
|
+
self,
|
|
934
|
+
*,
|
|
935
|
+
library_id: str,
|
|
936
|
+
name: OptionalNullable[str] = UNSET,
|
|
937
|
+
description: OptionalNullable[str] = UNSET,
|
|
938
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
939
|
+
server_url: Optional[str] = None,
|
|
940
|
+
timeout_ms: Optional[int] = None,
|
|
941
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
942
|
+
) -> models.LibraryOut:
|
|
943
|
+
r"""Update a library.
|
|
944
|
+
|
|
945
|
+
Given a library id, you can update the name and description.
|
|
946
|
+
|
|
947
|
+
:param library_id:
|
|
948
|
+
:param name:
|
|
949
|
+
:param description:
|
|
950
|
+
:param retries: Override the default retry configuration for this method
|
|
951
|
+
:param server_url: Override the default server URL for this method
|
|
952
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
953
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
954
|
+
"""
|
|
955
|
+
base_url = None
|
|
956
|
+
url_variables = None
|
|
957
|
+
if timeout_ms is None:
|
|
958
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
959
|
+
|
|
960
|
+
if server_url is not None:
|
|
961
|
+
base_url = server_url
|
|
962
|
+
else:
|
|
963
|
+
base_url = self._get_url(base_url, url_variables)
|
|
964
|
+
|
|
965
|
+
request = models.LibrariesUpdateV1Request(
|
|
966
|
+
library_id=library_id,
|
|
967
|
+
library_in_update=models.LibraryInUpdate(
|
|
968
|
+
name=name,
|
|
969
|
+
description=description,
|
|
970
|
+
),
|
|
971
|
+
)
|
|
972
|
+
|
|
973
|
+
req = self._build_request_async(
|
|
974
|
+
method="PUT",
|
|
975
|
+
path="/v1/libraries/{library_id}",
|
|
976
|
+
base_url=base_url,
|
|
977
|
+
url_variables=url_variables,
|
|
978
|
+
request=request,
|
|
979
|
+
request_body_required=True,
|
|
980
|
+
request_has_path_params=True,
|
|
981
|
+
request_has_query_params=True,
|
|
982
|
+
user_agent_header="user-agent",
|
|
983
|
+
accept_header_value="application/json",
|
|
984
|
+
http_headers=http_headers,
|
|
985
|
+
security=self.sdk_configuration.security,
|
|
986
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
987
|
+
request.library_in_update, False, False, "json", models.LibraryInUpdate
|
|
988
|
+
),
|
|
989
|
+
timeout_ms=timeout_ms,
|
|
990
|
+
)
|
|
991
|
+
|
|
992
|
+
if retries == UNSET:
|
|
993
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
994
|
+
retries = self.sdk_configuration.retry_config
|
|
995
|
+
|
|
996
|
+
retry_config = None
|
|
997
|
+
if isinstance(retries, utils.RetryConfig):
|
|
998
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
999
|
+
|
|
1000
|
+
http_res = await self.do_request_async(
|
|
1001
|
+
hook_ctx=HookContext(
|
|
1002
|
+
config=self.sdk_configuration,
|
|
1003
|
+
base_url=base_url or "",
|
|
1004
|
+
operation_id="libraries_update_v1",
|
|
1005
|
+
oauth2_scopes=[],
|
|
1006
|
+
security_source=get_security_from_env(
|
|
1007
|
+
self.sdk_configuration.security, models.Security
|
|
1008
|
+
),
|
|
1009
|
+
),
|
|
1010
|
+
request=req,
|
|
1011
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1012
|
+
retry_config=retry_config,
|
|
1013
|
+
)
|
|
1014
|
+
|
|
1015
|
+
response_data: Any = None
|
|
1016
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1017
|
+
return utils.unmarshal_json(http_res.text, models.LibraryOut)
|
|
1018
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1019
|
+
response_data = utils.unmarshal_json(
|
|
1020
|
+
http_res.text, models.HTTPValidationErrorData
|
|
1021
|
+
)
|
|
1022
|
+
raise models.HTTPValidationError(data=response_data)
|
|
1023
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1024
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1025
|
+
raise models.SDKError(
|
|
1026
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1027
|
+
)
|
|
1028
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1029
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1030
|
+
raise models.SDKError(
|
|
1031
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1032
|
+
)
|
|
1033
|
+
|
|
1034
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1035
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1036
|
+
raise models.SDKError(
|
|
1037
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1038
|
+
http_res.status_code,
|
|
1039
|
+
http_res_text,
|
|
1040
|
+
http_res,
|
|
1041
|
+
)
|