label-studio-sdk 2.0.2__py3-none-any.whl → 2.0.4__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/base_client.py +4 -0
- label_studio_sdk/label_interface/interface.py +0 -4
- label_studio_sdk/projects/__init__.py +4 -1
- label_studio_sdk/projects/assignments/__init__.py +2 -0
- label_studio_sdk/projects/assignments/client.py +43 -6
- label_studio_sdk/projects/assignments/types/__init__.py +2 -0
- label_studio_sdk/projects/assignments/types/assignments_delete_request_type.py +5 -0
- label_studio_sdk/projects/client.py +4 -0
- label_studio_sdk/projects/members/__init__.py +6 -0
- label_studio_sdk/projects/members/bulk/__init__.py +5 -0
- label_studio_sdk/projects/members/bulk/client.py +273 -0
- label_studio_sdk/projects/members/bulk/types/__init__.py +6 -0
- label_studio_sdk/projects/members/bulk/types/bulk_delete_response.py +19 -0
- label_studio_sdk/projects/members/bulk/types/bulk_post_response.py +19 -0
- label_studio_sdk/projects/members/client.py +141 -0
- label_studio_sdk/sso/__init__.py +5 -0
- label_studio_sdk/sso/client.py +22 -0
- label_studio_sdk/sso/saml/__init__.py +2 -0
- label_studio_sdk/sso/saml/client.py +278 -0
- label_studio_sdk/sso/scim/__init__.py +2 -0
- label_studio_sdk/sso/scim/client.py +278 -0
- label_studio_sdk/types/__init__.py +22 -0
- label_studio_sdk/types/project_group.py +22 -0
- label_studio_sdk/types/project_group_request.py +22 -0
- label_studio_sdk/types/project_group_role_enum.py +5 -0
- label_studio_sdk/types/saml_settings.py +21 -0
- label_studio_sdk/types/saml_settings_update.py +22 -0
- label_studio_sdk/types/scim_settings.py +21 -0
- label_studio_sdk/types/scim_settings_update.py +22 -0
- label_studio_sdk/types/who_am_i_lse_fields.py +50 -0
- label_studio_sdk/types/who_am_i_lse_fields_onboarding_state.py +8 -0
- label_studio_sdk/types/who_am_i_lse_fields_trial_role.py +8 -0
- label_studio_sdk/types/who_am_i_user.py +49 -0
- label_studio_sdk/users/client.py +9 -8
- {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/RECORD +39 -14
- {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/WHEEL +0 -0
label_studio_sdk/__init__.py
CHANGED
|
@@ -123,6 +123,9 @@ from .types import (
|
|
|
123
123
|
Prediction,
|
|
124
124
|
PredictionRequest,
|
|
125
125
|
Project,
|
|
126
|
+
ProjectGroup,
|
|
127
|
+
ProjectGroupRequest,
|
|
128
|
+
ProjectGroupRoleEnum,
|
|
126
129
|
ProjectImport,
|
|
127
130
|
ProjectLabelConfig,
|
|
128
131
|
ProjectLabelConfigRequest,
|
|
@@ -148,7 +151,11 @@ from .types import (
|
|
|
148
151
|
RoleBasedTask,
|
|
149
152
|
S3ExportStorage,
|
|
150
153
|
S3ImportStorage,
|
|
154
|
+
SamlSettings,
|
|
155
|
+
SamlSettingsUpdate,
|
|
151
156
|
SamplingEnum,
|
|
157
|
+
ScimSettings,
|
|
158
|
+
ScimSettingsUpdate,
|
|
152
159
|
ScopeEnum,
|
|
153
160
|
SelectedItemsRequest,
|
|
154
161
|
SerializationOption,
|
|
@@ -174,6 +181,10 @@ from .types import (
|
|
|
174
181
|
View,
|
|
175
182
|
Webhook,
|
|
176
183
|
WebhookSerializerForUpdate,
|
|
184
|
+
WhoAmILseFields,
|
|
185
|
+
WhoAmILseFieldsOnboardingState,
|
|
186
|
+
WhoAmILseFieldsTrialRole,
|
|
187
|
+
WhoAmIUser,
|
|
177
188
|
Workspace,
|
|
178
189
|
WorkspaceMemberCreate,
|
|
179
190
|
WorkspaceMemberList,
|
|
@@ -201,6 +212,7 @@ from . import (
|
|
|
201
212
|
predictions,
|
|
202
213
|
projects,
|
|
203
214
|
prompts,
|
|
215
|
+
sso,
|
|
204
216
|
tasks,
|
|
205
217
|
tokens,
|
|
206
218
|
users,
|
|
@@ -439,6 +451,9 @@ __all__ = [
|
|
|
439
451
|
"Prediction",
|
|
440
452
|
"PredictionRequest",
|
|
441
453
|
"Project",
|
|
454
|
+
"ProjectGroup",
|
|
455
|
+
"ProjectGroupRequest",
|
|
456
|
+
"ProjectGroupRoleEnum",
|
|
442
457
|
"ProjectImport",
|
|
443
458
|
"ProjectLabelConfig",
|
|
444
459
|
"ProjectLabelConfigRequest",
|
|
@@ -468,7 +483,11 @@ __all__ = [
|
|
|
468
483
|
"RoleBasedTask",
|
|
469
484
|
"S3ExportStorage",
|
|
470
485
|
"S3ImportStorage",
|
|
486
|
+
"SamlSettings",
|
|
487
|
+
"SamlSettingsUpdate",
|
|
471
488
|
"SamplingEnum",
|
|
489
|
+
"ScimSettings",
|
|
490
|
+
"ScimSettingsUpdate",
|
|
472
491
|
"ScopeEnum",
|
|
473
492
|
"SelectedItemsRequest",
|
|
474
493
|
"SerializationOption",
|
|
@@ -530,6 +549,10 @@ __all__ = [
|
|
|
530
549
|
"WebhooksInfoResponseReviewsDeleted",
|
|
531
550
|
"WebhooksInfoResponseTasksCreated",
|
|
532
551
|
"WebhooksInfoResponseTasksDeleted",
|
|
552
|
+
"WhoAmILseFields",
|
|
553
|
+
"WhoAmILseFieldsOnboardingState",
|
|
554
|
+
"WhoAmILseFieldsTrialRole",
|
|
555
|
+
"WhoAmIUser",
|
|
533
556
|
"Workspace",
|
|
534
557
|
"WorkspaceMemberCreate",
|
|
535
558
|
"WorkspaceMemberList",
|
|
@@ -548,6 +571,7 @@ __all__ = [
|
|
|
548
571
|
"predictions",
|
|
549
572
|
"projects",
|
|
550
573
|
"prompts",
|
|
574
|
+
"sso",
|
|
551
575
|
"tasks",
|
|
552
576
|
"tokens",
|
|
553
577
|
"users",
|
label_studio_sdk/base_client.py
CHANGED
|
@@ -27,6 +27,7 @@ from .tokens.client import TokensClient
|
|
|
27
27
|
from .versions.client import VersionsClient
|
|
28
28
|
from .webhooks.client import WebhooksClient
|
|
29
29
|
from .workspaces.client import WorkspacesClient
|
|
30
|
+
from .sso.client import SsoClient
|
|
30
31
|
from .core.client_wrapper import AsyncClientWrapper
|
|
31
32
|
from .annotations.client import AsyncAnnotationsClient
|
|
32
33
|
from .billing.client import AsyncBillingClient
|
|
@@ -49,6 +50,7 @@ from .tokens.client import AsyncTokensClient
|
|
|
49
50
|
from .versions.client import AsyncVersionsClient
|
|
50
51
|
from .webhooks.client import AsyncWebhooksClient
|
|
51
52
|
from .workspaces.client import AsyncWorkspacesClient
|
|
53
|
+
from .sso.client import AsyncSsoClient
|
|
52
54
|
|
|
53
55
|
|
|
54
56
|
class LabelStudioBase:
|
|
@@ -134,6 +136,7 @@ class LabelStudioBase:
|
|
|
134
136
|
self.versions = VersionsClient(client_wrapper=self._client_wrapper)
|
|
135
137
|
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
|
|
136
138
|
self.workspaces = WorkspacesClient(client_wrapper=self._client_wrapper)
|
|
139
|
+
self.sso = SsoClient(client_wrapper=self._client_wrapper)
|
|
137
140
|
|
|
138
141
|
|
|
139
142
|
class AsyncLabelStudioBase:
|
|
@@ -219,6 +222,7 @@ class AsyncLabelStudioBase:
|
|
|
219
222
|
self.versions = AsyncVersionsClient(client_wrapper=self._client_wrapper)
|
|
220
223
|
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
|
|
221
224
|
self.workspaces = AsyncWorkspacesClient(client_wrapper=self._client_wrapper)
|
|
225
|
+
self.sso = AsyncSsoClient(client_wrapper=self._client_wrapper)
|
|
222
226
|
|
|
223
227
|
|
|
224
228
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: LabelStudioEnvironment) -> str:
|
|
@@ -762,10 +762,6 @@ class LabelInterface:
|
|
|
762
762
|
errors.append(f"'{RESULT_KEY}' must be a list")
|
|
763
763
|
return errors
|
|
764
764
|
|
|
765
|
-
if not result:
|
|
766
|
-
errors.append(f"'{RESULT_KEY}' cannot be empty")
|
|
767
|
-
return errors
|
|
768
|
-
|
|
769
765
|
# Validate score if present
|
|
770
766
|
if 'score' in obj:
|
|
771
767
|
score = obj['score']
|
|
@@ -9,7 +9,7 @@ from .types import (
|
|
|
9
9
|
ProjectsImportTasksResponse,
|
|
10
10
|
ProjectsListRequestFilter,
|
|
11
11
|
)
|
|
12
|
-
from . import assignments, exports, pauses, stats
|
|
12
|
+
from . import assignments, exports, members, pauses, stats
|
|
13
13
|
from .assignments import (
|
|
14
14
|
AssignmentsAssignRequestType,
|
|
15
15
|
AssignmentsBulkAssignRequestFilters,
|
|
@@ -23,6 +23,7 @@ from .assignments import (
|
|
|
23
23
|
AssignmentsBulkAssignRequestSelectedItemsIncluded,
|
|
24
24
|
AssignmentsBulkAssignRequestType,
|
|
25
25
|
AssignmentsBulkAssignResponse,
|
|
26
|
+
AssignmentsDeleteRequestType,
|
|
26
27
|
AssignmentsUpdateRequestType,
|
|
27
28
|
)
|
|
28
29
|
from .exports import ExportsConvertResponse
|
|
@@ -41,6 +42,7 @@ __all__ = [
|
|
|
41
42
|
"AssignmentsBulkAssignRequestSelectedItemsIncluded",
|
|
42
43
|
"AssignmentsBulkAssignRequestType",
|
|
43
44
|
"AssignmentsBulkAssignResponse",
|
|
45
|
+
"AssignmentsDeleteRequestType",
|
|
44
46
|
"AssignmentsUpdateRequestType",
|
|
45
47
|
"ExportsConvertResponse",
|
|
46
48
|
"LseProjectCreateRequestSampling",
|
|
@@ -56,6 +58,7 @@ __all__ = [
|
|
|
56
58
|
"StatsIaaResponseStd",
|
|
57
59
|
"assignments",
|
|
58
60
|
"exports",
|
|
61
|
+
"members",
|
|
59
62
|
"pauses",
|
|
60
63
|
"stats",
|
|
61
64
|
]
|
|
@@ -13,6 +13,7 @@ from .types import (
|
|
|
13
13
|
AssignmentsBulkAssignRequestSelectedItemsIncluded,
|
|
14
14
|
AssignmentsBulkAssignRequestType,
|
|
15
15
|
AssignmentsBulkAssignResponse,
|
|
16
|
+
AssignmentsDeleteRequestType,
|
|
16
17
|
AssignmentsUpdateRequestType,
|
|
17
18
|
)
|
|
18
19
|
|
|
@@ -29,5 +30,6 @@ __all__ = [
|
|
|
29
30
|
"AssignmentsBulkAssignRequestSelectedItemsIncluded",
|
|
30
31
|
"AssignmentsBulkAssignRequestType",
|
|
31
32
|
"AssignmentsBulkAssignResponse",
|
|
33
|
+
"AssignmentsDeleteRequestType",
|
|
32
34
|
"AssignmentsUpdateRequestType",
|
|
33
35
|
]
|
|
@@ -15,6 +15,7 @@ from json.decoder import JSONDecodeError
|
|
|
15
15
|
from ...core.api_error import ApiError
|
|
16
16
|
from ...types.task_assignment import TaskAssignment
|
|
17
17
|
from .types.assignments_assign_request_type import AssignmentsAssignRequestType
|
|
18
|
+
from .types.assignments_delete_request_type import AssignmentsDeleteRequestType
|
|
18
19
|
from .types.assignments_update_request_type import AssignmentsUpdateRequestType
|
|
19
20
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
20
21
|
|
|
@@ -37,7 +38,7 @@ class AssignmentsClient:
|
|
|
37
38
|
request_options: typing.Optional[RequestOptions] = None,
|
|
38
39
|
) -> AssignmentsBulkAssignResponse:
|
|
39
40
|
"""
|
|
40
|
-
Assign multiple
|
|
41
|
+
Assign multiple users to a collection of tasks within a specific project.
|
|
41
42
|
|
|
42
43
|
Parameters
|
|
43
44
|
----------
|
|
@@ -253,9 +254,17 @@ class AssignmentsClient:
|
|
|
253
254
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
254
255
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
255
256
|
|
|
256
|
-
def delete(
|
|
257
|
+
def delete(
|
|
258
|
+
self,
|
|
259
|
+
id: int,
|
|
260
|
+
task_pk: int,
|
|
261
|
+
*,
|
|
262
|
+
type: typing.Optional[AssignmentsDeleteRequestType] = None,
|
|
263
|
+
users: typing.Optional[str] = None,
|
|
264
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
265
|
+
) -> None:
|
|
257
266
|
"""
|
|
258
|
-
Remove
|
|
267
|
+
Remove assignees for a task within a specific project.
|
|
259
268
|
|
|
260
269
|
Parameters
|
|
261
270
|
----------
|
|
@@ -265,6 +274,12 @@ class AssignmentsClient:
|
|
|
265
274
|
task_pk : int
|
|
266
275
|
A unique integer value identifying this task.
|
|
267
276
|
|
|
277
|
+
type : typing.Optional[AssignmentsDeleteRequestType]
|
|
278
|
+
Assignment type to delete (optional). If omitted, deletes all assignments for the task.
|
|
279
|
+
|
|
280
|
+
users : typing.Optional[str]
|
|
281
|
+
Comma separated list of user IDs to delete, as a string. If omitted, deletes all assignees for the given type.
|
|
282
|
+
|
|
268
283
|
request_options : typing.Optional[RequestOptions]
|
|
269
284
|
Request-specific configuration.
|
|
270
285
|
|
|
@@ -287,6 +302,10 @@ class AssignmentsClient:
|
|
|
287
302
|
_response = self._client_wrapper.httpx_client.request(
|
|
288
303
|
f"api/projects/{jsonable_encoder(id)}/tasks/{jsonable_encoder(task_pk)}/assignees",
|
|
289
304
|
method="DELETE",
|
|
305
|
+
params={
|
|
306
|
+
"type": type,
|
|
307
|
+
"users": users,
|
|
308
|
+
},
|
|
290
309
|
request_options=request_options,
|
|
291
310
|
)
|
|
292
311
|
try:
|
|
@@ -388,7 +407,7 @@ class AsyncAssignmentsClient:
|
|
|
388
407
|
request_options: typing.Optional[RequestOptions] = None,
|
|
389
408
|
) -> AssignmentsBulkAssignResponse:
|
|
390
409
|
"""
|
|
391
|
-
Assign multiple
|
|
410
|
+
Assign multiple users to a collection of tasks within a specific project.
|
|
392
411
|
|
|
393
412
|
Parameters
|
|
394
413
|
----------
|
|
@@ -628,9 +647,17 @@ class AsyncAssignmentsClient:
|
|
|
628
647
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
629
648
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
630
649
|
|
|
631
|
-
async def delete(
|
|
650
|
+
async def delete(
|
|
651
|
+
self,
|
|
652
|
+
id: int,
|
|
653
|
+
task_pk: int,
|
|
654
|
+
*,
|
|
655
|
+
type: typing.Optional[AssignmentsDeleteRequestType] = None,
|
|
656
|
+
users: typing.Optional[str] = None,
|
|
657
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
658
|
+
) -> None:
|
|
632
659
|
"""
|
|
633
|
-
Remove
|
|
660
|
+
Remove assignees for a task within a specific project.
|
|
634
661
|
|
|
635
662
|
Parameters
|
|
636
663
|
----------
|
|
@@ -640,6 +667,12 @@ class AsyncAssignmentsClient:
|
|
|
640
667
|
task_pk : int
|
|
641
668
|
A unique integer value identifying this task.
|
|
642
669
|
|
|
670
|
+
type : typing.Optional[AssignmentsDeleteRequestType]
|
|
671
|
+
Assignment type to delete (optional). If omitted, deletes all assignments for the task.
|
|
672
|
+
|
|
673
|
+
users : typing.Optional[str]
|
|
674
|
+
Comma separated list of user IDs to delete, as a string. If omitted, deletes all assignees for the given type.
|
|
675
|
+
|
|
643
676
|
request_options : typing.Optional[RequestOptions]
|
|
644
677
|
Request-specific configuration.
|
|
645
678
|
|
|
@@ -670,6 +703,10 @@ class AsyncAssignmentsClient:
|
|
|
670
703
|
_response = await self._client_wrapper.httpx_client.request(
|
|
671
704
|
f"api/projects/{jsonable_encoder(id)}/tasks/{jsonable_encoder(task_pk)}/assignees",
|
|
672
705
|
method="DELETE",
|
|
706
|
+
params={
|
|
707
|
+
"type": type,
|
|
708
|
+
"users": users,
|
|
709
|
+
},
|
|
673
710
|
request_options=request_options,
|
|
674
711
|
)
|
|
675
712
|
try:
|
|
@@ -16,6 +16,7 @@ from .assignments_bulk_assign_request_selected_items_excluded import Assignments
|
|
|
16
16
|
from .assignments_bulk_assign_request_selected_items_included import AssignmentsBulkAssignRequestSelectedItemsIncluded
|
|
17
17
|
from .assignments_bulk_assign_request_type import AssignmentsBulkAssignRequestType
|
|
18
18
|
from .assignments_bulk_assign_response import AssignmentsBulkAssignResponse
|
|
19
|
+
from .assignments_delete_request_type import AssignmentsDeleteRequestType
|
|
19
20
|
from .assignments_update_request_type import AssignmentsUpdateRequestType
|
|
20
21
|
|
|
21
22
|
__all__ = [
|
|
@@ -31,5 +32,6 @@ __all__ = [
|
|
|
31
32
|
"AssignmentsBulkAssignRequestSelectedItemsIncluded",
|
|
32
33
|
"AssignmentsBulkAssignRequestType",
|
|
33
34
|
"AssignmentsBulkAssignResponse",
|
|
35
|
+
"AssignmentsDeleteRequestType",
|
|
34
36
|
"AssignmentsUpdateRequestType",
|
|
35
37
|
]
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
5
|
from .exports.client import ExportsClient
|
|
6
|
+
from .members.client import MembersClient
|
|
6
7
|
from .stats.client import StatsClient
|
|
7
8
|
from .assignments.client import AssignmentsClient
|
|
8
9
|
from .pauses.client import PausesClient
|
|
@@ -35,6 +36,7 @@ from ..errors.bad_request_error import BadRequestError
|
|
|
35
36
|
from ..types.project_label_config import ProjectLabelConfig
|
|
36
37
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
37
38
|
from .exports.client import AsyncExportsClient
|
|
39
|
+
from .members.client import AsyncMembersClient
|
|
38
40
|
from .stats.client import AsyncStatsClient
|
|
39
41
|
from .assignments.client import AsyncAssignmentsClient
|
|
40
42
|
from .pauses.client import AsyncPausesClient
|
|
@@ -48,6 +50,7 @@ class ProjectsClient:
|
|
|
48
50
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
49
51
|
self._client_wrapper = client_wrapper
|
|
50
52
|
self.exports = ExportsClient(client_wrapper=self._client_wrapper)
|
|
53
|
+
self.members = MembersClient(client_wrapper=self._client_wrapper)
|
|
51
54
|
self.stats = StatsClient(client_wrapper=self._client_wrapper)
|
|
52
55
|
self.assignments = AssignmentsClient(client_wrapper=self._client_wrapper)
|
|
53
56
|
self.pauses = PausesClient(client_wrapper=self._client_wrapper)
|
|
@@ -976,6 +979,7 @@ class AsyncProjectsClient:
|
|
|
976
979
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
977
980
|
self._client_wrapper = client_wrapper
|
|
978
981
|
self.exports = AsyncExportsClient(client_wrapper=self._client_wrapper)
|
|
982
|
+
self.members = AsyncMembersClient(client_wrapper=self._client_wrapper)
|
|
979
983
|
self.stats = AsyncStatsClient(client_wrapper=self._client_wrapper)
|
|
980
984
|
self.assignments = AsyncAssignmentsClient(client_wrapper=self._client_wrapper)
|
|
981
985
|
self.pauses = AsyncPausesClient(client_wrapper=self._client_wrapper)
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ....core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ....core.request_options import RequestOptions
|
|
6
|
+
from .types.bulk_post_response import BulkPostResponse
|
|
7
|
+
from ....core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ....core.unchecked_base_model import construct_type
|
|
9
|
+
from json.decoder import JSONDecodeError
|
|
10
|
+
from ....core.api_error import ApiError
|
|
11
|
+
from .types.bulk_delete_response import BulkDeleteResponse
|
|
12
|
+
from ....core.client_wrapper import AsyncClientWrapper
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BulkClient:
|
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
|
+
self._client_wrapper = client_wrapper
|
|
21
|
+
|
|
22
|
+
def post(
|
|
23
|
+
self,
|
|
24
|
+
id: int,
|
|
25
|
+
*,
|
|
26
|
+
all_: bool,
|
|
27
|
+
excluded: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
28
|
+
included: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
29
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
30
|
+
) -> BulkPostResponse:
|
|
31
|
+
"""
|
|
32
|
+
Assign project members in bulk.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
id : int
|
|
37
|
+
|
|
38
|
+
all_ : bool
|
|
39
|
+
|
|
40
|
+
excluded : typing.Optional[typing.Sequence[int]]
|
|
41
|
+
|
|
42
|
+
included : typing.Optional[typing.Sequence[int]]
|
|
43
|
+
|
|
44
|
+
request_options : typing.Optional[RequestOptions]
|
|
45
|
+
Request-specific configuration.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
BulkPostResponse
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
Examples
|
|
53
|
+
--------
|
|
54
|
+
from label_studio_sdk import LabelStudio
|
|
55
|
+
|
|
56
|
+
client = LabelStudio(
|
|
57
|
+
api_key="YOUR_API_KEY",
|
|
58
|
+
)
|
|
59
|
+
client.projects.members.bulk.post(
|
|
60
|
+
id=1,
|
|
61
|
+
all_=True,
|
|
62
|
+
)
|
|
63
|
+
"""
|
|
64
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
65
|
+
f"api/projects/{jsonable_encoder(id)}/members/bulk/",
|
|
66
|
+
method="POST",
|
|
67
|
+
json={
|
|
68
|
+
"all": all_,
|
|
69
|
+
"excluded": excluded,
|
|
70
|
+
"included": included,
|
|
71
|
+
},
|
|
72
|
+
headers={
|
|
73
|
+
"content-type": "application/json",
|
|
74
|
+
},
|
|
75
|
+
request_options=request_options,
|
|
76
|
+
omit=OMIT,
|
|
77
|
+
)
|
|
78
|
+
try:
|
|
79
|
+
if 200 <= _response.status_code < 300:
|
|
80
|
+
return typing.cast(
|
|
81
|
+
BulkPostResponse,
|
|
82
|
+
construct_type(
|
|
83
|
+
type_=BulkPostResponse, # type: ignore
|
|
84
|
+
object_=_response.json(),
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
_response_json = _response.json()
|
|
88
|
+
except JSONDecodeError:
|
|
89
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
90
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
91
|
+
|
|
92
|
+
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> BulkDeleteResponse:
|
|
93
|
+
"""
|
|
94
|
+
Unassign project members in bulk. Allows the same request body as bulk assign.
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
id : int
|
|
99
|
+
|
|
100
|
+
request_options : typing.Optional[RequestOptions]
|
|
101
|
+
Request-specific configuration.
|
|
102
|
+
|
|
103
|
+
Returns
|
|
104
|
+
-------
|
|
105
|
+
BulkDeleteResponse
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
Examples
|
|
109
|
+
--------
|
|
110
|
+
from label_studio_sdk import LabelStudio
|
|
111
|
+
|
|
112
|
+
client = LabelStudio(
|
|
113
|
+
api_key="YOUR_API_KEY",
|
|
114
|
+
)
|
|
115
|
+
client.projects.members.bulk.delete(
|
|
116
|
+
id=1,
|
|
117
|
+
)
|
|
118
|
+
"""
|
|
119
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
120
|
+
f"api/projects/{jsonable_encoder(id)}/members/bulk/",
|
|
121
|
+
method="DELETE",
|
|
122
|
+
request_options=request_options,
|
|
123
|
+
)
|
|
124
|
+
try:
|
|
125
|
+
if 200 <= _response.status_code < 300:
|
|
126
|
+
return typing.cast(
|
|
127
|
+
BulkDeleteResponse,
|
|
128
|
+
construct_type(
|
|
129
|
+
type_=BulkDeleteResponse, # type: ignore
|
|
130
|
+
object_=_response.json(),
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
_response_json = _response.json()
|
|
134
|
+
except JSONDecodeError:
|
|
135
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
136
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class AsyncBulkClient:
|
|
140
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
141
|
+
self._client_wrapper = client_wrapper
|
|
142
|
+
|
|
143
|
+
async def post(
|
|
144
|
+
self,
|
|
145
|
+
id: int,
|
|
146
|
+
*,
|
|
147
|
+
all_: bool,
|
|
148
|
+
excluded: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
149
|
+
included: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
150
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
151
|
+
) -> BulkPostResponse:
|
|
152
|
+
"""
|
|
153
|
+
Assign project members in bulk.
|
|
154
|
+
|
|
155
|
+
Parameters
|
|
156
|
+
----------
|
|
157
|
+
id : int
|
|
158
|
+
|
|
159
|
+
all_ : bool
|
|
160
|
+
|
|
161
|
+
excluded : typing.Optional[typing.Sequence[int]]
|
|
162
|
+
|
|
163
|
+
included : typing.Optional[typing.Sequence[int]]
|
|
164
|
+
|
|
165
|
+
request_options : typing.Optional[RequestOptions]
|
|
166
|
+
Request-specific configuration.
|
|
167
|
+
|
|
168
|
+
Returns
|
|
169
|
+
-------
|
|
170
|
+
BulkPostResponse
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
Examples
|
|
174
|
+
--------
|
|
175
|
+
import asyncio
|
|
176
|
+
|
|
177
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
178
|
+
|
|
179
|
+
client = AsyncLabelStudio(
|
|
180
|
+
api_key="YOUR_API_KEY",
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
async def main() -> None:
|
|
185
|
+
await client.projects.members.bulk.post(
|
|
186
|
+
id=1,
|
|
187
|
+
all_=True,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
asyncio.run(main())
|
|
192
|
+
"""
|
|
193
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
194
|
+
f"api/projects/{jsonable_encoder(id)}/members/bulk/",
|
|
195
|
+
method="POST",
|
|
196
|
+
json={
|
|
197
|
+
"all": all_,
|
|
198
|
+
"excluded": excluded,
|
|
199
|
+
"included": included,
|
|
200
|
+
},
|
|
201
|
+
headers={
|
|
202
|
+
"content-type": "application/json",
|
|
203
|
+
},
|
|
204
|
+
request_options=request_options,
|
|
205
|
+
omit=OMIT,
|
|
206
|
+
)
|
|
207
|
+
try:
|
|
208
|
+
if 200 <= _response.status_code < 300:
|
|
209
|
+
return typing.cast(
|
|
210
|
+
BulkPostResponse,
|
|
211
|
+
construct_type(
|
|
212
|
+
type_=BulkPostResponse, # type: ignore
|
|
213
|
+
object_=_response.json(),
|
|
214
|
+
),
|
|
215
|
+
)
|
|
216
|
+
_response_json = _response.json()
|
|
217
|
+
except JSONDecodeError:
|
|
218
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
219
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
220
|
+
|
|
221
|
+
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> BulkDeleteResponse:
|
|
222
|
+
"""
|
|
223
|
+
Unassign project members in bulk. Allows the same request body as bulk assign.
|
|
224
|
+
|
|
225
|
+
Parameters
|
|
226
|
+
----------
|
|
227
|
+
id : int
|
|
228
|
+
|
|
229
|
+
request_options : typing.Optional[RequestOptions]
|
|
230
|
+
Request-specific configuration.
|
|
231
|
+
|
|
232
|
+
Returns
|
|
233
|
+
-------
|
|
234
|
+
BulkDeleteResponse
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
Examples
|
|
238
|
+
--------
|
|
239
|
+
import asyncio
|
|
240
|
+
|
|
241
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
242
|
+
|
|
243
|
+
client = AsyncLabelStudio(
|
|
244
|
+
api_key="YOUR_API_KEY",
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
async def main() -> None:
|
|
249
|
+
await client.projects.members.bulk.delete(
|
|
250
|
+
id=1,
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
asyncio.run(main())
|
|
255
|
+
"""
|
|
256
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
257
|
+
f"api/projects/{jsonable_encoder(id)}/members/bulk/",
|
|
258
|
+
method="DELETE",
|
|
259
|
+
request_options=request_options,
|
|
260
|
+
)
|
|
261
|
+
try:
|
|
262
|
+
if 200 <= _response.status_code < 300:
|
|
263
|
+
return typing.cast(
|
|
264
|
+
BulkDeleteResponse,
|
|
265
|
+
construct_type(
|
|
266
|
+
type_=BulkDeleteResponse, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
_response_json = _response.json()
|
|
271
|
+
except JSONDecodeError:
|
|
272
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
273
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .....core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from .....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BulkDeleteResponse(UncheckedBaseModel):
|
|
10
|
+
unassignments: typing.Optional[int] = None
|
|
11
|
+
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
15
|
+
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .....core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from .....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BulkPostResponse(UncheckedBaseModel):
|
|
10
|
+
assignments: typing.Optional[int] = None
|
|
11
|
+
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
15
|
+
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|