label-studio-sdk 2.0.2__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 +16 -0
- label_studio_sdk/base_client.py +4 -0
- 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 +2 -0
- label_studio_sdk/projects/members/client.py +137 -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 +14 -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-2.0.2.dist-info → label_studio_sdk-2.0.3.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.3.dist-info}/RECORD +28 -12
- {label_studio_sdk-2.0.2.dist-info → label_studio_sdk-2.0.3.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.2.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)
|
|
@@ -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
|
|
@@ -302,6 +309,9 @@ __all__ = [
|
|
|
302
309
|
"Prediction",
|
|
303
310
|
"PredictionRequest",
|
|
304
311
|
"Project",
|
|
312
|
+
"ProjectGroup",
|
|
313
|
+
"ProjectGroupRequest",
|
|
314
|
+
"ProjectGroupRoleEnum",
|
|
305
315
|
"ProjectImport",
|
|
306
316
|
"ProjectLabelConfig",
|
|
307
317
|
"ProjectLabelConfigRequest",
|
|
@@ -327,7 +337,11 @@ __all__ = [
|
|
|
327
337
|
"RoleBasedTask",
|
|
328
338
|
"S3ExportStorage",
|
|
329
339
|
"S3ImportStorage",
|
|
340
|
+
"SamlSettings",
|
|
341
|
+
"SamlSettingsUpdate",
|
|
330
342
|
"SamplingEnum",
|
|
343
|
+
"ScimSettings",
|
|
344
|
+
"ScimSettingsUpdate",
|
|
331
345
|
"ScopeEnum",
|
|
332
346
|
"SelectedItemsRequest",
|
|
333
347
|
"SerializationOption",
|
|
@@ -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
|