label-studio-sdk 2.0.5__py3-none-any.whl → 2.0.7__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.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

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