label-studio-sdk 2.0.6__py3-none-any.whl → 2.0.8__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.
- label_studio_sdk/__init__.py +32 -2
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/converter/exports/yolo.py +89 -74
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/import_storage/azure_spi/client.py +30 -0
- label_studio_sdk/label_interface/control_tags.py +38 -0
- label_studio_sdk/label_interface/data_examples.json +10 -0
- label_studio_sdk/label_interface/interface.py +13 -0
- label_studio_sdk/label_interface/object_tags.py +9 -0
- label_studio_sdk/ml/client.py +124 -0
- label_studio_sdk/organizations/__init__.py +3 -2
- label_studio_sdk/organizations/client.py +540 -1
- label_studio_sdk/organizations/invites/__init__.py +2 -0
- label_studio_sdk/organizations/invites/client.py +368 -0
- label_studio_sdk/organizations/permissions/__init__.py +2 -0
- label_studio_sdk/organizations/permissions/client.py +1129 -0
- label_studio_sdk/organizations/types/__init__.py +5 -0
- label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/project_templates/__init__.py +2 -0
- label_studio_sdk/project_templates/client.py +909 -0
- label_studio_sdk/projects/__init__.py +30 -0
- label_studio_sdk/projects/client.py +355 -0
- label_studio_sdk/projects/stats/__init__.py +28 -0
- label_studio_sdk/projects/stats/client.py +1002 -43
- label_studio_sdk/projects/stats/types/__init__.py +30 -0
- label_studio_sdk/projects/stats/types/stats_agreement_annotator_response.py +26 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response.py +23 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response_user_filters.py +34 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response_user_filters_stats_item.py +22 -0
- label_studio_sdk/projects/stats/types/stats_finished_tasks_response.py +32 -0
- label_studio_sdk/projects/stats/types/stats_lead_time_response.py +23 -0
- label_studio_sdk/projects/stats/types/stats_lead_time_response_lead_time_stats_item.py +37 -0
- label_studio_sdk/projects/stats/types/stats_user_ground_truth_agreement_response.py +20 -0
- label_studio_sdk/projects/stats/types/stats_user_ground_truth_agreement_response_agreement.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_prediction_agreement_response.py +24 -0
- label_studio_sdk/projects/stats/types/stats_user_prediction_agreement_response_average_prediction_agreement_per_user.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response.py +22 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response_performance_score.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response_review_score.py +5 -0
- label_studio_sdk/projects/types/__init__.py +2 -0
- label_studio_sdk/projects/types/projects_import_predictions_response.py +26 -0
- label_studio_sdk/prompts/versions/client.py +4 -16
- label_studio_sdk/types/__init__.py +26 -2
- label_studio_sdk/types/azure_service_principal_import_storage.py +5 -0
- label_studio_sdk/types/azure_service_principal_import_storage_request.py +5 -0
- label_studio_sdk/types/configurable_permission_option.py +25 -0
- label_studio_sdk/types/configurable_permission_option_default.py +7 -0
- label_studio_sdk/types/default_role.py +75 -0
- label_studio_sdk/types/default_role_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/types/lse_organization.py +2 -2
- label_studio_sdk/types/lse_project.py +223 -0
- label_studio_sdk/types/lse_project_counts.py +46 -0
- label_studio_sdk/types/lse_project_sampling.py +7 -0
- label_studio_sdk/types/lse_project_skip_queue.py +7 -0
- label_studio_sdk/types/lse_task.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -1
- label_studio_sdk/types/organization_permission.py +31 -0
- label_studio_sdk/types/organization_permission_request.py +24 -0
- label_studio_sdk/types/paginated_lse_project_counts_list.py +23 -0
- label_studio_sdk/types/project_template.py +41 -0
- label_studio_sdk/types/project_template_request.py +38 -0
- label_studio_sdk/types/who_am_i_user.py +1 -0
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/RECORD +66 -31
- label_studio_sdk/types/default_role_enum.py +0 -5
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/WHEEL +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
import typing
|
|
3
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from .invites.client import InvitesClient
|
|
4
6
|
from .members.client import MembersClient
|
|
5
|
-
import
|
|
7
|
+
from .permissions.client import PermissionsClient
|
|
6
8
|
from ..core.request_options import RequestOptions
|
|
7
9
|
from ..types.organization_invite import OrganizationInvite
|
|
8
10
|
from ..core.unchecked_base_model import construct_type
|
|
@@ -11,14 +13,31 @@ from ..core.api_error import ApiError
|
|
|
11
13
|
from ..types.organization_id import OrganizationId
|
|
12
14
|
from ..types.lse_organization import LseOrganization
|
|
13
15
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
16
|
+
from ..errors.bad_request_error import BadRequestError
|
|
17
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
18
|
+
from ..errors.not_found_error import NotFoundError
|
|
19
|
+
import datetime as dt
|
|
20
|
+
from .types.patched_default_role_request_custom_scripts_editable_by import (
|
|
21
|
+
PatchedDefaultRoleRequestCustomScriptsEditableBy,
|
|
22
|
+
)
|
|
23
|
+
from ..types.role9e7enum import Role9E7Enum
|
|
24
|
+
from ..types.default_role import DefaultRole
|
|
25
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
14
26
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
27
|
+
from .invites.client import AsyncInvitesClient
|
|
15
28
|
from .members.client import AsyncMembersClient
|
|
29
|
+
from .permissions.client import AsyncPermissionsClient
|
|
30
|
+
|
|
31
|
+
# this is used as the default value for optional parameters
|
|
32
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
33
|
|
|
17
34
|
|
|
18
35
|
class OrganizationsClient:
|
|
19
36
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
37
|
self._client_wrapper = client_wrapper
|
|
38
|
+
self.invites = InvitesClient(client_wrapper=self._client_wrapper)
|
|
21
39
|
self.members = MembersClient(client_wrapper=self._client_wrapper)
|
|
40
|
+
self.permissions = PermissionsClient(client_wrapper=self._client_wrapper)
|
|
22
41
|
|
|
23
42
|
def reset_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> OrganizationInvite:
|
|
24
43
|
"""
|
|
@@ -160,11 +179,264 @@ class OrganizationsClient:
|
|
|
160
179
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
161
180
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
162
181
|
|
|
182
|
+
def update(
|
|
183
|
+
self,
|
|
184
|
+
id: int,
|
|
185
|
+
*,
|
|
186
|
+
contact_info: typing.Optional[str] = OMIT,
|
|
187
|
+
created_by: typing.Optional[int] = OMIT,
|
|
188
|
+
custom_scripts_editable_by: typing.Optional[str] = OMIT,
|
|
189
|
+
custom_scripts_enabled: typing.Optional[bool] = OMIT,
|
|
190
|
+
email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
191
|
+
embed_domains: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT,
|
|
192
|
+
embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
193
|
+
title: typing.Optional[str] = OMIT,
|
|
194
|
+
token: typing.Optional[str] = OMIT,
|
|
195
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
196
|
+
) -> LseOrganization:
|
|
197
|
+
"""
|
|
198
|
+
Update organization details including title, embed domains, and custom scripts settings.
|
|
199
|
+
|
|
200
|
+
Parameters
|
|
201
|
+
----------
|
|
202
|
+
id : int
|
|
203
|
+
|
|
204
|
+
contact_info : typing.Optional[str]
|
|
205
|
+
|
|
206
|
+
created_by : typing.Optional[int]
|
|
207
|
+
|
|
208
|
+
custom_scripts_editable_by : typing.Optional[str]
|
|
209
|
+
|
|
210
|
+
custom_scripts_enabled : typing.Optional[bool]
|
|
211
|
+
|
|
212
|
+
email_notification_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
213
|
+
|
|
214
|
+
embed_domains : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
|
|
215
|
+
|
|
216
|
+
embed_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
217
|
+
|
|
218
|
+
title : typing.Optional[str]
|
|
219
|
+
|
|
220
|
+
token : typing.Optional[str]
|
|
221
|
+
|
|
222
|
+
request_options : typing.Optional[RequestOptions]
|
|
223
|
+
Request-specific configuration.
|
|
224
|
+
|
|
225
|
+
Returns
|
|
226
|
+
-------
|
|
227
|
+
LseOrganization
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
Examples
|
|
231
|
+
--------
|
|
232
|
+
from label_studio_sdk import LabelStudio
|
|
233
|
+
|
|
234
|
+
client = LabelStudio(
|
|
235
|
+
api_key="YOUR_API_KEY",
|
|
236
|
+
)
|
|
237
|
+
client.organizations.update(
|
|
238
|
+
id=1,
|
|
239
|
+
)
|
|
240
|
+
"""
|
|
241
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
242
|
+
f"api/organizations/{jsonable_encoder(id)}",
|
|
243
|
+
method="PATCH",
|
|
244
|
+
json={
|
|
245
|
+
"contact_info": contact_info,
|
|
246
|
+
"created_by": created_by,
|
|
247
|
+
"custom_scripts_editable_by": custom_scripts_editable_by,
|
|
248
|
+
"custom_scripts_enabled": custom_scripts_enabled,
|
|
249
|
+
"email_notification_settings": email_notification_settings,
|
|
250
|
+
"embed_domains": embed_domains,
|
|
251
|
+
"embed_settings": embed_settings,
|
|
252
|
+
"title": title,
|
|
253
|
+
"token": token,
|
|
254
|
+
},
|
|
255
|
+
headers={
|
|
256
|
+
"content-type": "application/json",
|
|
257
|
+
},
|
|
258
|
+
request_options=request_options,
|
|
259
|
+
omit=OMIT,
|
|
260
|
+
)
|
|
261
|
+
try:
|
|
262
|
+
if 200 <= _response.status_code < 300:
|
|
263
|
+
return typing.cast(
|
|
264
|
+
LseOrganization,
|
|
265
|
+
construct_type(
|
|
266
|
+
type_=LseOrganization, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
if _response.status_code == 400:
|
|
271
|
+
raise BadRequestError(
|
|
272
|
+
typing.cast(
|
|
273
|
+
typing.Optional[typing.Any],
|
|
274
|
+
construct_type(
|
|
275
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
276
|
+
object_=_response.json(),
|
|
277
|
+
),
|
|
278
|
+
)
|
|
279
|
+
)
|
|
280
|
+
if _response.status_code == 403:
|
|
281
|
+
raise ForbiddenError(
|
|
282
|
+
typing.cast(
|
|
283
|
+
typing.Optional[typing.Any],
|
|
284
|
+
construct_type(
|
|
285
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
286
|
+
object_=_response.json(),
|
|
287
|
+
),
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
if _response.status_code == 404:
|
|
291
|
+
raise NotFoundError(
|
|
292
|
+
typing.cast(
|
|
293
|
+
typing.Optional[typing.Any],
|
|
294
|
+
construct_type(
|
|
295
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
296
|
+
object_=_response.json(),
|
|
297
|
+
),
|
|
298
|
+
)
|
|
299
|
+
)
|
|
300
|
+
_response_json = _response.json()
|
|
301
|
+
except JSONDecodeError:
|
|
302
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
303
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
304
|
+
|
|
305
|
+
def update_default_role(
|
|
306
|
+
self,
|
|
307
|
+
id: int,
|
|
308
|
+
*,
|
|
309
|
+
annotator_reviewer_firewall_enabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
310
|
+
custom_scripts_editable_by: typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy] = OMIT,
|
|
311
|
+
custom_scripts_enabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
312
|
+
default_role: typing.Optional[Role9E7Enum] = OMIT,
|
|
313
|
+
email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
314
|
+
embed_domains: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
315
|
+
embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
316
|
+
external_id: typing.Optional[str] = OMIT,
|
|
317
|
+
extra_data_on_activity_logs: typing.Optional[bool] = OMIT,
|
|
318
|
+
label_stream_navigation_disabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
319
|
+
organization: typing.Optional[int] = OMIT,
|
|
320
|
+
read_only_quick_view_enabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
321
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
322
|
+
) -> DefaultRole:
|
|
323
|
+
"""
|
|
324
|
+
Update the default role for members of a specific organization.
|
|
325
|
+
|
|
326
|
+
Parameters
|
|
327
|
+
----------
|
|
328
|
+
id : int
|
|
329
|
+
|
|
330
|
+
annotator_reviewer_firewall_enabled_at : typing.Optional[dt.datetime]
|
|
331
|
+
Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI.
|
|
332
|
+
|
|
333
|
+
custom_scripts_editable_by : typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy]
|
|
334
|
+
Set the minimum user role that can edit custom scripts in the UI.
|
|
335
|
+
|
|
336
|
+
* `AD` - Administrator
|
|
337
|
+
* `MA` - Manager
|
|
338
|
+
|
|
339
|
+
custom_scripts_enabled_at : typing.Optional[dt.datetime]
|
|
340
|
+
Set to current time to enabled custom scripts for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts.
|
|
341
|
+
|
|
342
|
+
default_role : typing.Optional[Role9E7Enum]
|
|
343
|
+
Default membership role for invited users
|
|
344
|
+
|
|
345
|
+
* `OW` - Owner
|
|
346
|
+
* `AD` - Administrator
|
|
347
|
+
* `MA` - Manager
|
|
348
|
+
* `RE` - Reviewer
|
|
349
|
+
* `AN` - Annotator
|
|
350
|
+
* `DI` - Deactivated
|
|
351
|
+
* `NO` - Not Activated
|
|
352
|
+
|
|
353
|
+
email_notification_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
354
|
+
|
|
355
|
+
embed_domains : typing.Optional[typing.Optional[typing.Any]]
|
|
356
|
+
|
|
357
|
+
embed_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
358
|
+
|
|
359
|
+
external_id : typing.Optional[str]
|
|
360
|
+
External ID to uniquely identify this organization
|
|
361
|
+
|
|
362
|
+
extra_data_on_activity_logs : typing.Optional[bool]
|
|
363
|
+
|
|
364
|
+
label_stream_navigation_disabled_at : typing.Optional[dt.datetime]
|
|
365
|
+
Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels.
|
|
366
|
+
|
|
367
|
+
organization : typing.Optional[int]
|
|
368
|
+
A unique integer value identifying this organization.
|
|
369
|
+
|
|
370
|
+
read_only_quick_view_enabled_at : typing.Optional[dt.datetime]
|
|
371
|
+
Set to current time to prevent creating or editing annotations in quick view.
|
|
372
|
+
|
|
373
|
+
request_options : typing.Optional[RequestOptions]
|
|
374
|
+
Request-specific configuration.
|
|
375
|
+
|
|
376
|
+
Returns
|
|
377
|
+
-------
|
|
378
|
+
DefaultRole
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
Examples
|
|
382
|
+
--------
|
|
383
|
+
from label_studio_sdk import LabelStudio
|
|
384
|
+
|
|
385
|
+
client = LabelStudio(
|
|
386
|
+
api_key="YOUR_API_KEY",
|
|
387
|
+
)
|
|
388
|
+
client.organizations.update_default_role(
|
|
389
|
+
id=1,
|
|
390
|
+
)
|
|
391
|
+
"""
|
|
392
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
393
|
+
f"api/organizations/{jsonable_encoder(id)}/set-default-role",
|
|
394
|
+
method="PATCH",
|
|
395
|
+
json={
|
|
396
|
+
"annotator_reviewer_firewall_enabled_at": annotator_reviewer_firewall_enabled_at,
|
|
397
|
+
"custom_scripts_editable_by": convert_and_respect_annotation_metadata(
|
|
398
|
+
object_=custom_scripts_editable_by,
|
|
399
|
+
annotation=PatchedDefaultRoleRequestCustomScriptsEditableBy,
|
|
400
|
+
direction="write",
|
|
401
|
+
),
|
|
402
|
+
"custom_scripts_enabled_at": custom_scripts_enabled_at,
|
|
403
|
+
"default_role": default_role,
|
|
404
|
+
"email_notification_settings": email_notification_settings,
|
|
405
|
+
"embed_domains": embed_domains,
|
|
406
|
+
"embed_settings": embed_settings,
|
|
407
|
+
"external_id": external_id,
|
|
408
|
+
"extra_data_on_activity_logs": extra_data_on_activity_logs,
|
|
409
|
+
"label_stream_navigation_disabled_at": label_stream_navigation_disabled_at,
|
|
410
|
+
"organization": organization,
|
|
411
|
+
"read_only_quick_view_enabled_at": read_only_quick_view_enabled_at,
|
|
412
|
+
},
|
|
413
|
+
headers={
|
|
414
|
+
"content-type": "application/json",
|
|
415
|
+
},
|
|
416
|
+
request_options=request_options,
|
|
417
|
+
omit=OMIT,
|
|
418
|
+
)
|
|
419
|
+
try:
|
|
420
|
+
if 200 <= _response.status_code < 300:
|
|
421
|
+
return typing.cast(
|
|
422
|
+
DefaultRole,
|
|
423
|
+
construct_type(
|
|
424
|
+
type_=DefaultRole, # type: ignore
|
|
425
|
+
object_=_response.json(),
|
|
426
|
+
),
|
|
427
|
+
)
|
|
428
|
+
_response_json = _response.json()
|
|
429
|
+
except JSONDecodeError:
|
|
430
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
431
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
432
|
+
|
|
163
433
|
|
|
164
434
|
class AsyncOrganizationsClient:
|
|
165
435
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
166
436
|
self._client_wrapper = client_wrapper
|
|
437
|
+
self.invites = AsyncInvitesClient(client_wrapper=self._client_wrapper)
|
|
167
438
|
self.members = AsyncMembersClient(client_wrapper=self._client_wrapper)
|
|
439
|
+
self.permissions = AsyncPermissionsClient(client_wrapper=self._client_wrapper)
|
|
168
440
|
|
|
169
441
|
async def reset_token(self, *, request_options: typing.Optional[RequestOptions] = None) -> OrganizationInvite:
|
|
170
442
|
"""
|
|
@@ -329,3 +601,270 @@ class AsyncOrganizationsClient:
|
|
|
329
601
|
except JSONDecodeError:
|
|
330
602
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
331
603
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
604
|
+
|
|
605
|
+
async def update(
|
|
606
|
+
self,
|
|
607
|
+
id: int,
|
|
608
|
+
*,
|
|
609
|
+
contact_info: typing.Optional[str] = OMIT,
|
|
610
|
+
created_by: typing.Optional[int] = OMIT,
|
|
611
|
+
custom_scripts_editable_by: typing.Optional[str] = OMIT,
|
|
612
|
+
custom_scripts_enabled: typing.Optional[bool] = OMIT,
|
|
613
|
+
email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
614
|
+
embed_domains: typing.Optional[typing.Sequence[typing.Dict[str, str]]] = OMIT,
|
|
615
|
+
embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
616
|
+
title: typing.Optional[str] = OMIT,
|
|
617
|
+
token: typing.Optional[str] = OMIT,
|
|
618
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
619
|
+
) -> LseOrganization:
|
|
620
|
+
"""
|
|
621
|
+
Update organization details including title, embed domains, and custom scripts settings.
|
|
622
|
+
|
|
623
|
+
Parameters
|
|
624
|
+
----------
|
|
625
|
+
id : int
|
|
626
|
+
|
|
627
|
+
contact_info : typing.Optional[str]
|
|
628
|
+
|
|
629
|
+
created_by : typing.Optional[int]
|
|
630
|
+
|
|
631
|
+
custom_scripts_editable_by : typing.Optional[str]
|
|
632
|
+
|
|
633
|
+
custom_scripts_enabled : typing.Optional[bool]
|
|
634
|
+
|
|
635
|
+
email_notification_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
636
|
+
|
|
637
|
+
embed_domains : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
|
|
638
|
+
|
|
639
|
+
embed_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
640
|
+
|
|
641
|
+
title : typing.Optional[str]
|
|
642
|
+
|
|
643
|
+
token : typing.Optional[str]
|
|
644
|
+
|
|
645
|
+
request_options : typing.Optional[RequestOptions]
|
|
646
|
+
Request-specific configuration.
|
|
647
|
+
|
|
648
|
+
Returns
|
|
649
|
+
-------
|
|
650
|
+
LseOrganization
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
Examples
|
|
654
|
+
--------
|
|
655
|
+
import asyncio
|
|
656
|
+
|
|
657
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
658
|
+
|
|
659
|
+
client = AsyncLabelStudio(
|
|
660
|
+
api_key="YOUR_API_KEY",
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
async def main() -> None:
|
|
665
|
+
await client.organizations.update(
|
|
666
|
+
id=1,
|
|
667
|
+
)
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
asyncio.run(main())
|
|
671
|
+
"""
|
|
672
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
673
|
+
f"api/organizations/{jsonable_encoder(id)}",
|
|
674
|
+
method="PATCH",
|
|
675
|
+
json={
|
|
676
|
+
"contact_info": contact_info,
|
|
677
|
+
"created_by": created_by,
|
|
678
|
+
"custom_scripts_editable_by": custom_scripts_editable_by,
|
|
679
|
+
"custom_scripts_enabled": custom_scripts_enabled,
|
|
680
|
+
"email_notification_settings": email_notification_settings,
|
|
681
|
+
"embed_domains": embed_domains,
|
|
682
|
+
"embed_settings": embed_settings,
|
|
683
|
+
"title": title,
|
|
684
|
+
"token": token,
|
|
685
|
+
},
|
|
686
|
+
headers={
|
|
687
|
+
"content-type": "application/json",
|
|
688
|
+
},
|
|
689
|
+
request_options=request_options,
|
|
690
|
+
omit=OMIT,
|
|
691
|
+
)
|
|
692
|
+
try:
|
|
693
|
+
if 200 <= _response.status_code < 300:
|
|
694
|
+
return typing.cast(
|
|
695
|
+
LseOrganization,
|
|
696
|
+
construct_type(
|
|
697
|
+
type_=LseOrganization, # type: ignore
|
|
698
|
+
object_=_response.json(),
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
if _response.status_code == 400:
|
|
702
|
+
raise BadRequestError(
|
|
703
|
+
typing.cast(
|
|
704
|
+
typing.Optional[typing.Any],
|
|
705
|
+
construct_type(
|
|
706
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
707
|
+
object_=_response.json(),
|
|
708
|
+
),
|
|
709
|
+
)
|
|
710
|
+
)
|
|
711
|
+
if _response.status_code == 403:
|
|
712
|
+
raise ForbiddenError(
|
|
713
|
+
typing.cast(
|
|
714
|
+
typing.Optional[typing.Any],
|
|
715
|
+
construct_type(
|
|
716
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
717
|
+
object_=_response.json(),
|
|
718
|
+
),
|
|
719
|
+
)
|
|
720
|
+
)
|
|
721
|
+
if _response.status_code == 404:
|
|
722
|
+
raise NotFoundError(
|
|
723
|
+
typing.cast(
|
|
724
|
+
typing.Optional[typing.Any],
|
|
725
|
+
construct_type(
|
|
726
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
727
|
+
object_=_response.json(),
|
|
728
|
+
),
|
|
729
|
+
)
|
|
730
|
+
)
|
|
731
|
+
_response_json = _response.json()
|
|
732
|
+
except JSONDecodeError:
|
|
733
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
734
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
735
|
+
|
|
736
|
+
async def update_default_role(
|
|
737
|
+
self,
|
|
738
|
+
id: int,
|
|
739
|
+
*,
|
|
740
|
+
annotator_reviewer_firewall_enabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
741
|
+
custom_scripts_editable_by: typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy] = OMIT,
|
|
742
|
+
custom_scripts_enabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
743
|
+
default_role: typing.Optional[Role9E7Enum] = OMIT,
|
|
744
|
+
email_notification_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
745
|
+
embed_domains: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
746
|
+
embed_settings: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
747
|
+
external_id: typing.Optional[str] = OMIT,
|
|
748
|
+
extra_data_on_activity_logs: typing.Optional[bool] = OMIT,
|
|
749
|
+
label_stream_navigation_disabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
750
|
+
organization: typing.Optional[int] = OMIT,
|
|
751
|
+
read_only_quick_view_enabled_at: typing.Optional[dt.datetime] = OMIT,
|
|
752
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
753
|
+
) -> DefaultRole:
|
|
754
|
+
"""
|
|
755
|
+
Update the default role for members of a specific organization.
|
|
756
|
+
|
|
757
|
+
Parameters
|
|
758
|
+
----------
|
|
759
|
+
id : int
|
|
760
|
+
|
|
761
|
+
annotator_reviewer_firewall_enabled_at : typing.Optional[dt.datetime]
|
|
762
|
+
Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI.
|
|
763
|
+
|
|
764
|
+
custom_scripts_editable_by : typing.Optional[PatchedDefaultRoleRequestCustomScriptsEditableBy]
|
|
765
|
+
Set the minimum user role that can edit custom scripts in the UI.
|
|
766
|
+
|
|
767
|
+
* `AD` - Administrator
|
|
768
|
+
* `MA` - Manager
|
|
769
|
+
|
|
770
|
+
custom_scripts_enabled_at : typing.Optional[dt.datetime]
|
|
771
|
+
Set to current time to enabled custom scripts for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts.
|
|
772
|
+
|
|
773
|
+
default_role : typing.Optional[Role9E7Enum]
|
|
774
|
+
Default membership role for invited users
|
|
775
|
+
|
|
776
|
+
* `OW` - Owner
|
|
777
|
+
* `AD` - Administrator
|
|
778
|
+
* `MA` - Manager
|
|
779
|
+
* `RE` - Reviewer
|
|
780
|
+
* `AN` - Annotator
|
|
781
|
+
* `DI` - Deactivated
|
|
782
|
+
* `NO` - Not Activated
|
|
783
|
+
|
|
784
|
+
email_notification_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
785
|
+
|
|
786
|
+
embed_domains : typing.Optional[typing.Optional[typing.Any]]
|
|
787
|
+
|
|
788
|
+
embed_settings : typing.Optional[typing.Optional[typing.Any]]
|
|
789
|
+
|
|
790
|
+
external_id : typing.Optional[str]
|
|
791
|
+
External ID to uniquely identify this organization
|
|
792
|
+
|
|
793
|
+
extra_data_on_activity_logs : typing.Optional[bool]
|
|
794
|
+
|
|
795
|
+
label_stream_navigation_disabled_at : typing.Optional[dt.datetime]
|
|
796
|
+
Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels.
|
|
797
|
+
|
|
798
|
+
organization : typing.Optional[int]
|
|
799
|
+
A unique integer value identifying this organization.
|
|
800
|
+
|
|
801
|
+
read_only_quick_view_enabled_at : typing.Optional[dt.datetime]
|
|
802
|
+
Set to current time to prevent creating or editing annotations in quick view.
|
|
803
|
+
|
|
804
|
+
request_options : typing.Optional[RequestOptions]
|
|
805
|
+
Request-specific configuration.
|
|
806
|
+
|
|
807
|
+
Returns
|
|
808
|
+
-------
|
|
809
|
+
DefaultRole
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
Examples
|
|
813
|
+
--------
|
|
814
|
+
import asyncio
|
|
815
|
+
|
|
816
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
817
|
+
|
|
818
|
+
client = AsyncLabelStudio(
|
|
819
|
+
api_key="YOUR_API_KEY",
|
|
820
|
+
)
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
async def main() -> None:
|
|
824
|
+
await client.organizations.update_default_role(
|
|
825
|
+
id=1,
|
|
826
|
+
)
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
asyncio.run(main())
|
|
830
|
+
"""
|
|
831
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
832
|
+
f"api/organizations/{jsonable_encoder(id)}/set-default-role",
|
|
833
|
+
method="PATCH",
|
|
834
|
+
json={
|
|
835
|
+
"annotator_reviewer_firewall_enabled_at": annotator_reviewer_firewall_enabled_at,
|
|
836
|
+
"custom_scripts_editable_by": convert_and_respect_annotation_metadata(
|
|
837
|
+
object_=custom_scripts_editable_by,
|
|
838
|
+
annotation=PatchedDefaultRoleRequestCustomScriptsEditableBy,
|
|
839
|
+
direction="write",
|
|
840
|
+
),
|
|
841
|
+
"custom_scripts_enabled_at": custom_scripts_enabled_at,
|
|
842
|
+
"default_role": default_role,
|
|
843
|
+
"email_notification_settings": email_notification_settings,
|
|
844
|
+
"embed_domains": embed_domains,
|
|
845
|
+
"embed_settings": embed_settings,
|
|
846
|
+
"external_id": external_id,
|
|
847
|
+
"extra_data_on_activity_logs": extra_data_on_activity_logs,
|
|
848
|
+
"label_stream_navigation_disabled_at": label_stream_navigation_disabled_at,
|
|
849
|
+
"organization": organization,
|
|
850
|
+
"read_only_quick_view_enabled_at": read_only_quick_view_enabled_at,
|
|
851
|
+
},
|
|
852
|
+
headers={
|
|
853
|
+
"content-type": "application/json",
|
|
854
|
+
},
|
|
855
|
+
request_options=request_options,
|
|
856
|
+
omit=OMIT,
|
|
857
|
+
)
|
|
858
|
+
try:
|
|
859
|
+
if 200 <= _response.status_code < 300:
|
|
860
|
+
return typing.cast(
|
|
861
|
+
DefaultRole,
|
|
862
|
+
construct_type(
|
|
863
|
+
type_=DefaultRole, # type: ignore
|
|
864
|
+
object_=_response.json(),
|
|
865
|
+
),
|
|
866
|
+
)
|
|
867
|
+
_response_json = _response.json()
|
|
868
|
+
except JSONDecodeError:
|
|
869
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
870
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|