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
|
@@ -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)
|
|
@@ -124,6 +124,9 @@ from .pause_request import PauseRequest
|
|
|
124
124
|
from .prediction import Prediction
|
|
125
125
|
from .prediction_request import PredictionRequest
|
|
126
126
|
from .project import Project
|
|
127
|
+
from .project_group import ProjectGroup
|
|
128
|
+
from .project_group_request import ProjectGroupRequest
|
|
129
|
+
from .project_group_role_enum import ProjectGroupRoleEnum
|
|
127
130
|
from .project_import import ProjectImport
|
|
128
131
|
from .project_label_config import ProjectLabelConfig
|
|
129
132
|
from .project_label_config_request import ProjectLabelConfigRequest
|
|
@@ -149,7 +152,11 @@ from .role9e7enum import Role9E7Enum
|
|
|
149
152
|
from .role_based_task import RoleBasedTask
|
|
150
153
|
from .s3export_storage import S3ExportStorage
|
|
151
154
|
from .s3import_storage import S3ImportStorage
|
|
155
|
+
from .saml_settings import SamlSettings
|
|
156
|
+
from .saml_settings_update import SamlSettingsUpdate
|
|
152
157
|
from .sampling_enum import SamplingEnum
|
|
158
|
+
from .scim_settings import ScimSettings
|
|
159
|
+
from .scim_settings_update import ScimSettingsUpdate
|
|
153
160
|
from .scope_enum import ScopeEnum
|
|
154
161
|
from .selected_items_request import SelectedItemsRequest
|
|
155
162
|
from .serialization_option import SerializationOption
|
|
@@ -175,6 +182,10 @@ from .version_response import VersionResponse
|
|
|
175
182
|
from .view import View
|
|
176
183
|
from .webhook import Webhook
|
|
177
184
|
from .webhook_serializer_for_update import WebhookSerializerForUpdate
|
|
185
|
+
from .who_am_i_lse_fields import WhoAmILseFields
|
|
186
|
+
from .who_am_i_lse_fields_onboarding_state import WhoAmILseFieldsOnboardingState
|
|
187
|
+
from .who_am_i_lse_fields_trial_role import WhoAmILseFieldsTrialRole
|
|
188
|
+
from .who_am_i_user import WhoAmIUser
|
|
178
189
|
from .workspace import Workspace
|
|
179
190
|
from .workspace_member_create import WorkspaceMemberCreate
|
|
180
191
|
from .workspace_member_list import WorkspaceMemberList
|
|
@@ -302,6 +313,9 @@ __all__ = [
|
|
|
302
313
|
"Prediction",
|
|
303
314
|
"PredictionRequest",
|
|
304
315
|
"Project",
|
|
316
|
+
"ProjectGroup",
|
|
317
|
+
"ProjectGroupRequest",
|
|
318
|
+
"ProjectGroupRoleEnum",
|
|
305
319
|
"ProjectImport",
|
|
306
320
|
"ProjectLabelConfig",
|
|
307
321
|
"ProjectLabelConfigRequest",
|
|
@@ -327,7 +341,11 @@ __all__ = [
|
|
|
327
341
|
"RoleBasedTask",
|
|
328
342
|
"S3ExportStorage",
|
|
329
343
|
"S3ImportStorage",
|
|
344
|
+
"SamlSettings",
|
|
345
|
+
"SamlSettingsUpdate",
|
|
330
346
|
"SamplingEnum",
|
|
347
|
+
"ScimSettings",
|
|
348
|
+
"ScimSettingsUpdate",
|
|
331
349
|
"ScopeEnum",
|
|
332
350
|
"SelectedItemsRequest",
|
|
333
351
|
"SerializationOption",
|
|
@@ -353,6 +371,10 @@ __all__ = [
|
|
|
353
371
|
"View",
|
|
354
372
|
"Webhook",
|
|
355
373
|
"WebhookSerializerForUpdate",
|
|
374
|
+
"WhoAmILseFields",
|
|
375
|
+
"WhoAmILseFieldsOnboardingState",
|
|
376
|
+
"WhoAmILseFieldsTrialRole",
|
|
377
|
+
"WhoAmIUser",
|
|
356
378
|
"Workspace",
|
|
357
379
|
"WorkspaceMemberCreate",
|
|
358
380
|
"WorkspaceMemberList",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
from .project_group_role_enum import ProjectGroupRoleEnum
|
|
5
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import typing
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProjectGroup(UncheckedBaseModel):
|
|
11
|
+
group: str
|
|
12
|
+
project_id: int
|
|
13
|
+
role: ProjectGroupRoleEnum
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
from .project_group_role_enum import ProjectGroupRoleEnum
|
|
5
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import typing
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProjectGroupRequest(UncheckedBaseModel):
|
|
11
|
+
group: str
|
|
12
|
+
project_id: int
|
|
13
|
+
role: ProjectGroupRoleEnum
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,21 @@
|
|
|
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 SamlSettings(UncheckedBaseModel):
|
|
10
|
+
projects_groups: typing.Optional[typing.Optional[typing.Any]] = None
|
|
11
|
+
roles_groups: typing.Optional[typing.Optional[typing.Any]] = None
|
|
12
|
+
workspaces_groups: typing.Optional[typing.Optional[typing.Any]] = None
|
|
13
|
+
|
|
14
|
+
if IS_PYDANTIC_V2:
|
|
15
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
16
|
+
else:
|
|
17
|
+
|
|
18
|
+
class Config:
|
|
19
|
+
frozen = True
|
|
20
|
+
smart_union = True
|
|
21
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
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 .project_group import ProjectGroup
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SamlSettingsUpdate(UncheckedBaseModel):
|
|
11
|
+
projects_groups: typing.Optional[typing.List[ProjectGroup]] = None
|
|
12
|
+
roles_groups: typing.Optional[typing.List[typing.List[str]]] = None
|
|
13
|
+
workspaces_groups: typing.Optional[typing.List[typing.List[str]]] = None
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,21 @@
|
|
|
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 ScimSettings(UncheckedBaseModel):
|
|
10
|
+
projects_groups: typing.Optional[typing.Optional[typing.Any]] = None
|
|
11
|
+
roles_groups: typing.Optional[typing.Optional[typing.Any]] = None
|
|
12
|
+
workspaces_groups: typing.Optional[typing.Optional[typing.Any]] = None
|
|
13
|
+
|
|
14
|
+
if IS_PYDANTIC_V2:
|
|
15
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
16
|
+
else:
|
|
17
|
+
|
|
18
|
+
class Config:
|
|
19
|
+
frozen = True
|
|
20
|
+
smart_union = True
|
|
21
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
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 .project_group import ProjectGroup
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ScimSettingsUpdate(UncheckedBaseModel):
|
|
11
|
+
projects_groups: typing.Optional[typing.List[ProjectGroup]] = None
|
|
12
|
+
roles_groups: typing.Optional[typing.List[typing.List[str]]] = None
|
|
13
|
+
workspaces_groups: typing.Optional[typing.List[typing.List[str]]] = None
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import datetime as dt
|
|
6
|
+
from .who_am_i_lse_fields_onboarding_state import WhoAmILseFieldsOnboardingState
|
|
7
|
+
import pydantic
|
|
8
|
+
from .who_am_i_lse_fields_trial_role import WhoAmILseFieldsTrialRole
|
|
9
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class WhoAmILseFields(UncheckedBaseModel):
|
|
13
|
+
active_organization_external_id: typing.Optional[str] = None
|
|
14
|
+
email_notification_settings: str
|
|
15
|
+
invite_activated: typing.Optional[bool] = None
|
|
16
|
+
invite_expired: str
|
|
17
|
+
invite_expired_at: str
|
|
18
|
+
invited_at: typing.Optional[dt.datetime] = None
|
|
19
|
+
invited_by: typing.Optional[int] = None
|
|
20
|
+
onboarding_state: typing.Optional[WhoAmILseFieldsOnboardingState] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
The current stage of user onboarding
|
|
23
|
+
|
|
24
|
+
* `not_started` - Not Started
|
|
25
|
+
* `signup` - Signup
|
|
26
|
+
* `trial_signup` - Trial Signup
|
|
27
|
+
* `first_tutorial` - First Tutorial
|
|
28
|
+
* `in_app_guidance` - In App Guidance
|
|
29
|
+
* `complete` - Complete
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
social_auth_finished: typing.Optional[bool] = pydantic.Field(default=None)
|
|
33
|
+
"""
|
|
34
|
+
Is user finished social authentication
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
trial_company: typing.Optional[str] = None
|
|
38
|
+
trial_experience_labeling: typing.Optional[str] = None
|
|
39
|
+
trial_license_enterprise: typing.Optional[bool] = None
|
|
40
|
+
trial_models_in_production: typing.Optional[str] = None
|
|
41
|
+
trial_role: typing.Optional[WhoAmILseFieldsTrialRole] = None
|
|
42
|
+
|
|
43
|
+
if IS_PYDANTIC_V2:
|
|
44
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
45
|
+
else:
|
|
46
|
+
|
|
47
|
+
class Config:
|
|
48
|
+
frozen = True
|
|
49
|
+
smart_union = True
|
|
50
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .onboarding_state_enum import OnboardingStateEnum
|
|
5
|
+
from .blank_enum import BlankEnum
|
|
6
|
+
from .null_enum import NullEnum
|
|
7
|
+
|
|
8
|
+
WhoAmILseFieldsOnboardingState = typing.Union[OnboardingStateEnum, BlankEnum, NullEnum]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .trial_role_enum import TrialRoleEnum
|
|
5
|
+
from .blank_enum import BlankEnum
|
|
6
|
+
from .null_enum import NullEnum
|
|
7
|
+
|
|
8
|
+
WhoAmILseFieldsTrialRole = typing.Union[TrialRoleEnum, BlankEnum, NullEnum]
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import pydantic
|
|
6
|
+
import datetime as dt
|
|
7
|
+
from .who_am_i_lse_fields import WhoAmILseFields
|
|
8
|
+
from .organization_membership import OrganizationMembership
|
|
9
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class WhoAmIUser(UncheckedBaseModel):
|
|
13
|
+
"""
|
|
14
|
+
A ModelSerializer that takes additional arguments for
|
|
15
|
+
"fields", "omit" and "expand" in order to
|
|
16
|
+
control which fields are displayed, and whether to replace simple
|
|
17
|
+
values with complex, nested serializations
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
active_organization: typing.Optional[int] = None
|
|
21
|
+
active_organization_meta: str
|
|
22
|
+
allow_newsletters: typing.Optional[bool] = pydantic.Field(default=None)
|
|
23
|
+
"""
|
|
24
|
+
Allow sending newsletters to user
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
avatar: str
|
|
28
|
+
custom_hotkeys: typing.Optional[typing.Optional[typing.Any]] = None
|
|
29
|
+
date_joined: typing.Optional[dt.datetime] = None
|
|
30
|
+
email: typing.Optional[str] = None
|
|
31
|
+
first_name: typing.Optional[str] = None
|
|
32
|
+
id: int
|
|
33
|
+
initials: str
|
|
34
|
+
last_activity: dt.datetime
|
|
35
|
+
last_name: typing.Optional[str] = None
|
|
36
|
+
lse_fields: WhoAmILseFields
|
|
37
|
+
org_membership: typing.List[OrganizationMembership]
|
|
38
|
+
pause: str
|
|
39
|
+
phone: typing.Optional[str] = None
|
|
40
|
+
username: str
|
|
41
|
+
|
|
42
|
+
if IS_PYDANTIC_V2:
|
|
43
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
44
|
+
else:
|
|
45
|
+
|
|
46
|
+
class Config:
|
|
47
|
+
frozen = True
|
|
48
|
+
smart_union = True
|
|
49
|
+
extra = pydantic.Extra.allow
|
label_studio_sdk/users/client.py
CHANGED
|
@@ -11,6 +11,7 @@ import datetime as dt
|
|
|
11
11
|
from ..types.hotkeys import Hotkeys
|
|
12
12
|
from .types.users_reset_token_response import UsersResetTokenResponse
|
|
13
13
|
from .types.users_get_token_response import UsersGetTokenResponse
|
|
14
|
+
from ..types.who_am_i_user import WhoAmIUser
|
|
14
15
|
from ..types.lse_user import LseUser
|
|
15
16
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
16
17
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
@@ -348,7 +349,7 @@ class UsersClient:
|
|
|
348
349
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
349
350
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
350
351
|
|
|
351
|
-
def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
352
|
+
def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) -> WhoAmIUser:
|
|
352
353
|
"""
|
|
353
354
|
Retrieve details of the account that you are using to access the API.
|
|
354
355
|
|
|
@@ -359,7 +360,7 @@ class UsersClient:
|
|
|
359
360
|
|
|
360
361
|
Returns
|
|
361
362
|
-------
|
|
362
|
-
|
|
363
|
+
WhoAmIUser
|
|
363
364
|
|
|
364
365
|
|
|
365
366
|
Examples
|
|
@@ -379,9 +380,9 @@ class UsersClient:
|
|
|
379
380
|
try:
|
|
380
381
|
if 200 <= _response.status_code < 300:
|
|
381
382
|
return typing.cast(
|
|
382
|
-
|
|
383
|
+
WhoAmIUser,
|
|
383
384
|
construct_type(
|
|
384
|
-
type_=
|
|
385
|
+
type_=WhoAmIUser, # type: ignore
|
|
385
386
|
object_=_response.json(),
|
|
386
387
|
),
|
|
387
388
|
)
|
|
@@ -1109,7 +1110,7 @@ class AsyncUsersClient:
|
|
|
1109
1110
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1110
1111
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1111
1112
|
|
|
1112
|
-
async def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
1113
|
+
async def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) -> WhoAmIUser:
|
|
1113
1114
|
"""
|
|
1114
1115
|
Retrieve details of the account that you are using to access the API.
|
|
1115
1116
|
|
|
@@ -1120,7 +1121,7 @@ class AsyncUsersClient:
|
|
|
1120
1121
|
|
|
1121
1122
|
Returns
|
|
1122
1123
|
-------
|
|
1123
|
-
|
|
1124
|
+
WhoAmIUser
|
|
1124
1125
|
|
|
1125
1126
|
|
|
1126
1127
|
Examples
|
|
@@ -1148,9 +1149,9 @@ class AsyncUsersClient:
|
|
|
1148
1149
|
try:
|
|
1149
1150
|
if 200 <= _response.status_code < 300:
|
|
1150
1151
|
return typing.cast(
|
|
1151
|
-
|
|
1152
|
+
WhoAmIUser,
|
|
1152
1153
|
construct_type(
|
|
1153
|
-
type_=
|
|
1154
|
+
type_=WhoAmIUser, # type: ignore
|
|
1154
1155
|
object_=_response.json(),
|
|
1155
1156
|
),
|
|
1156
1157
|
)
|