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.

Files changed (39) hide show
  1. label_studio_sdk/__init__.py +24 -0
  2. label_studio_sdk/base_client.py +4 -0
  3. label_studio_sdk/label_interface/interface.py +0 -4
  4. label_studio_sdk/projects/__init__.py +4 -1
  5. label_studio_sdk/projects/assignments/__init__.py +2 -0
  6. label_studio_sdk/projects/assignments/client.py +43 -6
  7. label_studio_sdk/projects/assignments/types/__init__.py +2 -0
  8. label_studio_sdk/projects/assignments/types/assignments_delete_request_type.py +5 -0
  9. label_studio_sdk/projects/client.py +4 -0
  10. label_studio_sdk/projects/members/__init__.py +6 -0
  11. label_studio_sdk/projects/members/bulk/__init__.py +5 -0
  12. label_studio_sdk/projects/members/bulk/client.py +273 -0
  13. label_studio_sdk/projects/members/bulk/types/__init__.py +6 -0
  14. label_studio_sdk/projects/members/bulk/types/bulk_delete_response.py +19 -0
  15. label_studio_sdk/projects/members/bulk/types/bulk_post_response.py +19 -0
  16. label_studio_sdk/projects/members/client.py +141 -0
  17. label_studio_sdk/sso/__init__.py +5 -0
  18. label_studio_sdk/sso/client.py +22 -0
  19. label_studio_sdk/sso/saml/__init__.py +2 -0
  20. label_studio_sdk/sso/saml/client.py +278 -0
  21. label_studio_sdk/sso/scim/__init__.py +2 -0
  22. label_studio_sdk/sso/scim/client.py +278 -0
  23. label_studio_sdk/types/__init__.py +22 -0
  24. label_studio_sdk/types/project_group.py +22 -0
  25. label_studio_sdk/types/project_group_request.py +22 -0
  26. label_studio_sdk/types/project_group_role_enum.py +5 -0
  27. label_studio_sdk/types/saml_settings.py +21 -0
  28. label_studio_sdk/types/saml_settings_update.py +22 -0
  29. label_studio_sdk/types/scim_settings.py +21 -0
  30. label_studio_sdk/types/scim_settings_update.py +22 -0
  31. label_studio_sdk/types/who_am_i_lse_fields.py +50 -0
  32. label_studio_sdk/types/who_am_i_lse_fields_onboarding_state.py +8 -0
  33. label_studio_sdk/types/who_am_i_lse_fields_trial_role.py +8 -0
  34. label_studio_sdk/types/who_am_i_user.py +49 -0
  35. label_studio_sdk/users/client.py +9 -8
  36. {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/METADATA +1 -1
  37. {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/RECORD +39 -14
  38. {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/LICENSE +0 -0
  39. {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,141 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.client_wrapper import SyncClientWrapper
4
+ from .bulk.client import BulkClient
5
+ import typing
6
+ from ...core.request_options import RequestOptions
7
+ from ...types.lse_user import LseUser
8
+ from ...core.jsonable_encoder import jsonable_encoder
9
+ from ...core.unchecked_base_model import construct_type
10
+ from json.decoder import JSONDecodeError
11
+ from ...core.api_error import ApiError
12
+ from ...core.client_wrapper import AsyncClientWrapper
13
+ from .bulk.client import AsyncBulkClient
14
+
15
+
16
+ class MembersClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+ self.bulk = BulkClient(client_wrapper=self._client_wrapper)
20
+
21
+ def get(
22
+ self, id: int, *, user_ids: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
23
+ ) -> typing.List[LseUser]:
24
+ """
25
+ Retrieve the members for a specific project. Optionally filter by user IDs (comma-separated).
26
+
27
+ Parameters
28
+ ----------
29
+ id : int
30
+
31
+ user_ids : typing.Optional[str]
32
+ Comma-separated list of user IDs to include. Example: user_ids=1,2,3
33
+
34
+ request_options : typing.Optional[RequestOptions]
35
+ Request-specific configuration.
36
+
37
+ Returns
38
+ -------
39
+ typing.List[LseUser]
40
+ List of users with membership information
41
+
42
+ Examples
43
+ --------
44
+ from label_studio_sdk import LabelStudio
45
+
46
+ client = LabelStudio(
47
+ api_key="YOUR_API_KEY",
48
+ )
49
+ client.projects.members.get(
50
+ id=1,
51
+ )
52
+ """
53
+ _response = self._client_wrapper.httpx_client.request(
54
+ f"api/projects/{jsonable_encoder(id)}/members/",
55
+ method="GET",
56
+ params={
57
+ "user_ids": user_ids,
58
+ },
59
+ request_options=request_options,
60
+ )
61
+ try:
62
+ if 200 <= _response.status_code < 300:
63
+ return typing.cast(
64
+ typing.List[LseUser],
65
+ construct_type(
66
+ type_=typing.List[LseUser], # type: ignore
67
+ object_=_response.json(),
68
+ ),
69
+ )
70
+ _response_json = _response.json()
71
+ except JSONDecodeError:
72
+ raise ApiError(status_code=_response.status_code, body=_response.text)
73
+ raise ApiError(status_code=_response.status_code, body=_response_json)
74
+
75
+
76
+ class AsyncMembersClient:
77
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
78
+ self._client_wrapper = client_wrapper
79
+ self.bulk = AsyncBulkClient(client_wrapper=self._client_wrapper)
80
+
81
+ async def get(
82
+ self, id: int, *, user_ids: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
83
+ ) -> typing.List[LseUser]:
84
+ """
85
+ Retrieve the members for a specific project. Optionally filter by user IDs (comma-separated).
86
+
87
+ Parameters
88
+ ----------
89
+ id : int
90
+
91
+ user_ids : typing.Optional[str]
92
+ Comma-separated list of user IDs to include. Example: user_ids=1,2,3
93
+
94
+ request_options : typing.Optional[RequestOptions]
95
+ Request-specific configuration.
96
+
97
+ Returns
98
+ -------
99
+ typing.List[LseUser]
100
+ List of users with membership information
101
+
102
+ Examples
103
+ --------
104
+ import asyncio
105
+
106
+ from label_studio_sdk import AsyncLabelStudio
107
+
108
+ client = AsyncLabelStudio(
109
+ api_key="YOUR_API_KEY",
110
+ )
111
+
112
+
113
+ async def main() -> None:
114
+ await client.projects.members.get(
115
+ id=1,
116
+ )
117
+
118
+
119
+ asyncio.run(main())
120
+ """
121
+ _response = await self._client_wrapper.httpx_client.request(
122
+ f"api/projects/{jsonable_encoder(id)}/members/",
123
+ method="GET",
124
+ params={
125
+ "user_ids": user_ids,
126
+ },
127
+ request_options=request_options,
128
+ )
129
+ try:
130
+ if 200 <= _response.status_code < 300:
131
+ return typing.cast(
132
+ typing.List[LseUser],
133
+ construct_type(
134
+ type_=typing.List[LseUser], # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ )
138
+ _response_json = _response.json()
139
+ except JSONDecodeError:
140
+ raise ApiError(status_code=_response.status_code, body=_response.text)
141
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from . import saml, scim
4
+
5
+ __all__ = ["saml", "scim"]
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.client_wrapper import SyncClientWrapper
4
+ from .saml.client import SamlClient
5
+ from .scim.client import ScimClient
6
+ from ..core.client_wrapper import AsyncClientWrapper
7
+ from .saml.client import AsyncSamlClient
8
+ from .scim.client import AsyncScimClient
9
+
10
+
11
+ class SsoClient:
12
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
13
+ self._client_wrapper = client_wrapper
14
+ self.saml = SamlClient(client_wrapper=self._client_wrapper)
15
+ self.scim = ScimClient(client_wrapper=self._client_wrapper)
16
+
17
+
18
+ class AsyncSsoClient:
19
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
20
+ self._client_wrapper = client_wrapper
21
+ self.saml = AsyncSamlClient(client_wrapper=self._client_wrapper)
22
+ self.scim = AsyncScimClient(client_wrapper=self._client_wrapper)
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -0,0 +1,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,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+