label-studio-sdk 2.0.0__py3-none-any.whl → 2.0.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.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +24 -0
- label_studio_sdk/actions/client.py +13 -13
- label_studio_sdk/actions/types/actions_list_response_item.py +3 -3
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +2 -2
- label_studio_sdk/annotations/client.py +441 -441
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/billing/__init__.py +2 -0
- label_studio_sdk/billing/client.py +112 -0
- label_studio_sdk/comments/client.py +176 -176
- label_studio_sdk/export_storage/azure/client.py +274 -274
- label_studio_sdk/export_storage/gcs/client.py +263 -263
- label_studio_sdk/export_storage/local/client.py +206 -206
- label_studio_sdk/export_storage/redis/client.py +287 -287
- label_studio_sdk/export_storage/s3/client.py +347 -347
- label_studio_sdk/export_storage/s3s/client.py +678 -678
- label_studio_sdk/import_storage/azure/client.py +357 -357
- label_studio_sdk/import_storage/gcs/client.py +357 -357
- label_studio_sdk/import_storage/local/client.py +206 -206
- label_studio_sdk/import_storage/redis/client.py +309 -309
- label_studio_sdk/import_storage/s3/client.py +452 -452
- label_studio_sdk/import_storage/s3s/client.py +735 -735
- label_studio_sdk/jwt_settings/client.py +10 -10
- label_studio_sdk/ml/client.py +118 -118
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +1 -1
- label_studio_sdk/model_providers/client.py +181 -181
- label_studio_sdk/organizations/members/client.py +348 -2
- label_studio_sdk/predictions/client.py +60 -60
- label_studio_sdk/projects/__init__.py +30 -1
- label_studio_sdk/projects/assignments/__init__.py +33 -0
- label_studio_sdk/projects/assignments/client.py +764 -0
- label_studio_sdk/projects/assignments/types/__init__.py +35 -0
- label_studio_sdk/projects/assignments/types/assignments_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters.py +33 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_conjunction.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item.py +44 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_value.py +7 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items.py +9 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_excluded.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_included.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_response.py +22 -0
- label_studio_sdk/projects/assignments/types/assignments_update_request_type.py +5 -0
- label_studio_sdk/projects/client.py +441 -425
- label_studio_sdk/projects/exports/client.py +55 -55
- label_studio_sdk/projects/exports/types/exports_convert_response.py +1 -1
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +5 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +12 -12
- label_studio_sdk/prompts/client.py +211 -211
- label_studio_sdk/prompts/runs/client.py +33 -33
- label_studio_sdk/prompts/versions/client.py +72 -72
- label_studio_sdk/tasks/client.py +174 -174
- label_studio_sdk/types/__init__.py +22 -0
- label_studio_sdk/types/all_roles_project_list.py +98 -98
- label_studio_sdk/types/annotation.py +35 -35
- label_studio_sdk/types/annotation_request.py +27 -27
- label_studio_sdk/types/azure_blob_export_storage.py +29 -29
- label_studio_sdk/types/azure_blob_import_storage.py +33 -33
- label_studio_sdk/types/batch_failed_predictions.py +1 -1
- label_studio_sdk/types/billing_checks.py +39 -0
- label_studio_sdk/types/billing_flags.py +44 -0
- label_studio_sdk/types/billing_info_response.py +22 -0
- label_studio_sdk/types/blueprint_list.py +7 -8
- label_studio_sdk/types/child_filter.py +11 -10
- label_studio_sdk/types/comment.py +15 -15
- label_studio_sdk/types/comment_request.py +7 -8
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +17 -18
- label_studio_sdk/types/converted_format.py +1 -1
- label_studio_sdk/types/converted_format_request.py +1 -1
- label_studio_sdk/types/count_limit.py +22 -0
- label_studio_sdk/types/export.py +8 -8
- label_studio_sdk/types/file_upload.py +3 -2
- label_studio_sdk/types/filter.py +10 -9
- label_studio_sdk/types/filter_group.py +4 -3
- label_studio_sdk/types/gcs_export_storage.py +23 -23
- label_studio_sdk/types/gcs_import_storage.py +27 -27
- label_studio_sdk/types/import_api_request.py +26 -26
- label_studio_sdk/types/inference_run_cost_estimate.py +10 -10
- label_studio_sdk/types/local_files_export_storage.py +23 -23
- label_studio_sdk/types/local_files_import_storage.py +26 -26
- label_studio_sdk/types/lse_annotation_filter_options.py +10 -10
- label_studio_sdk/types/lse_annotation_filter_options_request.py +10 -10
- label_studio_sdk/types/lse_export_create.py +12 -12
- label_studio_sdk/types/lse_fields.py +14 -14
- label_studio_sdk/types/lse_organization.py +17 -17
- label_studio_sdk/types/lse_organization_member_list.py +32 -0
- label_studio_sdk/types/lse_project_create.py +72 -72
- label_studio_sdk/types/lse_project_update.py +89 -89
- label_studio_sdk/types/lse_s3export_storage.py +46 -46
- label_studio_sdk/types/lse_s3export_storage_request.py +43 -43
- label_studio_sdk/types/lse_s3import_storage.py +53 -53
- label_studio_sdk/types/lse_s3import_storage_request.py +49 -49
- label_studio_sdk/types/lse_task.py +49 -49
- label_studio_sdk/types/lse_task_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_filter_options.py +14 -14
- label_studio_sdk/types/lse_task_filter_options_request.py +14 -14
- label_studio_sdk/types/lse_task_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +12 -12
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +49 -49
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +5 -5
- label_studio_sdk/types/lse_user.py +13 -13
- label_studio_sdk/types/lse_user_api.py +11 -11
- label_studio_sdk/types/lse_user_organization_member_list.py +48 -0
- label_studio_sdk/types/lseapi_token_create.py +1 -1
- label_studio_sdk/types/lseapi_token_list.py +1 -1
- label_studio_sdk/types/lsejwt_settings.py +5 -5
- label_studio_sdk/types/ml_backend.py +27 -28
- label_studio_sdk/types/model_interface.py +12 -12
- label_studio_sdk/types/model_interface_request.py +7 -8
- label_studio_sdk/types/model_interface_serializer_get.py +13 -13
- label_studio_sdk/types/model_provider_connection.py +34 -34
- label_studio_sdk/types/model_provider_connection_request.py +15 -14
- label_studio_sdk/types/model_run.py +12 -12
- label_studio_sdk/types/organization_billing.py +1 -1
- label_studio_sdk/types/organization_id.py +2 -2
- label_studio_sdk/types/organization_invite.py +1 -1
- label_studio_sdk/types/organization_member.py +8 -9
- label_studio_sdk/types/organization_membership.py +2 -1
- label_studio_sdk/types/paginated_lse_organization_member_list_list.py +23 -0
- label_studio_sdk/types/pause.py +23 -23
- label_studio_sdk/types/prediction.py +21 -21
- label_studio_sdk/types/prediction_request.py +16 -16
- label_studio_sdk/types/project.py +72 -72
- label_studio_sdk/types/project_import.py +21 -21
- label_studio_sdk/types/prompts_status_enum.py +16 -0
- label_studio_sdk/types/redis_export_storage.py +34 -34
- label_studio_sdk/types/redis_import_storage.py +37 -37
- label_studio_sdk/types/refined_prompt_response.py +11 -11
- label_studio_sdk/types/review_settings.py +29 -30
- label_studio_sdk/types/review_settings_request.py +29 -30
- label_studio_sdk/types/role9e7enum.py +5 -0
- label_studio_sdk/types/s3export_storage.py +45 -45
- label_studio_sdk/types/s3import_storage.py +44 -44
- label_studio_sdk/types/selected_items_request.py +1 -1
- label_studio_sdk/types/serialization_options.py +10 -10
- label_studio_sdk/types/serialization_options_request.py +10 -10
- label_studio_sdk/types/task_assignment.py +43 -0
- label_studio_sdk/types/third_party_model_version.py +11 -11
- label_studio_sdk/types/third_party_model_version_request.py +6 -7
- label_studio_sdk/types/type_enum.py +5 -0
- label_studio_sdk/types/user_simple.py +3 -3
- label_studio_sdk/types/user_simple_request.py +1 -1
- label_studio_sdk/types/version_response.py +19 -20
- label_studio_sdk/types/view.py +8 -8
- label_studio_sdk/types/webhook.py +16 -16
- label_studio_sdk/types/webhook_serializer_for_update.py +16 -16
- label_studio_sdk/types/workspace.py +10 -11
- label_studio_sdk/users/client.py +160 -160
- label_studio_sdk/views/client.py +164 -164
- label_studio_sdk/webhooks/client.py +183 -183
- label_studio_sdk/webhooks/types/webhooks_info_response.py +32 -32
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +1 -1
- label_studio_sdk/workspaces/client.py +40 -40
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/METADATA +73 -25
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/RECORD +175 -146
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/WHEEL +0 -0
|
@@ -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.
|
|
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
|
+
role: typing.Optional[Role9E7Enum] = OMIT,
|
|
116
|
+
user_id: typing.Optional[int] = 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
|
+
role : typing.Optional[Role9E7Enum]
|
|
140
|
+
|
|
141
|
+
user_id : typing.Optional[int]
|
|
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
|
+
"role": role,
|
|
167
|
+
"user_id": user_id,
|
|
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
|
+
role: typing.Optional[Role9E7Enum] = OMIT,
|
|
416
|
+
user_id: typing.Optional[int] = 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
|
+
role : typing.Optional[Role9E7Enum]
|
|
440
|
+
|
|
441
|
+
user_id : typing.Optional[int]
|
|
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
|
+
"role": role,
|
|
475
|
+
"user_id": user_id,
|
|
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:
|