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

@@ -20,6 +20,9 @@ from .types import (
20
20
  AzureBlobImportStorage,
21
21
  BatchFailedPredictions,
22
22
  BatchPredictions,
23
+ BillingChecks,
24
+ BillingFlags,
25
+ BillingInfoResponse,
23
26
  BlankEnum,
24
27
  BlueprintList,
25
28
  BudgetResetPeriodEnum,
@@ -29,6 +32,7 @@ from .types import (
29
32
  CommentSerializerWithExpandedUser,
30
33
  ConvertedFormat,
31
34
  ConvertedFormatRequest,
35
+ CountLimit,
32
36
  CustomScriptsEditableByEnum,
33
37
  DefaultRoleEnum,
34
38
  EditionEnum,
@@ -57,6 +61,7 @@ from .types import (
57
61
  LseKeyIndicatorValue,
58
62
  LseOrganization,
59
63
  LseOrganizationCustomScriptsEditableBy,
64
+ LseOrganizationMemberList,
60
65
  LseProjectCreate,
61
66
  LseProjectCreateSampling,
62
67
  LseProjectCreateSkipQueue,
@@ -88,6 +93,7 @@ from .types import (
88
93
  LseTaskSerializerForReviewersPredictionsItem,
89
94
  LseUser,
90
95
  LseUserApi,
96
+ LseUserOrganizationMemberList,
91
97
  LseapiTokenCreate,
92
98
  LseapiTokenList,
93
99
  LsejwtSettings,
@@ -110,6 +116,7 @@ from .types import (
110
116
  OrganizationMember,
111
117
  OrganizationMembership,
112
118
  PaginatedAllRolesProjectListList,
119
+ PaginatedLseOrganizationMemberListList,
113
120
  PaginatedRoleBasedTaskList,
114
121
  Pause,
115
122
  PauseRequest,
@@ -122,6 +129,7 @@ from .types import (
122
129
  ProjectSampling,
123
130
  ProjectSkipQueue,
124
131
  ProjectSubsetEnum,
132
+ PromptsStatusEnum,
125
133
  ProviderEnum,
126
134
  ReasonEnum,
127
135
  RedisExportStorage,
@@ -136,6 +144,7 @@ from .types import (
136
144
  ReviewSettingsRequeueRejectedTasksMode,
137
145
  ReviewSettingsReviewCriteria,
138
146
  ReviewedEnum,
147
+ Role9E7Enum,
139
148
  RoleBasedTask,
140
149
  S3ExportStorage,
141
150
  S3ImportStorage,
@@ -178,6 +187,7 @@ from .errors import (
178
187
  from . import (
179
188
  actions,
180
189
  annotations,
190
+ billing,
181
191
  comments,
182
192
  export_storage,
183
193
  files,
@@ -307,6 +317,9 @@ __all__ = [
307
317
  "BadRequestError",
308
318
  "BatchFailedPredictions",
309
319
  "BatchPredictions",
320
+ "BillingChecks",
321
+ "BillingFlags",
322
+ "BillingInfoResponse",
310
323
  "BlankEnum",
311
324
  "BlueprintList",
312
325
  "BudgetResetPeriodEnum",
@@ -317,6 +330,7 @@ __all__ = [
317
330
  "CommentSerializerWithExpandedUser",
318
331
  "ConvertedFormat",
319
332
  "ConvertedFormatRequest",
333
+ "CountLimit",
320
334
  "CustomScriptsEditableByEnum",
321
335
  "DefaultRoleEnum",
322
336
  "EditionEnum",
@@ -351,6 +365,7 @@ __all__ = [
351
365
  "LseKeyIndicatorValue",
352
366
  "LseOrganization",
353
367
  "LseOrganizationCustomScriptsEditableBy",
368
+ "LseOrganizationMemberList",
354
369
  "LseProjectCreate",
355
370
  "LseProjectCreateRequestSampling",
356
371
  "LseProjectCreateRequestSkipQueue",
@@ -384,6 +399,7 @@ __all__ = [
384
399
  "LseTaskSerializerForReviewersPredictionsItem",
385
400
  "LseUser",
386
401
  "LseUserApi",
402
+ "LseUserOrganizationMemberList",
387
403
  "LseapiTokenCreate",
388
404
  "LseapiTokenList",
389
405
  "LsejwtSettings",
@@ -412,6 +428,7 @@ __all__ = [
412
428
  "OrganizationMember",
413
429
  "OrganizationMembership",
414
430
  "PaginatedAllRolesProjectListList",
431
+ "PaginatedLseOrganizationMemberListList",
415
432
  "PaginatedRoleBasedTaskList",
416
433
  "PatchedLseProjectUpdateRequestSampling",
417
434
  "PatchedLseProjectUpdateRequestSkipQueue",
@@ -430,6 +447,7 @@ __all__ = [
430
447
  "ProjectsImportTasksResponse",
431
448
  "ProjectsListRequestFilter",
432
449
  "PromptsCompatibleProjectsRequestProjectType",
450
+ "PromptsStatusEnum",
433
451
  "ProviderEnum",
434
452
  "ReasonEnum",
435
453
  "RedisExportStorage",
@@ -444,6 +462,7 @@ __all__ = [
444
462
  "ReviewSettingsRequeueRejectedTasksMode",
445
463
  "ReviewSettingsReviewCriteria",
446
464
  "ReviewedEnum",
465
+ "Role9E7Enum",
447
466
  "RoleBasedTask",
448
467
  "S3ExportStorage",
449
468
  "S3ImportStorage",
@@ -513,6 +532,7 @@ __all__ = [
513
532
  "__version__",
514
533
  "actions",
515
534
  "annotations",
535
+ "billing",
516
536
  "comments",
517
537
  "export_storage",
518
538
  "files",
@@ -7,6 +7,7 @@ import httpx
7
7
  from .core.api_error import ApiError
8
8
  from .core.client_wrapper import SyncClientWrapper
9
9
  from .annotations.client import AnnotationsClient
10
+ from .billing.client import BillingClient
10
11
  from .comments.client import CommentsClient
11
12
  from .users.client import UsersClient
12
13
  from .actions.client import ActionsClient
@@ -28,6 +29,7 @@ from .webhooks.client import WebhooksClient
28
29
  from .workspaces.client import WorkspacesClient
29
30
  from .core.client_wrapper import AsyncClientWrapper
30
31
  from .annotations.client import AsyncAnnotationsClient
32
+ from .billing.client import AsyncBillingClient
31
33
  from .comments.client import AsyncCommentsClient
32
34
  from .users.client import AsyncUsersClient
33
35
  from .actions.client import AsyncActionsClient
@@ -112,6 +114,7 @@ class LabelStudioBase:
112
114
  timeout=_defaulted_timeout,
113
115
  )
114
116
  self.annotations = AnnotationsClient(client_wrapper=self._client_wrapper)
117
+ self.billing = BillingClient(client_wrapper=self._client_wrapper)
115
118
  self.comments = CommentsClient(client_wrapper=self._client_wrapper)
116
119
  self.users = UsersClient(client_wrapper=self._client_wrapper)
117
120
  self.actions = ActionsClient(client_wrapper=self._client_wrapper)
@@ -196,6 +199,7 @@ class AsyncLabelStudioBase:
196
199
  timeout=_defaulted_timeout,
197
200
  )
198
201
  self.annotations = AsyncAnnotationsClient(client_wrapper=self._client_wrapper)
202
+ self.billing = AsyncBillingClient(client_wrapper=self._client_wrapper)
199
203
  self.comments = AsyncCommentsClient(client_wrapper=self._client_wrapper)
200
204
  self.users = AsyncUsersClient(client_wrapper=self._client_wrapper)
201
205
  self.actions = AsyncActionsClient(client_wrapper=self._client_wrapper)
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -0,0 +1,112 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.client_wrapper import SyncClientWrapper
4
+ import typing
5
+ from ..core.request_options import RequestOptions
6
+ from ..types.billing_info_response import BillingInfoResponse
7
+ from ..core.unchecked_base_model import construct_type
8
+ from json.decoder import JSONDecodeError
9
+ from ..core.api_error import ApiError
10
+ from ..core.client_wrapper import AsyncClientWrapper
11
+
12
+
13
+ class BillingClient:
14
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
15
+ self._client_wrapper = client_wrapper
16
+
17
+ def info(self, *, request_options: typing.Optional[RequestOptions] = None) -> BillingInfoResponse:
18
+ """
19
+ Retrieve billing checks and feature flags for the active organization.
20
+
21
+ Parameters
22
+ ----------
23
+ request_options : typing.Optional[RequestOptions]
24
+ Request-specific configuration.
25
+
26
+ Returns
27
+ -------
28
+ BillingInfoResponse
29
+ Billing information for the active organization
30
+
31
+ Examples
32
+ --------
33
+ from label_studio_sdk import LabelStudio
34
+
35
+ client = LabelStudio(
36
+ api_key="YOUR_API_KEY",
37
+ )
38
+ client.billing.info()
39
+ """
40
+ _response = self._client_wrapper.httpx_client.request(
41
+ "api/billing/info",
42
+ method="GET",
43
+ request_options=request_options,
44
+ )
45
+ try:
46
+ if 200 <= _response.status_code < 300:
47
+ return typing.cast(
48
+ BillingInfoResponse,
49
+ construct_type(
50
+ type_=BillingInfoResponse, # type: ignore
51
+ object_=_response.json(),
52
+ ),
53
+ )
54
+ _response_json = _response.json()
55
+ except JSONDecodeError:
56
+ raise ApiError(status_code=_response.status_code, body=_response.text)
57
+ raise ApiError(status_code=_response.status_code, body=_response_json)
58
+
59
+
60
+ class AsyncBillingClient:
61
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
62
+ self._client_wrapper = client_wrapper
63
+
64
+ async def info(self, *, request_options: typing.Optional[RequestOptions] = None) -> BillingInfoResponse:
65
+ """
66
+ Retrieve billing checks and feature flags for the active organization.
67
+
68
+ Parameters
69
+ ----------
70
+ request_options : typing.Optional[RequestOptions]
71
+ Request-specific configuration.
72
+
73
+ Returns
74
+ -------
75
+ BillingInfoResponse
76
+ Billing information for the active organization
77
+
78
+ Examples
79
+ --------
80
+ import asyncio
81
+
82
+ from label_studio_sdk import AsyncLabelStudio
83
+
84
+ client = AsyncLabelStudio(
85
+ api_key="YOUR_API_KEY",
86
+ )
87
+
88
+
89
+ async def main() -> None:
90
+ await client.billing.info()
91
+
92
+
93
+ asyncio.run(main())
94
+ """
95
+ _response = await self._client_wrapper.httpx_client.request(
96
+ "api/billing/info",
97
+ method="GET",
98
+ request_options=request_options,
99
+ )
100
+ try:
101
+ if 200 <= _response.status_code < 300:
102
+ return typing.cast(
103
+ BillingInfoResponse,
104
+ construct_type(
105
+ type_=BillingInfoResponse, # type: ignore
106
+ object_=_response.json(),
107
+ ),
108
+ )
109
+ _response_json = _response.json()
110
+ except JSONDecodeError:
111
+ raise ApiError(status_code=_response.status_code, body=_response.text)
112
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,23 +1,191 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from ...core.client_wrapper import SyncClientWrapper
4
3
  import typing
4
+ from ...core.client_wrapper import SyncClientWrapper
5
5
  from ...core.request_options import RequestOptions
6
- from ...types.organization_member import OrganizationMember
6
+ from ...types.paginated_lse_organization_member_list_list import PaginatedLseOrganizationMemberListList
7
7
  from ...core.jsonable_encoder import jsonable_encoder
8
8
  from ...core.unchecked_base_model import construct_type
9
9
  from json.decoder import JSONDecodeError
10
10
  from ...core.api_error import ApiError
11
+ from ...types.role9e7enum import Role9E7Enum
12
+ from ...types.lse_organization_member_list import LseOrganizationMemberList
13
+ from ...types.organization_member import OrganizationMember
11
14
  from ...errors.forbidden_error import ForbiddenError
12
15
  from ...errors.not_found_error import NotFoundError
13
16
  from ...errors.method_not_allowed_error import MethodNotAllowedError
14
17
  from ...core.client_wrapper import AsyncClientWrapper
15
18
 
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
16
22
 
17
23
  class MembersClient:
18
24
  def __init__(self, *, client_wrapper: SyncClientWrapper):
19
25
  self._client_wrapper = client_wrapper
20
26
 
27
+ def list(
28
+ self,
29
+ id: int,
30
+ *,
31
+ exclude_project_id: typing.Optional[int] = None,
32
+ exclude_workspace_id: typing.Optional[int] = None,
33
+ ordering: typing.Optional[str] = None,
34
+ page: typing.Optional[int] = None,
35
+ page_size: typing.Optional[int] = None,
36
+ search: typing.Optional[str] = None,
37
+ request_options: typing.Optional[RequestOptions] = None,
38
+ ) -> PaginatedLseOrganizationMemberListList:
39
+ """
40
+ Retrieve a list of all users and roles in a specific organization.
41
+
42
+ Parameters
43
+ ----------
44
+ id : int
45
+ A unique integer value identifying this organization.
46
+
47
+ exclude_project_id : typing.Optional[int]
48
+ Project ID to exclude users who are already associated with this project (direct members, workspace members, or implicit admin/owner access).
49
+
50
+ exclude_workspace_id : typing.Optional[int]
51
+ Workspace ID to exclude users who are already associated with this workspace (direct workspace members or implicit admin/owner access).
52
+
53
+ ordering : typing.Optional[str]
54
+ Which field to use when ordering the results.
55
+
56
+ page : typing.Optional[int]
57
+ A page number within the paginated result set.
58
+
59
+ page_size : typing.Optional[int]
60
+ Number of results to return per page.
61
+
62
+ search : typing.Optional[str]
63
+ A search term.
64
+
65
+ request_options : typing.Optional[RequestOptions]
66
+ Request-specific configuration.
67
+
68
+ Returns
69
+ -------
70
+ PaginatedLseOrganizationMemberListList
71
+
72
+
73
+ Examples
74
+ --------
75
+ from label_studio_sdk import LabelStudio
76
+
77
+ client = LabelStudio(
78
+ api_key="YOUR_API_KEY",
79
+ )
80
+ client.organizations.members.list(
81
+ id=1,
82
+ )
83
+ """
84
+ _response = self._client_wrapper.httpx_client.request(
85
+ f"api/organizations/{jsonable_encoder(id)}/memberships",
86
+ method="GET",
87
+ params={
88
+ "exclude_project_id": exclude_project_id,
89
+ "exclude_workspace_id": exclude_workspace_id,
90
+ "ordering": ordering,
91
+ "page": page,
92
+ "page_size": page_size,
93
+ "search": search,
94
+ },
95
+ request_options=request_options,
96
+ )
97
+ try:
98
+ if 200 <= _response.status_code < 300:
99
+ return typing.cast(
100
+ PaginatedLseOrganizationMemberListList,
101
+ construct_type(
102
+ type_=PaginatedLseOrganizationMemberListList, # type: ignore
103
+ object_=_response.json(),
104
+ ),
105
+ )
106
+ _response_json = _response.json()
107
+ except JSONDecodeError:
108
+ raise ApiError(status_code=_response.status_code, body=_response.text)
109
+ raise ApiError(status_code=_response.status_code, body=_response_json)
110
+
111
+ def update(
112
+ self,
113
+ id: int,
114
+ *,
115
+ user_id: typing.Optional[int] = OMIT,
116
+ role: typing.Optional[Role9E7Enum] = OMIT,
117
+ request_options: typing.Optional[RequestOptions] = None,
118
+ ) -> LseOrganizationMemberList:
119
+ """
120
+ Update organization membership or role for a specific user ID.
121
+
122
+ **User Rotation Best Practices for API Usage**
123
+
124
+ To maintain compliance with our licensing terms and ensure optimal performance of HumanSignal's APIs, please consider the following guidelines when managing user assignments:
125
+
126
+ * **Maintain a 7-Day Minimum Assignment**: Once a licensed seat is assigned to a user, maintain that assignment for at least seven consecutive days before rotating it to another user.
127
+
128
+ * **Automate, Monitor, and Log Rotations**: Implement automated scheduling and logging mechanisms to track the timing of user rotations. This helps ensure that rotations adhere to the seven-day minimum period.
129
+
130
+ * **Adhere to API Update Frequency and Wait Periods**: When updating user assignments via our APIs, follow the recommended frequency and wait period guidelines provided in the HumanSignal API documentation. Avoid sending rapid, successive requests that might overload the endpoint. Instead, incorporate appropriate delays between calls as specified in the documentation.
131
+
132
+ * **Avoid Overloading the API Endpoint**: Design your integration to batch or schedule updates where possible, and implement backoff strategies if the API indicates rate limiting. This helps prevent service disruptions and ensures a smooth operation.
133
+
134
+ Parameters
135
+ ----------
136
+ id : int
137
+ A unique integer value identifying this organization.
138
+
139
+ user_id : typing.Optional[int]
140
+
141
+ role : typing.Optional[Role9E7Enum]
142
+
143
+ request_options : typing.Optional[RequestOptions]
144
+ Request-specific configuration.
145
+
146
+ Returns
147
+ -------
148
+ LseOrganizationMemberList
149
+
150
+
151
+ Examples
152
+ --------
153
+ from label_studio_sdk import LabelStudio
154
+
155
+ client = LabelStudio(
156
+ api_key="YOUR_API_KEY",
157
+ )
158
+ client.organizations.members.update(
159
+ id=1,
160
+ )
161
+ """
162
+ _response = self._client_wrapper.httpx_client.request(
163
+ f"api/organizations/{jsonable_encoder(id)}/memberships",
164
+ method="PATCH",
165
+ json={
166
+ "user_id": user_id,
167
+ "role": role,
168
+ },
169
+ headers={
170
+ "content-type": "application/json",
171
+ },
172
+ request_options=request_options,
173
+ omit=OMIT,
174
+ )
175
+ try:
176
+ if 200 <= _response.status_code < 300:
177
+ return typing.cast(
178
+ LseOrganizationMemberList,
179
+ construct_type(
180
+ type_=LseOrganizationMemberList, # type: ignore
181
+ object_=_response.json(),
182
+ ),
183
+ )
184
+ _response_json = _response.json()
185
+ except JSONDecodeError:
186
+ raise ApiError(status_code=_response.status_code, body=_response.text)
187
+ raise ApiError(status_code=_response.status_code, body=_response_json)
188
+
21
189
  def get(
22
190
  self, id: int, user_pk: int, *, request_options: typing.Optional[RequestOptions] = None
23
191
  ) -> OrganizationMember:
@@ -148,6 +316,184 @@ class AsyncMembersClient:
148
316
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
149
317
  self._client_wrapper = client_wrapper
150
318
 
319
+ async def list(
320
+ self,
321
+ id: int,
322
+ *,
323
+ exclude_project_id: typing.Optional[int] = None,
324
+ exclude_workspace_id: typing.Optional[int] = None,
325
+ ordering: typing.Optional[str] = None,
326
+ page: typing.Optional[int] = None,
327
+ page_size: typing.Optional[int] = None,
328
+ search: typing.Optional[str] = None,
329
+ request_options: typing.Optional[RequestOptions] = None,
330
+ ) -> PaginatedLseOrganizationMemberListList:
331
+ """
332
+ Retrieve a list of all users and roles in a specific organization.
333
+
334
+ Parameters
335
+ ----------
336
+ id : int
337
+ A unique integer value identifying this organization.
338
+
339
+ exclude_project_id : typing.Optional[int]
340
+ Project ID to exclude users who are already associated with this project (direct members, workspace members, or implicit admin/owner access).
341
+
342
+ exclude_workspace_id : typing.Optional[int]
343
+ Workspace ID to exclude users who are already associated with this workspace (direct workspace members or implicit admin/owner access).
344
+
345
+ ordering : typing.Optional[str]
346
+ Which field to use when ordering the results.
347
+
348
+ page : typing.Optional[int]
349
+ A page number within the paginated result set.
350
+
351
+ page_size : typing.Optional[int]
352
+ Number of results to return per page.
353
+
354
+ search : typing.Optional[str]
355
+ A search term.
356
+
357
+ request_options : typing.Optional[RequestOptions]
358
+ Request-specific configuration.
359
+
360
+ Returns
361
+ -------
362
+ PaginatedLseOrganizationMemberListList
363
+
364
+
365
+ Examples
366
+ --------
367
+ import asyncio
368
+
369
+ from label_studio_sdk import AsyncLabelStudio
370
+
371
+ client = AsyncLabelStudio(
372
+ api_key="YOUR_API_KEY",
373
+ )
374
+
375
+
376
+ async def main() -> None:
377
+ await client.organizations.members.list(
378
+ id=1,
379
+ )
380
+
381
+
382
+ asyncio.run(main())
383
+ """
384
+ _response = await self._client_wrapper.httpx_client.request(
385
+ f"api/organizations/{jsonable_encoder(id)}/memberships",
386
+ method="GET",
387
+ params={
388
+ "exclude_project_id": exclude_project_id,
389
+ "exclude_workspace_id": exclude_workspace_id,
390
+ "ordering": ordering,
391
+ "page": page,
392
+ "page_size": page_size,
393
+ "search": search,
394
+ },
395
+ request_options=request_options,
396
+ )
397
+ try:
398
+ if 200 <= _response.status_code < 300:
399
+ return typing.cast(
400
+ PaginatedLseOrganizationMemberListList,
401
+ construct_type(
402
+ type_=PaginatedLseOrganizationMemberListList, # type: ignore
403
+ object_=_response.json(),
404
+ ),
405
+ )
406
+ _response_json = _response.json()
407
+ except JSONDecodeError:
408
+ raise ApiError(status_code=_response.status_code, body=_response.text)
409
+ raise ApiError(status_code=_response.status_code, body=_response_json)
410
+
411
+ async def update(
412
+ self,
413
+ id: int,
414
+ *,
415
+ user_id: typing.Optional[int] = OMIT,
416
+ role: typing.Optional[Role9E7Enum] = OMIT,
417
+ request_options: typing.Optional[RequestOptions] = None,
418
+ ) -> LseOrganizationMemberList:
419
+ """
420
+ Update organization membership or role for a specific user ID.
421
+
422
+ **User Rotation Best Practices for API Usage**
423
+
424
+ To maintain compliance with our licensing terms and ensure optimal performance of HumanSignal's APIs, please consider the following guidelines when managing user assignments:
425
+
426
+ * **Maintain a 7-Day Minimum Assignment**: Once a licensed seat is assigned to a user, maintain that assignment for at least seven consecutive days before rotating it to another user.
427
+
428
+ * **Automate, Monitor, and Log Rotations**: Implement automated scheduling and logging mechanisms to track the timing of user rotations. This helps ensure that rotations adhere to the seven-day minimum period.
429
+
430
+ * **Adhere to API Update Frequency and Wait Periods**: When updating user assignments via our APIs, follow the recommended frequency and wait period guidelines provided in the HumanSignal API documentation. Avoid sending rapid, successive requests that might overload the endpoint. Instead, incorporate appropriate delays between calls as specified in the documentation.
431
+
432
+ * **Avoid Overloading the API Endpoint**: Design your integration to batch or schedule updates where possible, and implement backoff strategies if the API indicates rate limiting. This helps prevent service disruptions and ensures a smooth operation.
433
+
434
+ Parameters
435
+ ----------
436
+ id : int
437
+ A unique integer value identifying this organization.
438
+
439
+ user_id : typing.Optional[int]
440
+
441
+ role : typing.Optional[Role9E7Enum]
442
+
443
+ request_options : typing.Optional[RequestOptions]
444
+ Request-specific configuration.
445
+
446
+ Returns
447
+ -------
448
+ LseOrganizationMemberList
449
+
450
+
451
+ Examples
452
+ --------
453
+ import asyncio
454
+
455
+ from label_studio_sdk import AsyncLabelStudio
456
+
457
+ client = AsyncLabelStudio(
458
+ api_key="YOUR_API_KEY",
459
+ )
460
+
461
+
462
+ async def main() -> None:
463
+ await client.organizations.members.update(
464
+ id=1,
465
+ )
466
+
467
+
468
+ asyncio.run(main())
469
+ """
470
+ _response = await self._client_wrapper.httpx_client.request(
471
+ f"api/organizations/{jsonable_encoder(id)}/memberships",
472
+ method="PATCH",
473
+ json={
474
+ "user_id": user_id,
475
+ "role": role,
476
+ },
477
+ headers={
478
+ "content-type": "application/json",
479
+ },
480
+ request_options=request_options,
481
+ omit=OMIT,
482
+ )
483
+ try:
484
+ if 200 <= _response.status_code < 300:
485
+ return typing.cast(
486
+ LseOrganizationMemberList,
487
+ construct_type(
488
+ type_=LseOrganizationMemberList, # type: ignore
489
+ object_=_response.json(),
490
+ ),
491
+ )
492
+ _response_json = _response.json()
493
+ except JSONDecodeError:
494
+ raise ApiError(status_code=_response.status_code, body=_response.text)
495
+ raise ApiError(status_code=_response.status_code, body=_response_json)
496
+
151
497
  async def get(
152
498
  self, id: int, user_pk: int, *, request_options: typing.Optional[RequestOptions] = None
153
499
  ) -> OrganizationMember: