label-studio-sdk 2.0.1__py3-none-any.whl → 2.0.3__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 +20 -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/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 +8 -8
- label_studio_sdk/predictions/client.py +60 -60
- label_studio_sdk/projects/__init__.py +33 -1
- label_studio_sdk/projects/assignments/__init__.py +35 -0
- label_studio_sdk/projects/assignments/client.py +801 -0
- label_studio_sdk/projects/assignments/types/__init__.py +37 -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_delete_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_update_request_type.py +5 -0
- label_studio_sdk/projects/client.py +445 -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/members/__init__.py +2 -0
- label_studio_sdk/projects/members/client.py +137 -0
- 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/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/tasks/client.py +174 -174
- label_studio_sdk/types/__init__.py +18 -0
- label_studio_sdk/types/all_roles_project_list.py +94 -94
- 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 +14 -14
- label_studio_sdk/types/billing_flags.py +16 -16
- 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/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 +1 -1
- 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 +13 -13
- 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/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_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/project_import.py +21 -21
- 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/s3export_storage.py +45 -45
- label_studio_sdk/types/s3import_storage.py +44 -44
- 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/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.1.dist-info → label_studio_sdk-2.0.3.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/RECORD +184 -150
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.1.dist-info → label_studio_sdk-2.0.3.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,278 @@
|
|
|
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.saml_settings import SamlSettings
|
|
7
|
+
from ...core.unchecked_base_model import construct_type
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ...core.api_error import ApiError
|
|
10
|
+
from ...types.project_group_request import ProjectGroupRequest
|
|
11
|
+
from ...types.saml_settings_update import SamlSettingsUpdate
|
|
12
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
|
+
|
|
15
|
+
# this is used as the default value for optional parameters
|
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SamlClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._client_wrapper = client_wrapper
|
|
22
|
+
|
|
23
|
+
def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> SamlSettings:
|
|
24
|
+
"""
|
|
25
|
+
Retrieve SAML2 settings for the currently active organization.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
request_options : typing.Optional[RequestOptions]
|
|
30
|
+
Request-specific configuration.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
SamlSettings
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Examples
|
|
38
|
+
--------
|
|
39
|
+
from label_studio_sdk import LabelStudio
|
|
40
|
+
|
|
41
|
+
client = LabelStudio(
|
|
42
|
+
api_key="YOUR_API_KEY",
|
|
43
|
+
)
|
|
44
|
+
client.sso.saml.get()
|
|
45
|
+
"""
|
|
46
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
47
|
+
"api/saml/settings",
|
|
48
|
+
method="GET",
|
|
49
|
+
request_options=request_options,
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
if 200 <= _response.status_code < 300:
|
|
53
|
+
return typing.cast(
|
|
54
|
+
SamlSettings,
|
|
55
|
+
construct_type(
|
|
56
|
+
type_=SamlSettings, # type: ignore
|
|
57
|
+
object_=_response.json(),
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
_response_json = _response.json()
|
|
61
|
+
except JSONDecodeError:
|
|
62
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
63
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
64
|
+
|
|
65
|
+
def update(
|
|
66
|
+
self,
|
|
67
|
+
*,
|
|
68
|
+
projects_groups: typing.Optional[typing.Sequence[ProjectGroupRequest]] = OMIT,
|
|
69
|
+
roles_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
70
|
+
workspaces_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
71
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
72
|
+
) -> SamlSettingsUpdate:
|
|
73
|
+
"""
|
|
74
|
+
Update SAML2 settings for the currently active organization.
|
|
75
|
+
|
|
76
|
+
Parameters
|
|
77
|
+
----------
|
|
78
|
+
projects_groups : typing.Optional[typing.Sequence[ProjectGroupRequest]]
|
|
79
|
+
|
|
80
|
+
roles_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
81
|
+
|
|
82
|
+
workspaces_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
83
|
+
|
|
84
|
+
request_options : typing.Optional[RequestOptions]
|
|
85
|
+
Request-specific configuration.
|
|
86
|
+
|
|
87
|
+
Returns
|
|
88
|
+
-------
|
|
89
|
+
SamlSettingsUpdate
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Examples
|
|
93
|
+
--------
|
|
94
|
+
from label_studio_sdk import LabelStudio, ProjectGroupRequest
|
|
95
|
+
|
|
96
|
+
client = LabelStudio(
|
|
97
|
+
api_key="YOUR_API_KEY",
|
|
98
|
+
)
|
|
99
|
+
client.sso.saml.update(
|
|
100
|
+
projects_groups=[
|
|
101
|
+
ProjectGroupRequest(
|
|
102
|
+
group="groups_test",
|
|
103
|
+
project_id=42,
|
|
104
|
+
role="Inherit",
|
|
105
|
+
)
|
|
106
|
+
],
|
|
107
|
+
roles_groups=[["Administrator", "groups_test"]],
|
|
108
|
+
workspaces_groups=[["Default workspace", "groups_test"]],
|
|
109
|
+
)
|
|
110
|
+
"""
|
|
111
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
112
|
+
"api/saml/settings",
|
|
113
|
+
method="POST",
|
|
114
|
+
json={
|
|
115
|
+
"projects_groups": convert_and_respect_annotation_metadata(
|
|
116
|
+
object_=projects_groups, annotation=typing.Sequence[ProjectGroupRequest], direction="write"
|
|
117
|
+
),
|
|
118
|
+
"roles_groups": roles_groups,
|
|
119
|
+
"workspaces_groups": workspaces_groups,
|
|
120
|
+
},
|
|
121
|
+
headers={
|
|
122
|
+
"content-type": "application/json",
|
|
123
|
+
},
|
|
124
|
+
request_options=request_options,
|
|
125
|
+
omit=OMIT,
|
|
126
|
+
)
|
|
127
|
+
try:
|
|
128
|
+
if 200 <= _response.status_code < 300:
|
|
129
|
+
return typing.cast(
|
|
130
|
+
SamlSettingsUpdate,
|
|
131
|
+
construct_type(
|
|
132
|
+
type_=SamlSettingsUpdate, # type: ignore
|
|
133
|
+
object_=_response.json(),
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
_response_json = _response.json()
|
|
137
|
+
except JSONDecodeError:
|
|
138
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
139
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class AsyncSamlClient:
|
|
143
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
144
|
+
self._client_wrapper = client_wrapper
|
|
145
|
+
|
|
146
|
+
async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> SamlSettings:
|
|
147
|
+
"""
|
|
148
|
+
Retrieve SAML2 settings for the currently active organization.
|
|
149
|
+
|
|
150
|
+
Parameters
|
|
151
|
+
----------
|
|
152
|
+
request_options : typing.Optional[RequestOptions]
|
|
153
|
+
Request-specific configuration.
|
|
154
|
+
|
|
155
|
+
Returns
|
|
156
|
+
-------
|
|
157
|
+
SamlSettings
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
Examples
|
|
161
|
+
--------
|
|
162
|
+
import asyncio
|
|
163
|
+
|
|
164
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
165
|
+
|
|
166
|
+
client = AsyncLabelStudio(
|
|
167
|
+
api_key="YOUR_API_KEY",
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
async def main() -> None:
|
|
172
|
+
await client.sso.saml.get()
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
asyncio.run(main())
|
|
176
|
+
"""
|
|
177
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
178
|
+
"api/saml/settings",
|
|
179
|
+
method="GET",
|
|
180
|
+
request_options=request_options,
|
|
181
|
+
)
|
|
182
|
+
try:
|
|
183
|
+
if 200 <= _response.status_code < 300:
|
|
184
|
+
return typing.cast(
|
|
185
|
+
SamlSettings,
|
|
186
|
+
construct_type(
|
|
187
|
+
type_=SamlSettings, # type: ignore
|
|
188
|
+
object_=_response.json(),
|
|
189
|
+
),
|
|
190
|
+
)
|
|
191
|
+
_response_json = _response.json()
|
|
192
|
+
except JSONDecodeError:
|
|
193
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
194
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
195
|
+
|
|
196
|
+
async def update(
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
199
|
+
projects_groups: typing.Optional[typing.Sequence[ProjectGroupRequest]] = OMIT,
|
|
200
|
+
roles_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
201
|
+
workspaces_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
202
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
203
|
+
) -> SamlSettingsUpdate:
|
|
204
|
+
"""
|
|
205
|
+
Update SAML2 settings for the currently active organization.
|
|
206
|
+
|
|
207
|
+
Parameters
|
|
208
|
+
----------
|
|
209
|
+
projects_groups : typing.Optional[typing.Sequence[ProjectGroupRequest]]
|
|
210
|
+
|
|
211
|
+
roles_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
212
|
+
|
|
213
|
+
workspaces_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
214
|
+
|
|
215
|
+
request_options : typing.Optional[RequestOptions]
|
|
216
|
+
Request-specific configuration.
|
|
217
|
+
|
|
218
|
+
Returns
|
|
219
|
+
-------
|
|
220
|
+
SamlSettingsUpdate
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
Examples
|
|
224
|
+
--------
|
|
225
|
+
import asyncio
|
|
226
|
+
|
|
227
|
+
from label_studio_sdk import AsyncLabelStudio, ProjectGroupRequest
|
|
228
|
+
|
|
229
|
+
client = AsyncLabelStudio(
|
|
230
|
+
api_key="YOUR_API_KEY",
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
async def main() -> None:
|
|
235
|
+
await client.sso.saml.update(
|
|
236
|
+
projects_groups=[
|
|
237
|
+
ProjectGroupRequest(
|
|
238
|
+
group="groups_test",
|
|
239
|
+
project_id=42,
|
|
240
|
+
role="Inherit",
|
|
241
|
+
)
|
|
242
|
+
],
|
|
243
|
+
roles_groups=[["Administrator", "groups_test"]],
|
|
244
|
+
workspaces_groups=[["Default workspace", "groups_test"]],
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
asyncio.run(main())
|
|
249
|
+
"""
|
|
250
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
251
|
+
"api/saml/settings",
|
|
252
|
+
method="POST",
|
|
253
|
+
json={
|
|
254
|
+
"projects_groups": convert_and_respect_annotation_metadata(
|
|
255
|
+
object_=projects_groups, annotation=typing.Sequence[ProjectGroupRequest], direction="write"
|
|
256
|
+
),
|
|
257
|
+
"roles_groups": roles_groups,
|
|
258
|
+
"workspaces_groups": workspaces_groups,
|
|
259
|
+
},
|
|
260
|
+
headers={
|
|
261
|
+
"content-type": "application/json",
|
|
262
|
+
},
|
|
263
|
+
request_options=request_options,
|
|
264
|
+
omit=OMIT,
|
|
265
|
+
)
|
|
266
|
+
try:
|
|
267
|
+
if 200 <= _response.status_code < 300:
|
|
268
|
+
return typing.cast(
|
|
269
|
+
SamlSettingsUpdate,
|
|
270
|
+
construct_type(
|
|
271
|
+
type_=SamlSettingsUpdate, # type: ignore
|
|
272
|
+
object_=_response.json(),
|
|
273
|
+
),
|
|
274
|
+
)
|
|
275
|
+
_response_json = _response.json()
|
|
276
|
+
except JSONDecodeError:
|
|
277
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
278
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -0,0 +1,278 @@
|
|
|
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.scim_settings import ScimSettings
|
|
7
|
+
from ...core.unchecked_base_model import construct_type
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ...core.api_error import ApiError
|
|
10
|
+
from ...types.project_group_request import ProjectGroupRequest
|
|
11
|
+
from ...types.scim_settings_update import ScimSettingsUpdate
|
|
12
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
14
|
+
|
|
15
|
+
# this is used as the default value for optional parameters
|
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ScimClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._client_wrapper = client_wrapper
|
|
22
|
+
|
|
23
|
+
def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> ScimSettings:
|
|
24
|
+
"""
|
|
25
|
+
Retrieve SCIM settings for the currently active organization.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
request_options : typing.Optional[RequestOptions]
|
|
30
|
+
Request-specific configuration.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
ScimSettings
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Examples
|
|
38
|
+
--------
|
|
39
|
+
from label_studio_sdk import LabelStudio
|
|
40
|
+
|
|
41
|
+
client = LabelStudio(
|
|
42
|
+
api_key="YOUR_API_KEY",
|
|
43
|
+
)
|
|
44
|
+
client.sso.scim.get()
|
|
45
|
+
"""
|
|
46
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
47
|
+
"api/scim/settings",
|
|
48
|
+
method="GET",
|
|
49
|
+
request_options=request_options,
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
if 200 <= _response.status_code < 300:
|
|
53
|
+
return typing.cast(
|
|
54
|
+
ScimSettings,
|
|
55
|
+
construct_type(
|
|
56
|
+
type_=ScimSettings, # type: ignore
|
|
57
|
+
object_=_response.json(),
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
_response_json = _response.json()
|
|
61
|
+
except JSONDecodeError:
|
|
62
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
63
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
64
|
+
|
|
65
|
+
def update(
|
|
66
|
+
self,
|
|
67
|
+
*,
|
|
68
|
+
projects_groups: typing.Optional[typing.Sequence[ProjectGroupRequest]] = OMIT,
|
|
69
|
+
roles_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
70
|
+
workspaces_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
71
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
72
|
+
) -> ScimSettingsUpdate:
|
|
73
|
+
"""
|
|
74
|
+
Update SCIM settings for the currently active organization.
|
|
75
|
+
|
|
76
|
+
Parameters
|
|
77
|
+
----------
|
|
78
|
+
projects_groups : typing.Optional[typing.Sequence[ProjectGroupRequest]]
|
|
79
|
+
|
|
80
|
+
roles_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
81
|
+
|
|
82
|
+
workspaces_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
83
|
+
|
|
84
|
+
request_options : typing.Optional[RequestOptions]
|
|
85
|
+
Request-specific configuration.
|
|
86
|
+
|
|
87
|
+
Returns
|
|
88
|
+
-------
|
|
89
|
+
ScimSettingsUpdate
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Examples
|
|
93
|
+
--------
|
|
94
|
+
from label_studio_sdk import LabelStudio, ProjectGroupRequest
|
|
95
|
+
|
|
96
|
+
client = LabelStudio(
|
|
97
|
+
api_key="YOUR_API_KEY",
|
|
98
|
+
)
|
|
99
|
+
client.sso.scim.update(
|
|
100
|
+
projects_groups=[
|
|
101
|
+
ProjectGroupRequest(
|
|
102
|
+
group="groups_test",
|
|
103
|
+
project_id=42,
|
|
104
|
+
role="Inherit",
|
|
105
|
+
)
|
|
106
|
+
],
|
|
107
|
+
roles_groups=[["Administrator", "groups_test"]],
|
|
108
|
+
workspaces_groups=[["Default workspace", "groups_test"]],
|
|
109
|
+
)
|
|
110
|
+
"""
|
|
111
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
112
|
+
"api/scim/settings",
|
|
113
|
+
method="POST",
|
|
114
|
+
json={
|
|
115
|
+
"projects_groups": convert_and_respect_annotation_metadata(
|
|
116
|
+
object_=projects_groups, annotation=typing.Sequence[ProjectGroupRequest], direction="write"
|
|
117
|
+
),
|
|
118
|
+
"roles_groups": roles_groups,
|
|
119
|
+
"workspaces_groups": workspaces_groups,
|
|
120
|
+
},
|
|
121
|
+
headers={
|
|
122
|
+
"content-type": "application/json",
|
|
123
|
+
},
|
|
124
|
+
request_options=request_options,
|
|
125
|
+
omit=OMIT,
|
|
126
|
+
)
|
|
127
|
+
try:
|
|
128
|
+
if 200 <= _response.status_code < 300:
|
|
129
|
+
return typing.cast(
|
|
130
|
+
ScimSettingsUpdate,
|
|
131
|
+
construct_type(
|
|
132
|
+
type_=ScimSettingsUpdate, # type: ignore
|
|
133
|
+
object_=_response.json(),
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
_response_json = _response.json()
|
|
137
|
+
except JSONDecodeError:
|
|
138
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
139
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class AsyncScimClient:
|
|
143
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
144
|
+
self._client_wrapper = client_wrapper
|
|
145
|
+
|
|
146
|
+
async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> ScimSettings:
|
|
147
|
+
"""
|
|
148
|
+
Retrieve SCIM settings for the currently active organization.
|
|
149
|
+
|
|
150
|
+
Parameters
|
|
151
|
+
----------
|
|
152
|
+
request_options : typing.Optional[RequestOptions]
|
|
153
|
+
Request-specific configuration.
|
|
154
|
+
|
|
155
|
+
Returns
|
|
156
|
+
-------
|
|
157
|
+
ScimSettings
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
Examples
|
|
161
|
+
--------
|
|
162
|
+
import asyncio
|
|
163
|
+
|
|
164
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
165
|
+
|
|
166
|
+
client = AsyncLabelStudio(
|
|
167
|
+
api_key="YOUR_API_KEY",
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
async def main() -> None:
|
|
172
|
+
await client.sso.scim.get()
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
asyncio.run(main())
|
|
176
|
+
"""
|
|
177
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
178
|
+
"api/scim/settings",
|
|
179
|
+
method="GET",
|
|
180
|
+
request_options=request_options,
|
|
181
|
+
)
|
|
182
|
+
try:
|
|
183
|
+
if 200 <= _response.status_code < 300:
|
|
184
|
+
return typing.cast(
|
|
185
|
+
ScimSettings,
|
|
186
|
+
construct_type(
|
|
187
|
+
type_=ScimSettings, # type: ignore
|
|
188
|
+
object_=_response.json(),
|
|
189
|
+
),
|
|
190
|
+
)
|
|
191
|
+
_response_json = _response.json()
|
|
192
|
+
except JSONDecodeError:
|
|
193
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
194
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
195
|
+
|
|
196
|
+
async def update(
|
|
197
|
+
self,
|
|
198
|
+
*,
|
|
199
|
+
projects_groups: typing.Optional[typing.Sequence[ProjectGroupRequest]] = OMIT,
|
|
200
|
+
roles_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
201
|
+
workspaces_groups: typing.Optional[typing.Sequence[typing.Sequence[str]]] = OMIT,
|
|
202
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
203
|
+
) -> ScimSettingsUpdate:
|
|
204
|
+
"""
|
|
205
|
+
Update SCIM settings for the currently active organization.
|
|
206
|
+
|
|
207
|
+
Parameters
|
|
208
|
+
----------
|
|
209
|
+
projects_groups : typing.Optional[typing.Sequence[ProjectGroupRequest]]
|
|
210
|
+
|
|
211
|
+
roles_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
212
|
+
|
|
213
|
+
workspaces_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
|
|
214
|
+
|
|
215
|
+
request_options : typing.Optional[RequestOptions]
|
|
216
|
+
Request-specific configuration.
|
|
217
|
+
|
|
218
|
+
Returns
|
|
219
|
+
-------
|
|
220
|
+
ScimSettingsUpdate
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
Examples
|
|
224
|
+
--------
|
|
225
|
+
import asyncio
|
|
226
|
+
|
|
227
|
+
from label_studio_sdk import AsyncLabelStudio, ProjectGroupRequest
|
|
228
|
+
|
|
229
|
+
client = AsyncLabelStudio(
|
|
230
|
+
api_key="YOUR_API_KEY",
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
async def main() -> None:
|
|
235
|
+
await client.sso.scim.update(
|
|
236
|
+
projects_groups=[
|
|
237
|
+
ProjectGroupRequest(
|
|
238
|
+
group="groups_test",
|
|
239
|
+
project_id=42,
|
|
240
|
+
role="Inherit",
|
|
241
|
+
)
|
|
242
|
+
],
|
|
243
|
+
roles_groups=[["Administrator", "groups_test"]],
|
|
244
|
+
workspaces_groups=[["Default workspace", "groups_test"]],
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
asyncio.run(main())
|
|
249
|
+
"""
|
|
250
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
251
|
+
"api/scim/settings",
|
|
252
|
+
method="POST",
|
|
253
|
+
json={
|
|
254
|
+
"projects_groups": convert_and_respect_annotation_metadata(
|
|
255
|
+
object_=projects_groups, annotation=typing.Sequence[ProjectGroupRequest], direction="write"
|
|
256
|
+
),
|
|
257
|
+
"roles_groups": roles_groups,
|
|
258
|
+
"workspaces_groups": workspaces_groups,
|
|
259
|
+
},
|
|
260
|
+
headers={
|
|
261
|
+
"content-type": "application/json",
|
|
262
|
+
},
|
|
263
|
+
request_options=request_options,
|
|
264
|
+
omit=OMIT,
|
|
265
|
+
)
|
|
266
|
+
try:
|
|
267
|
+
if 200 <= _response.status_code < 300:
|
|
268
|
+
return typing.cast(
|
|
269
|
+
ScimSettingsUpdate,
|
|
270
|
+
construct_type(
|
|
271
|
+
type_=ScimSettingsUpdate, # type: ignore
|
|
272
|
+
object_=_response.json(),
|
|
273
|
+
),
|
|
274
|
+
)
|
|
275
|
+
_response_json = _response.json()
|
|
276
|
+
except JSONDecodeError:
|
|
277
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
278
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|