mistralai 1.9.10__py3-none-any.whl → 1.10.0__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/_hooks/registration.py +5 -0
- mistralai/_hooks/tracing.py +50 -0
- mistralai/_version.py +3 -3
- mistralai/accesses.py +51 -116
- mistralai/agents.py +58 -85
- mistralai/audio.py +8 -3
- mistralai/basesdk.py +15 -5
- mistralai/batch.py +6 -3
- mistralai/beta.py +10 -5
- mistralai/chat.py +70 -97
- mistralai/classifiers.py +57 -144
- mistralai/conversations.py +435 -412
- mistralai/documents.py +156 -359
- mistralai/embeddings.py +21 -42
- mistralai/extra/observability/__init__.py +15 -0
- mistralai/extra/observability/otel.py +393 -0
- mistralai/extra/run/tools.py +28 -16
- mistralai/files.py +53 -176
- mistralai/fim.py +46 -73
- mistralai/fine_tuning.py +6 -3
- mistralai/jobs.py +49 -158
- mistralai/libraries.py +71 -178
- mistralai/mistral_agents.py +298 -179
- mistralai/mistral_jobs.py +51 -138
- mistralai/models/__init__.py +94 -5
- mistralai/models/agent.py +15 -2
- mistralai/models/agentconversation.py +11 -3
- mistralai/models/agentcreationrequest.py +6 -2
- mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
- mistralai/models/agents_api_v1_agents_getop.py +40 -3
- mistralai/models/agents_api_v1_agents_listop.py +72 -2
- mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
- mistralai/models/agents_api_v1_conversations_listop.py +39 -2
- mistralai/models/agentscompletionrequest.py +21 -6
- mistralai/models/agentscompletionstreamrequest.py +21 -6
- mistralai/models/agentupdaterequest.py +18 -2
- mistralai/models/audiotranscriptionrequest.py +2 -0
- mistralai/models/batchjobin.py +10 -0
- mistralai/models/chatcompletionrequest.py +22 -5
- mistralai/models/chatcompletionstreamrequest.py +22 -5
- mistralai/models/conversationrequest.py +15 -4
- mistralai/models/conversationrestartrequest.py +50 -2
- mistralai/models/conversationrestartstreamrequest.py +50 -2
- mistralai/models/conversationstreamrequest.py +15 -4
- mistralai/models/documentout.py +26 -10
- mistralai/models/documentupdatein.py +24 -3
- mistralai/models/embeddingrequest.py +8 -8
- mistralai/models/files_api_routes_list_filesop.py +7 -0
- mistralai/models/fimcompletionrequest.py +8 -9
- mistralai/models/fimcompletionstreamrequest.py +8 -9
- mistralai/models/httpvalidationerror.py +11 -6
- mistralai/models/libraries_documents_list_v1op.py +15 -2
- mistralai/models/libraryout.py +10 -7
- mistralai/models/listfilesout.py +35 -4
- mistralai/models/mistralerror.py +26 -0
- mistralai/models/modelcapabilities.py +13 -4
- mistralai/models/modelconversation.py +8 -2
- mistralai/models/no_response_error.py +13 -0
- mistralai/models/ocrpageobject.py +26 -5
- mistralai/models/ocrrequest.py +17 -1
- mistralai/models/ocrtableobject.py +31 -0
- mistralai/models/prediction.py +4 -0
- mistralai/models/requestsource.py +7 -0
- mistralai/models/responseformat.py +4 -2
- mistralai/models/responseformats.py +0 -1
- mistralai/models/responsevalidationerror.py +25 -0
- mistralai/models/sdkerror.py +30 -14
- mistralai/models/sharingdelete.py +36 -5
- mistralai/models/sharingin.py +36 -5
- mistralai/models/sharingout.py +3 -3
- mistralai/models/toolexecutiondeltaevent.py +13 -4
- mistralai/models/toolexecutiondoneevent.py +13 -4
- mistralai/models/toolexecutionentry.py +9 -4
- mistralai/models/toolexecutionstartedevent.py +13 -4
- mistralai/models_.py +67 -212
- mistralai/ocr.py +33 -36
- mistralai/sdk.py +15 -2
- mistralai/transcriptions.py +21 -60
- mistralai/utils/__init__.py +18 -5
- mistralai/utils/eventstreaming.py +10 -0
- mistralai/utils/serializers.py +3 -2
- mistralai/utils/unmarshal_json_response.py +24 -0
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/METADATA +89 -40
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/RECORD +86 -75
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/WHEEL +1 -1
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info/licenses}/LICENSE +0 -0
mistralai/_hooks/registration.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from .custom_user_agent import CustomUserAgentHook
|
|
2
2
|
from .deprecation_warning import DeprecationWarningHook
|
|
3
|
+
from .tracing import TracingHook
|
|
3
4
|
from .types import Hooks
|
|
4
5
|
|
|
5
6
|
# This file is only ever generated once on the first generation and then is free to be modified.
|
|
@@ -13,5 +14,9 @@ def init_hooks(hooks: Hooks):
|
|
|
13
14
|
with an instance of a hook that implements that specific Hook interface
|
|
14
15
|
Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
|
|
15
16
|
"""
|
|
17
|
+
tracing_hook = TracingHook()
|
|
16
18
|
hooks.register_before_request_hook(CustomUserAgentHook())
|
|
17
19
|
hooks.register_after_success_hook(DeprecationWarningHook())
|
|
20
|
+
hooks.register_after_success_hook(tracing_hook)
|
|
21
|
+
hooks.register_before_request_hook(tracing_hook)
|
|
22
|
+
hooks.register_after_error_hook(tracing_hook)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Optional, Tuple, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from opentelemetry.trace import Span
|
|
6
|
+
|
|
7
|
+
from ..extra.observability.otel import (
|
|
8
|
+
get_or_create_otel_tracer,
|
|
9
|
+
get_response_and_error,
|
|
10
|
+
get_traced_request_and_span,
|
|
11
|
+
get_traced_response,
|
|
12
|
+
)
|
|
13
|
+
from .types import (
|
|
14
|
+
AfterErrorContext,
|
|
15
|
+
AfterErrorHook,
|
|
16
|
+
AfterSuccessContext,
|
|
17
|
+
AfterSuccessHook,
|
|
18
|
+
BeforeRequestContext,
|
|
19
|
+
BeforeRequestHook,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class TracingHook(BeforeRequestHook, AfterSuccessHook, AfterErrorHook):
|
|
26
|
+
def __init__(self) -> None:
|
|
27
|
+
self.tracing_enabled, self.tracer = get_or_create_otel_tracer()
|
|
28
|
+
self.request_span: Optional[Span] = None
|
|
29
|
+
|
|
30
|
+
def before_request(
|
|
31
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
|
32
|
+
) -> Union[httpx.Request, Exception]:
|
|
33
|
+
request, self.request_span = get_traced_request_and_span(tracing_enabled=self.tracing_enabled, tracer=self.tracer, span=self.request_span, operation_id=hook_ctx.operation_id, request=request)
|
|
34
|
+
return request
|
|
35
|
+
|
|
36
|
+
def after_success(
|
|
37
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
|
38
|
+
) -> Union[httpx.Response, Exception]:
|
|
39
|
+
response = get_traced_response(tracing_enabled=self.tracing_enabled, tracer=self.tracer, span=self.request_span, operation_id=hook_ctx.operation_id, response=response)
|
|
40
|
+
return response
|
|
41
|
+
|
|
42
|
+
def after_error(
|
|
43
|
+
self,
|
|
44
|
+
hook_ctx: AfterErrorContext,
|
|
45
|
+
response: Optional[httpx.Response],
|
|
46
|
+
error: Optional[Exception],
|
|
47
|
+
) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
|
48
|
+
if response:
|
|
49
|
+
response, error = get_response_and_error(tracing_enabled=self.tracing_enabled, tracer=self.tracer, span=self.request_span, operation_id=hook_ctx.operation_id, response=response, error=error)
|
|
50
|
+
return response, error
|
mistralai/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai"
|
|
6
|
-
__version__: str = "1.
|
|
6
|
+
__version__: str = "1.10.0"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 1.
|
|
8
|
+
__gen_version__: str = "2.687.13"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.10.0 2.687.13 1.0.0 mistralai"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
mistralai/accesses.py
CHANGED
|
@@ -5,6 +5,7 @@ from mistralai import models, utils
|
|
|
5
5
|
from mistralai._hooks import HookContext
|
|
6
6
|
from mistralai.types import OptionalNullable, UNSET
|
|
7
7
|
from mistralai.utils import get_security_from_env
|
|
8
|
+
from mistralai.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Any, Mapping, Optional
|
|
9
10
|
|
|
10
11
|
|
|
@@ -85,31 +86,20 @@ class Accesses(BaseSDK):
|
|
|
85
86
|
|
|
86
87
|
response_data: Any = None
|
|
87
88
|
if utils.match_response(http_res, "200", "application/json"):
|
|
88
|
-
return
|
|
89
|
+
return unmarshal_json_response(models.ListSharingOut, http_res)
|
|
89
90
|
if utils.match_response(http_res, "422", "application/json"):
|
|
90
|
-
response_data =
|
|
91
|
-
|
|
91
|
+
response_data = unmarshal_json_response(
|
|
92
|
+
models.HTTPValidationErrorData, http_res
|
|
92
93
|
)
|
|
93
|
-
raise models.HTTPValidationError(
|
|
94
|
+
raise models.HTTPValidationError(response_data, http_res)
|
|
94
95
|
if utils.match_response(http_res, "4XX", "*"):
|
|
95
96
|
http_res_text = utils.stream_to_text(http_res)
|
|
96
|
-
raise models.SDKError(
|
|
97
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
98
|
-
)
|
|
97
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
99
98
|
if utils.match_response(http_res, "5XX", "*"):
|
|
100
99
|
http_res_text = utils.stream_to_text(http_res)
|
|
101
|
-
raise models.SDKError(
|
|
102
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
103
|
-
)
|
|
100
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
104
101
|
|
|
105
|
-
|
|
106
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
107
|
-
raise models.SDKError(
|
|
108
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
109
|
-
http_res.status_code,
|
|
110
|
-
http_res_text,
|
|
111
|
-
http_res,
|
|
112
|
-
)
|
|
102
|
+
raise models.SDKError("Unexpected response received", http_res)
|
|
113
103
|
|
|
114
104
|
async def list_async(
|
|
115
105
|
self,
|
|
@@ -185,40 +175,29 @@ class Accesses(BaseSDK):
|
|
|
185
175
|
|
|
186
176
|
response_data: Any = None
|
|
187
177
|
if utils.match_response(http_res, "200", "application/json"):
|
|
188
|
-
return
|
|
178
|
+
return unmarshal_json_response(models.ListSharingOut, http_res)
|
|
189
179
|
if utils.match_response(http_res, "422", "application/json"):
|
|
190
|
-
response_data =
|
|
191
|
-
|
|
180
|
+
response_data = unmarshal_json_response(
|
|
181
|
+
models.HTTPValidationErrorData, http_res
|
|
192
182
|
)
|
|
193
|
-
raise models.HTTPValidationError(
|
|
183
|
+
raise models.HTTPValidationError(response_data, http_res)
|
|
194
184
|
if utils.match_response(http_res, "4XX", "*"):
|
|
195
185
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
196
|
-
raise models.SDKError(
|
|
197
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
198
|
-
)
|
|
186
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
199
187
|
if utils.match_response(http_res, "5XX", "*"):
|
|
200
188
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
201
|
-
raise models.SDKError(
|
|
202
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
203
|
-
)
|
|
189
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
204
190
|
|
|
205
|
-
|
|
206
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
207
|
-
raise models.SDKError(
|
|
208
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
209
|
-
http_res.status_code,
|
|
210
|
-
http_res_text,
|
|
211
|
-
http_res,
|
|
212
|
-
)
|
|
191
|
+
raise models.SDKError("Unexpected response received", http_res)
|
|
213
192
|
|
|
214
193
|
def update_or_create(
|
|
215
194
|
self,
|
|
216
195
|
*,
|
|
217
196
|
library_id: str,
|
|
218
|
-
org_id: str,
|
|
219
197
|
level: models.ShareEnum,
|
|
220
198
|
share_with_uuid: str,
|
|
221
199
|
share_with_type: models.EntityType,
|
|
200
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
222
201
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
223
202
|
server_url: Optional[str] = None,
|
|
224
203
|
timeout_ms: Optional[int] = None,
|
|
@@ -229,10 +208,10 @@ class Accesses(BaseSDK):
|
|
|
229
208
|
Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.
|
|
230
209
|
|
|
231
210
|
:param library_id:
|
|
232
|
-
:param org_id:
|
|
233
211
|
:param level:
|
|
234
212
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
235
213
|
:param share_with_type: The type of entity, used to share a library.
|
|
214
|
+
:param org_id:
|
|
236
215
|
:param retries: Override the default retry configuration for this method
|
|
237
216
|
:param server_url: Override the default server URL for this method
|
|
238
217
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -302,40 +281,29 @@ class Accesses(BaseSDK):
|
|
|
302
281
|
|
|
303
282
|
response_data: Any = None
|
|
304
283
|
if utils.match_response(http_res, "200", "application/json"):
|
|
305
|
-
return
|
|
284
|
+
return unmarshal_json_response(models.SharingOut, http_res)
|
|
306
285
|
if utils.match_response(http_res, "422", "application/json"):
|
|
307
|
-
response_data =
|
|
308
|
-
|
|
286
|
+
response_data = unmarshal_json_response(
|
|
287
|
+
models.HTTPValidationErrorData, http_res
|
|
309
288
|
)
|
|
310
|
-
raise models.HTTPValidationError(
|
|
289
|
+
raise models.HTTPValidationError(response_data, http_res)
|
|
311
290
|
if utils.match_response(http_res, "4XX", "*"):
|
|
312
291
|
http_res_text = utils.stream_to_text(http_res)
|
|
313
|
-
raise models.SDKError(
|
|
314
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
315
|
-
)
|
|
292
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
316
293
|
if utils.match_response(http_res, "5XX", "*"):
|
|
317
294
|
http_res_text = utils.stream_to_text(http_res)
|
|
318
|
-
raise models.SDKError(
|
|
319
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
320
|
-
)
|
|
295
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
321
296
|
|
|
322
|
-
|
|
323
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
324
|
-
raise models.SDKError(
|
|
325
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
326
|
-
http_res.status_code,
|
|
327
|
-
http_res_text,
|
|
328
|
-
http_res,
|
|
329
|
-
)
|
|
297
|
+
raise models.SDKError("Unexpected response received", http_res)
|
|
330
298
|
|
|
331
299
|
async def update_or_create_async(
|
|
332
300
|
self,
|
|
333
301
|
*,
|
|
334
302
|
library_id: str,
|
|
335
|
-
org_id: str,
|
|
336
303
|
level: models.ShareEnum,
|
|
337
304
|
share_with_uuid: str,
|
|
338
305
|
share_with_type: models.EntityType,
|
|
306
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
339
307
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
340
308
|
server_url: Optional[str] = None,
|
|
341
309
|
timeout_ms: Optional[int] = None,
|
|
@@ -346,10 +314,10 @@ class Accesses(BaseSDK):
|
|
|
346
314
|
Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.
|
|
347
315
|
|
|
348
316
|
:param library_id:
|
|
349
|
-
:param org_id:
|
|
350
317
|
:param level:
|
|
351
318
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
352
319
|
:param share_with_type: The type of entity, used to share a library.
|
|
320
|
+
:param org_id:
|
|
353
321
|
:param retries: Override the default retry configuration for this method
|
|
354
322
|
:param server_url: Override the default server URL for this method
|
|
355
323
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -419,39 +387,28 @@ class Accesses(BaseSDK):
|
|
|
419
387
|
|
|
420
388
|
response_data: Any = None
|
|
421
389
|
if utils.match_response(http_res, "200", "application/json"):
|
|
422
|
-
return
|
|
390
|
+
return unmarshal_json_response(models.SharingOut, http_res)
|
|
423
391
|
if utils.match_response(http_res, "422", "application/json"):
|
|
424
|
-
response_data =
|
|
425
|
-
|
|
392
|
+
response_data = unmarshal_json_response(
|
|
393
|
+
models.HTTPValidationErrorData, http_res
|
|
426
394
|
)
|
|
427
|
-
raise models.HTTPValidationError(
|
|
395
|
+
raise models.HTTPValidationError(response_data, http_res)
|
|
428
396
|
if utils.match_response(http_res, "4XX", "*"):
|
|
429
397
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
430
|
-
raise models.SDKError(
|
|
431
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
432
|
-
)
|
|
398
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
433
399
|
if utils.match_response(http_res, "5XX", "*"):
|
|
434
400
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
435
|
-
raise models.SDKError(
|
|
436
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
437
|
-
)
|
|
401
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
438
402
|
|
|
439
|
-
|
|
440
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
441
|
-
raise models.SDKError(
|
|
442
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
443
|
-
http_res.status_code,
|
|
444
|
-
http_res_text,
|
|
445
|
-
http_res,
|
|
446
|
-
)
|
|
403
|
+
raise models.SDKError("Unexpected response received", http_res)
|
|
447
404
|
|
|
448
405
|
def delete(
|
|
449
406
|
self,
|
|
450
407
|
*,
|
|
451
408
|
library_id: str,
|
|
452
|
-
org_id: str,
|
|
453
409
|
share_with_uuid: str,
|
|
454
410
|
share_with_type: models.EntityType,
|
|
411
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
455
412
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
456
413
|
server_url: Optional[str] = None,
|
|
457
414
|
timeout_ms: Optional[int] = None,
|
|
@@ -462,9 +419,9 @@ class Accesses(BaseSDK):
|
|
|
462
419
|
Given a library id, you can delete the access level of an entity. An owner cannot delete it's own access. You have to be the owner of the library to delete an acces other than yours.
|
|
463
420
|
|
|
464
421
|
:param library_id:
|
|
465
|
-
:param org_id:
|
|
466
422
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
467
423
|
:param share_with_type: The type of entity, used to share a library.
|
|
424
|
+
:param org_id:
|
|
468
425
|
:param retries: Override the default retry configuration for this method
|
|
469
426
|
:param server_url: Override the default server URL for this method
|
|
470
427
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -533,39 +490,28 @@ class Accesses(BaseSDK):
|
|
|
533
490
|
|
|
534
491
|
response_data: Any = None
|
|
535
492
|
if utils.match_response(http_res, "200", "application/json"):
|
|
536
|
-
return
|
|
493
|
+
return unmarshal_json_response(models.SharingOut, http_res)
|
|
537
494
|
if utils.match_response(http_res, "422", "application/json"):
|
|
538
|
-
response_data =
|
|
539
|
-
|
|
495
|
+
response_data = unmarshal_json_response(
|
|
496
|
+
models.HTTPValidationErrorData, http_res
|
|
540
497
|
)
|
|
541
|
-
raise models.HTTPValidationError(
|
|
498
|
+
raise models.HTTPValidationError(response_data, http_res)
|
|
542
499
|
if utils.match_response(http_res, "4XX", "*"):
|
|
543
500
|
http_res_text = utils.stream_to_text(http_res)
|
|
544
|
-
raise models.SDKError(
|
|
545
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
546
|
-
)
|
|
501
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
547
502
|
if utils.match_response(http_res, "5XX", "*"):
|
|
548
503
|
http_res_text = utils.stream_to_text(http_res)
|
|
549
|
-
raise models.SDKError(
|
|
550
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
551
|
-
)
|
|
504
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
552
505
|
|
|
553
|
-
|
|
554
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
555
|
-
raise models.SDKError(
|
|
556
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
557
|
-
http_res.status_code,
|
|
558
|
-
http_res_text,
|
|
559
|
-
http_res,
|
|
560
|
-
)
|
|
506
|
+
raise models.SDKError("Unexpected response received", http_res)
|
|
561
507
|
|
|
562
508
|
async def delete_async(
|
|
563
509
|
self,
|
|
564
510
|
*,
|
|
565
511
|
library_id: str,
|
|
566
|
-
org_id: str,
|
|
567
512
|
share_with_uuid: str,
|
|
568
513
|
share_with_type: models.EntityType,
|
|
514
|
+
org_id: OptionalNullable[str] = UNSET,
|
|
569
515
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
570
516
|
server_url: Optional[str] = None,
|
|
571
517
|
timeout_ms: Optional[int] = None,
|
|
@@ -576,9 +522,9 @@ class Accesses(BaseSDK):
|
|
|
576
522
|
Given a library id, you can delete the access level of an entity. An owner cannot delete it's own access. You have to be the owner of the library to delete an acces other than yours.
|
|
577
523
|
|
|
578
524
|
:param library_id:
|
|
579
|
-
:param org_id:
|
|
580
525
|
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
581
526
|
:param share_with_type: The type of entity, used to share a library.
|
|
527
|
+
:param org_id:
|
|
582
528
|
:param retries: Override the default retry configuration for this method
|
|
583
529
|
:param server_url: Override the default server URL for this method
|
|
584
530
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -647,28 +593,17 @@ class Accesses(BaseSDK):
|
|
|
647
593
|
|
|
648
594
|
response_data: Any = None
|
|
649
595
|
if utils.match_response(http_res, "200", "application/json"):
|
|
650
|
-
return
|
|
596
|
+
return unmarshal_json_response(models.SharingOut, http_res)
|
|
651
597
|
if utils.match_response(http_res, "422", "application/json"):
|
|
652
|
-
response_data =
|
|
653
|
-
|
|
598
|
+
response_data = unmarshal_json_response(
|
|
599
|
+
models.HTTPValidationErrorData, http_res
|
|
654
600
|
)
|
|
655
|
-
raise models.HTTPValidationError(
|
|
601
|
+
raise models.HTTPValidationError(response_data, http_res)
|
|
656
602
|
if utils.match_response(http_res, "4XX", "*"):
|
|
657
603
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
658
|
-
raise models.SDKError(
|
|
659
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
660
|
-
)
|
|
604
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
661
605
|
if utils.match_response(http_res, "5XX", "*"):
|
|
662
606
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
663
|
-
raise models.SDKError(
|
|
664
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
665
|
-
)
|
|
607
|
+
raise models.SDKError("API error occurred", http_res, http_res_text)
|
|
666
608
|
|
|
667
|
-
|
|
668
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
669
|
-
raise models.SDKError(
|
|
670
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
671
|
-
http_res.status_code,
|
|
672
|
-
http_res_text,
|
|
673
|
-
http_res,
|
|
674
|
-
)
|
|
609
|
+
raise models.SDKError("Unexpected response received", http_res)
|