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/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai"
|
|
6
|
-
__version__: str = "1.9.
|
|
6
|
+
__version__: str = "1.9.2"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
8
|
__gen_version__: str = "2.634.2"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 1.9.
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.9.2 2.634.2 1.0.0 mistralai"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
mistralai/accesses.py
ADDED
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from mistralai import models, utils
|
|
5
|
+
from mistralai._hooks import HookContext
|
|
6
|
+
from mistralai.types import OptionalNullable, UNSET
|
|
7
|
+
from mistralai.utils import get_security_from_env
|
|
8
|
+
from typing import Any, Mapping, Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Accesses(BaseSDK):
|
|
12
|
+
def list(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
library_id: str,
|
|
16
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
17
|
+
server_url: Optional[str] = None,
|
|
18
|
+
timeout_ms: Optional[int] = None,
|
|
19
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
20
|
+
) -> models.ListSharingOut:
|
|
21
|
+
r"""List all of the access to this library.
|
|
22
|
+
|
|
23
|
+
Given a library, list all of the Entity that have access and to what level.
|
|
24
|
+
|
|
25
|
+
:param library_id:
|
|
26
|
+
:param retries: Override the default retry configuration for this method
|
|
27
|
+
:param server_url: Override the default server URL for this method
|
|
28
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
29
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
30
|
+
"""
|
|
31
|
+
base_url = None
|
|
32
|
+
url_variables = None
|
|
33
|
+
if timeout_ms is None:
|
|
34
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
35
|
+
|
|
36
|
+
if server_url is not None:
|
|
37
|
+
base_url = server_url
|
|
38
|
+
else:
|
|
39
|
+
base_url = self._get_url(base_url, url_variables)
|
|
40
|
+
|
|
41
|
+
request = models.LibrariesShareListV1Request(
|
|
42
|
+
library_id=library_id,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
req = self._build_request(
|
|
46
|
+
method="GET",
|
|
47
|
+
path="/v1/libraries/{library_id}/share",
|
|
48
|
+
base_url=base_url,
|
|
49
|
+
url_variables=url_variables,
|
|
50
|
+
request=request,
|
|
51
|
+
request_body_required=False,
|
|
52
|
+
request_has_path_params=True,
|
|
53
|
+
request_has_query_params=True,
|
|
54
|
+
user_agent_header="user-agent",
|
|
55
|
+
accept_header_value="application/json",
|
|
56
|
+
http_headers=http_headers,
|
|
57
|
+
security=self.sdk_configuration.security,
|
|
58
|
+
timeout_ms=timeout_ms,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if retries == UNSET:
|
|
62
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
63
|
+
retries = self.sdk_configuration.retry_config
|
|
64
|
+
|
|
65
|
+
retry_config = None
|
|
66
|
+
if isinstance(retries, utils.RetryConfig):
|
|
67
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
68
|
+
|
|
69
|
+
http_res = self.do_request(
|
|
70
|
+
hook_ctx=HookContext(
|
|
71
|
+
config=self.sdk_configuration,
|
|
72
|
+
base_url=base_url or "",
|
|
73
|
+
operation_id="libraries_share_list_v1",
|
|
74
|
+
oauth2_scopes=[],
|
|
75
|
+
security_source=get_security_from_env(
|
|
76
|
+
self.sdk_configuration.security, models.Security
|
|
77
|
+
),
|
|
78
|
+
),
|
|
79
|
+
request=req,
|
|
80
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
81
|
+
retry_config=retry_config,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
response_data: Any = None
|
|
85
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
86
|
+
return utils.unmarshal_json(http_res.text, models.ListSharingOut)
|
|
87
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
88
|
+
response_data = utils.unmarshal_json(
|
|
89
|
+
http_res.text, models.HTTPValidationErrorData
|
|
90
|
+
)
|
|
91
|
+
raise models.HTTPValidationError(data=response_data)
|
|
92
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
93
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
94
|
+
raise models.SDKError(
|
|
95
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
96
|
+
)
|
|
97
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
98
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
99
|
+
raise models.SDKError(
|
|
100
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
content_type = http_res.headers.get("Content-Type")
|
|
104
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
105
|
+
raise models.SDKError(
|
|
106
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
107
|
+
http_res.status_code,
|
|
108
|
+
http_res_text,
|
|
109
|
+
http_res,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
async def list_async(
|
|
113
|
+
self,
|
|
114
|
+
*,
|
|
115
|
+
library_id: str,
|
|
116
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
117
|
+
server_url: Optional[str] = None,
|
|
118
|
+
timeout_ms: Optional[int] = None,
|
|
119
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
120
|
+
) -> models.ListSharingOut:
|
|
121
|
+
r"""List all of the access to this library.
|
|
122
|
+
|
|
123
|
+
Given a library, list all of the Entity that have access and to what level.
|
|
124
|
+
|
|
125
|
+
:param library_id:
|
|
126
|
+
:param retries: Override the default retry configuration for this method
|
|
127
|
+
:param server_url: Override the default server URL for this method
|
|
128
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
129
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
130
|
+
"""
|
|
131
|
+
base_url = None
|
|
132
|
+
url_variables = None
|
|
133
|
+
if timeout_ms is None:
|
|
134
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
135
|
+
|
|
136
|
+
if server_url is not None:
|
|
137
|
+
base_url = server_url
|
|
138
|
+
else:
|
|
139
|
+
base_url = self._get_url(base_url, url_variables)
|
|
140
|
+
|
|
141
|
+
request = models.LibrariesShareListV1Request(
|
|
142
|
+
library_id=library_id,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
req = self._build_request_async(
|
|
146
|
+
method="GET",
|
|
147
|
+
path="/v1/libraries/{library_id}/share",
|
|
148
|
+
base_url=base_url,
|
|
149
|
+
url_variables=url_variables,
|
|
150
|
+
request=request,
|
|
151
|
+
request_body_required=False,
|
|
152
|
+
request_has_path_params=True,
|
|
153
|
+
request_has_query_params=True,
|
|
154
|
+
user_agent_header="user-agent",
|
|
155
|
+
accept_header_value="application/json",
|
|
156
|
+
http_headers=http_headers,
|
|
157
|
+
security=self.sdk_configuration.security,
|
|
158
|
+
timeout_ms=timeout_ms,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
if retries == UNSET:
|
|
162
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
163
|
+
retries = self.sdk_configuration.retry_config
|
|
164
|
+
|
|
165
|
+
retry_config = None
|
|
166
|
+
if isinstance(retries, utils.RetryConfig):
|
|
167
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
168
|
+
|
|
169
|
+
http_res = await self.do_request_async(
|
|
170
|
+
hook_ctx=HookContext(
|
|
171
|
+
config=self.sdk_configuration,
|
|
172
|
+
base_url=base_url or "",
|
|
173
|
+
operation_id="libraries_share_list_v1",
|
|
174
|
+
oauth2_scopes=[],
|
|
175
|
+
security_source=get_security_from_env(
|
|
176
|
+
self.sdk_configuration.security, models.Security
|
|
177
|
+
),
|
|
178
|
+
),
|
|
179
|
+
request=req,
|
|
180
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
181
|
+
retry_config=retry_config,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
response_data: Any = None
|
|
185
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
186
|
+
return utils.unmarshal_json(http_res.text, models.ListSharingOut)
|
|
187
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
188
|
+
response_data = utils.unmarshal_json(
|
|
189
|
+
http_res.text, models.HTTPValidationErrorData
|
|
190
|
+
)
|
|
191
|
+
raise models.HTTPValidationError(data=response_data)
|
|
192
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
193
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
194
|
+
raise models.SDKError(
|
|
195
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
196
|
+
)
|
|
197
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
198
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
199
|
+
raise models.SDKError(
|
|
200
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
content_type = http_res.headers.get("Content-Type")
|
|
204
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
205
|
+
raise models.SDKError(
|
|
206
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
207
|
+
http_res.status_code,
|
|
208
|
+
http_res_text,
|
|
209
|
+
http_res,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
def update_or_create(
|
|
213
|
+
self,
|
|
214
|
+
*,
|
|
215
|
+
library_id: str,
|
|
216
|
+
org_id: str,
|
|
217
|
+
level: models.ShareEnum,
|
|
218
|
+
share_with_uuid: str,
|
|
219
|
+
share_with_type: models.EntityType,
|
|
220
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
221
|
+
server_url: Optional[str] = None,
|
|
222
|
+
timeout_ms: Optional[int] = None,
|
|
223
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
224
|
+
) -> models.SharingOut:
|
|
225
|
+
r"""Create or update an access level.
|
|
226
|
+
|
|
227
|
+
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.
|
|
228
|
+
|
|
229
|
+
:param library_id:
|
|
230
|
+
:param org_id:
|
|
231
|
+
:param level:
|
|
232
|
+
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
233
|
+
:param share_with_type: The type of entity, used to share a library.
|
|
234
|
+
:param retries: Override the default retry configuration for this method
|
|
235
|
+
:param server_url: Override the default server URL for this method
|
|
236
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
237
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
238
|
+
"""
|
|
239
|
+
base_url = None
|
|
240
|
+
url_variables = None
|
|
241
|
+
if timeout_ms is None:
|
|
242
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
243
|
+
|
|
244
|
+
if server_url is not None:
|
|
245
|
+
base_url = server_url
|
|
246
|
+
else:
|
|
247
|
+
base_url = self._get_url(base_url, url_variables)
|
|
248
|
+
|
|
249
|
+
request = models.LibrariesShareCreateV1Request(
|
|
250
|
+
library_id=library_id,
|
|
251
|
+
sharing_in=models.SharingIn(
|
|
252
|
+
org_id=org_id,
|
|
253
|
+
level=level,
|
|
254
|
+
share_with_uuid=share_with_uuid,
|
|
255
|
+
share_with_type=share_with_type,
|
|
256
|
+
),
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
req = self._build_request(
|
|
260
|
+
method="PUT",
|
|
261
|
+
path="/v1/libraries/{library_id}/share",
|
|
262
|
+
base_url=base_url,
|
|
263
|
+
url_variables=url_variables,
|
|
264
|
+
request=request,
|
|
265
|
+
request_body_required=True,
|
|
266
|
+
request_has_path_params=True,
|
|
267
|
+
request_has_query_params=True,
|
|
268
|
+
user_agent_header="user-agent",
|
|
269
|
+
accept_header_value="application/json",
|
|
270
|
+
http_headers=http_headers,
|
|
271
|
+
security=self.sdk_configuration.security,
|
|
272
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
273
|
+
request.sharing_in, False, False, "json", models.SharingIn
|
|
274
|
+
),
|
|
275
|
+
timeout_ms=timeout_ms,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
if retries == UNSET:
|
|
279
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
280
|
+
retries = self.sdk_configuration.retry_config
|
|
281
|
+
|
|
282
|
+
retry_config = None
|
|
283
|
+
if isinstance(retries, utils.RetryConfig):
|
|
284
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
285
|
+
|
|
286
|
+
http_res = self.do_request(
|
|
287
|
+
hook_ctx=HookContext(
|
|
288
|
+
config=self.sdk_configuration,
|
|
289
|
+
base_url=base_url or "",
|
|
290
|
+
operation_id="libraries_share_create_v1",
|
|
291
|
+
oauth2_scopes=[],
|
|
292
|
+
security_source=get_security_from_env(
|
|
293
|
+
self.sdk_configuration.security, models.Security
|
|
294
|
+
),
|
|
295
|
+
),
|
|
296
|
+
request=req,
|
|
297
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
298
|
+
retry_config=retry_config,
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
response_data: Any = None
|
|
302
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
303
|
+
return utils.unmarshal_json(http_res.text, models.SharingOut)
|
|
304
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
305
|
+
response_data = utils.unmarshal_json(
|
|
306
|
+
http_res.text, models.HTTPValidationErrorData
|
|
307
|
+
)
|
|
308
|
+
raise models.HTTPValidationError(data=response_data)
|
|
309
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
310
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
311
|
+
raise models.SDKError(
|
|
312
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
313
|
+
)
|
|
314
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
315
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
316
|
+
raise models.SDKError(
|
|
317
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
content_type = http_res.headers.get("Content-Type")
|
|
321
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
322
|
+
raise models.SDKError(
|
|
323
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
324
|
+
http_res.status_code,
|
|
325
|
+
http_res_text,
|
|
326
|
+
http_res,
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
async def update_or_create_async(
|
|
330
|
+
self,
|
|
331
|
+
*,
|
|
332
|
+
library_id: str,
|
|
333
|
+
org_id: str,
|
|
334
|
+
level: models.ShareEnum,
|
|
335
|
+
share_with_uuid: str,
|
|
336
|
+
share_with_type: models.EntityType,
|
|
337
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
338
|
+
server_url: Optional[str] = None,
|
|
339
|
+
timeout_ms: Optional[int] = None,
|
|
340
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
341
|
+
) -> models.SharingOut:
|
|
342
|
+
r"""Create or update an access level.
|
|
343
|
+
|
|
344
|
+
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.
|
|
345
|
+
|
|
346
|
+
:param library_id:
|
|
347
|
+
:param org_id:
|
|
348
|
+
:param level:
|
|
349
|
+
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
350
|
+
:param share_with_type: The type of entity, used to share a library.
|
|
351
|
+
:param retries: Override the default retry configuration for this method
|
|
352
|
+
:param server_url: Override the default server URL for this method
|
|
353
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
354
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
355
|
+
"""
|
|
356
|
+
base_url = None
|
|
357
|
+
url_variables = None
|
|
358
|
+
if timeout_ms is None:
|
|
359
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
360
|
+
|
|
361
|
+
if server_url is not None:
|
|
362
|
+
base_url = server_url
|
|
363
|
+
else:
|
|
364
|
+
base_url = self._get_url(base_url, url_variables)
|
|
365
|
+
|
|
366
|
+
request = models.LibrariesShareCreateV1Request(
|
|
367
|
+
library_id=library_id,
|
|
368
|
+
sharing_in=models.SharingIn(
|
|
369
|
+
org_id=org_id,
|
|
370
|
+
level=level,
|
|
371
|
+
share_with_uuid=share_with_uuid,
|
|
372
|
+
share_with_type=share_with_type,
|
|
373
|
+
),
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
req = self._build_request_async(
|
|
377
|
+
method="PUT",
|
|
378
|
+
path="/v1/libraries/{library_id}/share",
|
|
379
|
+
base_url=base_url,
|
|
380
|
+
url_variables=url_variables,
|
|
381
|
+
request=request,
|
|
382
|
+
request_body_required=True,
|
|
383
|
+
request_has_path_params=True,
|
|
384
|
+
request_has_query_params=True,
|
|
385
|
+
user_agent_header="user-agent",
|
|
386
|
+
accept_header_value="application/json",
|
|
387
|
+
http_headers=http_headers,
|
|
388
|
+
security=self.sdk_configuration.security,
|
|
389
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
390
|
+
request.sharing_in, False, False, "json", models.SharingIn
|
|
391
|
+
),
|
|
392
|
+
timeout_ms=timeout_ms,
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
if retries == UNSET:
|
|
396
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
397
|
+
retries = self.sdk_configuration.retry_config
|
|
398
|
+
|
|
399
|
+
retry_config = None
|
|
400
|
+
if isinstance(retries, utils.RetryConfig):
|
|
401
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
402
|
+
|
|
403
|
+
http_res = await self.do_request_async(
|
|
404
|
+
hook_ctx=HookContext(
|
|
405
|
+
config=self.sdk_configuration,
|
|
406
|
+
base_url=base_url or "",
|
|
407
|
+
operation_id="libraries_share_create_v1",
|
|
408
|
+
oauth2_scopes=[],
|
|
409
|
+
security_source=get_security_from_env(
|
|
410
|
+
self.sdk_configuration.security, models.Security
|
|
411
|
+
),
|
|
412
|
+
),
|
|
413
|
+
request=req,
|
|
414
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
415
|
+
retry_config=retry_config,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
response_data: Any = None
|
|
419
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
420
|
+
return utils.unmarshal_json(http_res.text, models.SharingOut)
|
|
421
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
422
|
+
response_data = utils.unmarshal_json(
|
|
423
|
+
http_res.text, models.HTTPValidationErrorData
|
|
424
|
+
)
|
|
425
|
+
raise models.HTTPValidationError(data=response_data)
|
|
426
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
427
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
428
|
+
raise models.SDKError(
|
|
429
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
430
|
+
)
|
|
431
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
432
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
433
|
+
raise models.SDKError(
|
|
434
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
content_type = http_res.headers.get("Content-Type")
|
|
438
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
439
|
+
raise models.SDKError(
|
|
440
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
441
|
+
http_res.status_code,
|
|
442
|
+
http_res_text,
|
|
443
|
+
http_res,
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
def delete(
|
|
447
|
+
self,
|
|
448
|
+
*,
|
|
449
|
+
library_id: str,
|
|
450
|
+
org_id: str,
|
|
451
|
+
share_with_uuid: str,
|
|
452
|
+
share_with_type: models.EntityType,
|
|
453
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
454
|
+
server_url: Optional[str] = None,
|
|
455
|
+
timeout_ms: Optional[int] = None,
|
|
456
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
457
|
+
) -> models.SharingOut:
|
|
458
|
+
r"""Delete an access level.
|
|
459
|
+
|
|
460
|
+
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.
|
|
461
|
+
|
|
462
|
+
:param library_id:
|
|
463
|
+
:param org_id:
|
|
464
|
+
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
465
|
+
:param share_with_type: The type of entity, used to share a library.
|
|
466
|
+
:param retries: Override the default retry configuration for this method
|
|
467
|
+
:param server_url: Override the default server URL for this method
|
|
468
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
469
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
470
|
+
"""
|
|
471
|
+
base_url = None
|
|
472
|
+
url_variables = None
|
|
473
|
+
if timeout_ms is None:
|
|
474
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
475
|
+
|
|
476
|
+
if server_url is not None:
|
|
477
|
+
base_url = server_url
|
|
478
|
+
else:
|
|
479
|
+
base_url = self._get_url(base_url, url_variables)
|
|
480
|
+
|
|
481
|
+
request = models.LibrariesShareDeleteV1Request(
|
|
482
|
+
library_id=library_id,
|
|
483
|
+
sharing_delete=models.SharingDelete(
|
|
484
|
+
org_id=org_id,
|
|
485
|
+
share_with_uuid=share_with_uuid,
|
|
486
|
+
share_with_type=share_with_type,
|
|
487
|
+
),
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
req = self._build_request(
|
|
491
|
+
method="DELETE",
|
|
492
|
+
path="/v1/libraries/{library_id}/share",
|
|
493
|
+
base_url=base_url,
|
|
494
|
+
url_variables=url_variables,
|
|
495
|
+
request=request,
|
|
496
|
+
request_body_required=True,
|
|
497
|
+
request_has_path_params=True,
|
|
498
|
+
request_has_query_params=True,
|
|
499
|
+
user_agent_header="user-agent",
|
|
500
|
+
accept_header_value="application/json",
|
|
501
|
+
http_headers=http_headers,
|
|
502
|
+
security=self.sdk_configuration.security,
|
|
503
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
504
|
+
request.sharing_delete, False, False, "json", models.SharingDelete
|
|
505
|
+
),
|
|
506
|
+
timeout_ms=timeout_ms,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
if retries == UNSET:
|
|
510
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
511
|
+
retries = self.sdk_configuration.retry_config
|
|
512
|
+
|
|
513
|
+
retry_config = None
|
|
514
|
+
if isinstance(retries, utils.RetryConfig):
|
|
515
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
516
|
+
|
|
517
|
+
http_res = self.do_request(
|
|
518
|
+
hook_ctx=HookContext(
|
|
519
|
+
config=self.sdk_configuration,
|
|
520
|
+
base_url=base_url or "",
|
|
521
|
+
operation_id="libraries_share_delete_v1",
|
|
522
|
+
oauth2_scopes=[],
|
|
523
|
+
security_source=get_security_from_env(
|
|
524
|
+
self.sdk_configuration.security, models.Security
|
|
525
|
+
),
|
|
526
|
+
),
|
|
527
|
+
request=req,
|
|
528
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
529
|
+
retry_config=retry_config,
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
response_data: Any = None
|
|
533
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
534
|
+
return utils.unmarshal_json(http_res.text, models.SharingOut)
|
|
535
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
536
|
+
response_data = utils.unmarshal_json(
|
|
537
|
+
http_res.text, models.HTTPValidationErrorData
|
|
538
|
+
)
|
|
539
|
+
raise models.HTTPValidationError(data=response_data)
|
|
540
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
541
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
542
|
+
raise models.SDKError(
|
|
543
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
544
|
+
)
|
|
545
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
546
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
547
|
+
raise models.SDKError(
|
|
548
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
549
|
+
)
|
|
550
|
+
|
|
551
|
+
content_type = http_res.headers.get("Content-Type")
|
|
552
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
553
|
+
raise models.SDKError(
|
|
554
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
555
|
+
http_res.status_code,
|
|
556
|
+
http_res_text,
|
|
557
|
+
http_res,
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
async def delete_async(
|
|
561
|
+
self,
|
|
562
|
+
*,
|
|
563
|
+
library_id: str,
|
|
564
|
+
org_id: str,
|
|
565
|
+
share_with_uuid: str,
|
|
566
|
+
share_with_type: models.EntityType,
|
|
567
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
568
|
+
server_url: Optional[str] = None,
|
|
569
|
+
timeout_ms: Optional[int] = None,
|
|
570
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
571
|
+
) -> models.SharingOut:
|
|
572
|
+
r"""Delete an access level.
|
|
573
|
+
|
|
574
|
+
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.
|
|
575
|
+
|
|
576
|
+
:param library_id:
|
|
577
|
+
:param org_id:
|
|
578
|
+
:param share_with_uuid: The id of the entity (user, workspace or organization) to share with
|
|
579
|
+
:param share_with_type: The type of entity, used to share a library.
|
|
580
|
+
:param retries: Override the default retry configuration for this method
|
|
581
|
+
:param server_url: Override the default server URL for this method
|
|
582
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
583
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
584
|
+
"""
|
|
585
|
+
base_url = None
|
|
586
|
+
url_variables = None
|
|
587
|
+
if timeout_ms is None:
|
|
588
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
589
|
+
|
|
590
|
+
if server_url is not None:
|
|
591
|
+
base_url = server_url
|
|
592
|
+
else:
|
|
593
|
+
base_url = self._get_url(base_url, url_variables)
|
|
594
|
+
|
|
595
|
+
request = models.LibrariesShareDeleteV1Request(
|
|
596
|
+
library_id=library_id,
|
|
597
|
+
sharing_delete=models.SharingDelete(
|
|
598
|
+
org_id=org_id,
|
|
599
|
+
share_with_uuid=share_with_uuid,
|
|
600
|
+
share_with_type=share_with_type,
|
|
601
|
+
),
|
|
602
|
+
)
|
|
603
|
+
|
|
604
|
+
req = self._build_request_async(
|
|
605
|
+
method="DELETE",
|
|
606
|
+
path="/v1/libraries/{library_id}/share",
|
|
607
|
+
base_url=base_url,
|
|
608
|
+
url_variables=url_variables,
|
|
609
|
+
request=request,
|
|
610
|
+
request_body_required=True,
|
|
611
|
+
request_has_path_params=True,
|
|
612
|
+
request_has_query_params=True,
|
|
613
|
+
user_agent_header="user-agent",
|
|
614
|
+
accept_header_value="application/json",
|
|
615
|
+
http_headers=http_headers,
|
|
616
|
+
security=self.sdk_configuration.security,
|
|
617
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
618
|
+
request.sharing_delete, False, False, "json", models.SharingDelete
|
|
619
|
+
),
|
|
620
|
+
timeout_ms=timeout_ms,
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
if retries == UNSET:
|
|
624
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
625
|
+
retries = self.sdk_configuration.retry_config
|
|
626
|
+
|
|
627
|
+
retry_config = None
|
|
628
|
+
if isinstance(retries, utils.RetryConfig):
|
|
629
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
630
|
+
|
|
631
|
+
http_res = await self.do_request_async(
|
|
632
|
+
hook_ctx=HookContext(
|
|
633
|
+
config=self.sdk_configuration,
|
|
634
|
+
base_url=base_url or "",
|
|
635
|
+
operation_id="libraries_share_delete_v1",
|
|
636
|
+
oauth2_scopes=[],
|
|
637
|
+
security_source=get_security_from_env(
|
|
638
|
+
self.sdk_configuration.security, models.Security
|
|
639
|
+
),
|
|
640
|
+
),
|
|
641
|
+
request=req,
|
|
642
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
643
|
+
retry_config=retry_config,
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
response_data: Any = None
|
|
647
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
648
|
+
return utils.unmarshal_json(http_res.text, models.SharingOut)
|
|
649
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
650
|
+
response_data = utils.unmarshal_json(
|
|
651
|
+
http_res.text, models.HTTPValidationErrorData
|
|
652
|
+
)
|
|
653
|
+
raise models.HTTPValidationError(data=response_data)
|
|
654
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
655
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
656
|
+
raise models.SDKError(
|
|
657
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
658
|
+
)
|
|
659
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
660
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
661
|
+
raise models.SDKError(
|
|
662
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
content_type = http_res.headers.get("Content-Type")
|
|
666
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
667
|
+
raise models.SDKError(
|
|
668
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
669
|
+
http_res.status_code,
|
|
670
|
+
http_res_text,
|
|
671
|
+
http_res,
|
|
672
|
+
)
|