label-studio-sdk 2.0.10__py3-none-any.whl → 2.0.12__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 +10 -0
- label_studio_sdk/activity_logs/client.py +12 -0
- label_studio_sdk/annotation_history/client.py +36 -0
- label_studio_sdk/annotation_reviews/client.py +60 -0
- label_studio_sdk/billing/client.py +12 -0
- label_studio_sdk/comments/client.py +72 -0
- label_studio_sdk/export_storage/azure_spi/client.py +84 -0
- label_studio_sdk/export_storage/databricks/client.py +84 -0
- label_studio_sdk/export_storage/gcswif/client.py +84 -0
- label_studio_sdk/export_storage/s3s/client.py +84 -0
- label_studio_sdk/import_storage/azure_spi/client.py +84 -0
- label_studio_sdk/import_storage/databricks/client.py +84 -0
- label_studio_sdk/import_storage/gcswif/client.py +84 -0
- label_studio_sdk/import_storage/s3s/client.py +84 -0
- label_studio_sdk/label_interface/control_tags.py +12 -7
- label_studio_sdk/ml/client.py +14 -2
- label_studio_sdk/model_providers/client.py +72 -0
- label_studio_sdk/organizations/client.py +30 -6
- label_studio_sdk/organizations/invites/client.py +24 -0
- label_studio_sdk/organizations/members/client.py +24 -0
- label_studio_sdk/organizations/permissions/client.py +60 -0
- label_studio_sdk/project_templates/client.py +76 -4
- label_studio_sdk/projects/__init__.py +14 -1
- label_studio_sdk/projects/assignments/client.py +60 -0
- label_studio_sdk/projects/client.py +20 -0
- label_studio_sdk/projects/members/bulk/client.py +24 -0
- label_studio_sdk/projects/members/client.py +149 -30
- label_studio_sdk/projects/members/paginated/client.py +12 -0
- label_studio_sdk/projects/metrics/client.py +24 -0
- label_studio_sdk/projects/pauses/client.py +60 -0
- label_studio_sdk/projects/roles/__init__.py +2 -0
- label_studio_sdk/projects/roles/client.py +555 -0
- label_studio_sdk/projects/stats/__init__.py +12 -0
- label_studio_sdk/projects/stats/client.py +766 -1
- label_studio_sdk/projects/stats/types/__init__.py +14 -0
- label_studio_sdk/projects/stats/types/stats_agreement_annotators_response.py +22 -0
- label_studio_sdk/projects/stats/types/stats_model_version_annotator_agreement_response.py +19 -0
- label_studio_sdk/projects/stats/types/stats_model_version_ground_truth_agreement_response.py +19 -0
- label_studio_sdk/projects/stats/types/stats_model_version_prediction_agreement_response.py +19 -0
- label_studio_sdk/projects/stats/types/stats_users_prediction_agreement_response.py +27 -0
- label_studio_sdk/projects/stats/types/stats_users_prediction_agreement_response_agreement_value.py +5 -0
- label_studio_sdk/prompts/client.py +96 -0
- label_studio_sdk/prompts/indicators/client.py +24 -0
- label_studio_sdk/prompts/runs/client.py +36 -0
- label_studio_sdk/prompts/versions/client.py +84 -0
- label_studio_sdk/sso/saml/client.py +24 -0
- label_studio_sdk/sso/scim/client.py +24 -0
- label_studio_sdk/types/__init__.py +10 -0
- label_studio_sdk/types/all_roles_project_list.py +5 -1
- label_studio_sdk/types/default_role.py +2 -2
- label_studio_sdk/types/lse_organization.py +1 -1
- label_studio_sdk/types/lse_project.py +5 -1
- label_studio_sdk/types/lse_project_create.py +5 -1
- label_studio_sdk/types/lse_project_response.py +5 -1
- label_studio_sdk/types/lse_project_update.py +5 -1
- label_studio_sdk/types/project.py +198 -0
- label_studio_sdk/types/project_member.py +19 -0
- label_studio_sdk/types/project_role.py +35 -0
- label_studio_sdk/types/project_sampling.py +7 -0
- label_studio_sdk/types/project_skip_queue.py +7 -0
- label_studio_sdk/types/project_template.py +1 -1
- label_studio_sdk/types/project_template_request.py +1 -1
- label_studio_sdk/users/client.py +24 -0
- label_studio_sdk/versions/client.py +12 -0
- label_studio_sdk/workspaces/__init__.py +2 -2
- label_studio_sdk/workspaces/client.py +4 -0
- label_studio_sdk/workspaces/projects/__init__.py +2 -0
- label_studio_sdk/workspaces/projects/client.py +352 -0
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/RECORD +72 -57
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,555 @@
|
|
|
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.project_role import ProjectRole
|
|
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.role9e7enum import Role9E7Enum
|
|
11
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
12
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class RolesClient:
|
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
|
+
self._client_wrapper = client_wrapper
|
|
21
|
+
|
|
22
|
+
def list(
|
|
23
|
+
self,
|
|
24
|
+
*,
|
|
25
|
+
ids: typing.Optional[int] = None,
|
|
26
|
+
ordering: typing.Optional[str] = None,
|
|
27
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
28
|
+
) -> typing.List[ProjectRole]:
|
|
29
|
+
"""
|
|
30
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
31
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
32
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
33
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
34
|
+
</p>
|
|
35
|
+
</Card>
|
|
36
|
+
|
|
37
|
+
List project roles for requested IDs for the current user
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Parameters
|
|
41
|
+
----------
|
|
42
|
+
ids : typing.Optional[int]
|
|
43
|
+
|
|
44
|
+
ordering : typing.Optional[str]
|
|
45
|
+
Which field to use when ordering the results.
|
|
46
|
+
|
|
47
|
+
request_options : typing.Optional[RequestOptions]
|
|
48
|
+
Request-specific configuration.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
typing.List[ProjectRole]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Examples
|
|
56
|
+
--------
|
|
57
|
+
from label_studio_sdk import LabelStudio
|
|
58
|
+
|
|
59
|
+
client = LabelStudio(
|
|
60
|
+
api_key="YOUR_API_KEY",
|
|
61
|
+
)
|
|
62
|
+
client.projects.roles.list()
|
|
63
|
+
"""
|
|
64
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
65
|
+
"api/projects/roles/",
|
|
66
|
+
method="GET",
|
|
67
|
+
params={
|
|
68
|
+
"ids": ids,
|
|
69
|
+
"ordering": ordering,
|
|
70
|
+
},
|
|
71
|
+
request_options=request_options,
|
|
72
|
+
)
|
|
73
|
+
try:
|
|
74
|
+
if 200 <= _response.status_code < 300:
|
|
75
|
+
return typing.cast(
|
|
76
|
+
typing.List[ProjectRole],
|
|
77
|
+
construct_type(
|
|
78
|
+
type_=typing.List[ProjectRole], # type: ignore
|
|
79
|
+
object_=_response.json(),
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
_response_json = _response.json()
|
|
83
|
+
except JSONDecodeError:
|
|
84
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
85
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
86
|
+
|
|
87
|
+
def add(
|
|
88
|
+
self, *, project: int, role: Role9E7Enum, user: int, request_options: typing.Optional[RequestOptions] = None
|
|
89
|
+
) -> ProjectRole:
|
|
90
|
+
"""
|
|
91
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
92
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
93
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
94
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
95
|
+
</p>
|
|
96
|
+
</Card>
|
|
97
|
+
|
|
98
|
+
Create project role for user allowing the user the same access level provided by organization role.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
Parameters
|
|
102
|
+
----------
|
|
103
|
+
project : int
|
|
104
|
+
|
|
105
|
+
role : Role9E7Enum
|
|
106
|
+
User role in project
|
|
107
|
+
|
|
108
|
+
* `OW` - Owner
|
|
109
|
+
* `AD` - Administrator
|
|
110
|
+
* `MA` - Manager
|
|
111
|
+
* `RE` - Reviewer
|
|
112
|
+
* `AN` - Annotator
|
|
113
|
+
* `DI` - Deactivated
|
|
114
|
+
* `NO` - Not Activated
|
|
115
|
+
|
|
116
|
+
user : int
|
|
117
|
+
|
|
118
|
+
request_options : typing.Optional[RequestOptions]
|
|
119
|
+
Request-specific configuration.
|
|
120
|
+
|
|
121
|
+
Returns
|
|
122
|
+
-------
|
|
123
|
+
ProjectRole
|
|
124
|
+
Role created
|
|
125
|
+
|
|
126
|
+
Examples
|
|
127
|
+
--------
|
|
128
|
+
from label_studio_sdk import LabelStudio
|
|
129
|
+
|
|
130
|
+
client = LabelStudio(
|
|
131
|
+
api_key="YOUR_API_KEY",
|
|
132
|
+
)
|
|
133
|
+
client.projects.roles.add(
|
|
134
|
+
project=1,
|
|
135
|
+
role="OW",
|
|
136
|
+
user=1,
|
|
137
|
+
)
|
|
138
|
+
"""
|
|
139
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
140
|
+
"api/projects/roles/",
|
|
141
|
+
method="POST",
|
|
142
|
+
json={
|
|
143
|
+
"project": project,
|
|
144
|
+
"role": role,
|
|
145
|
+
"user": user,
|
|
146
|
+
},
|
|
147
|
+
headers={
|
|
148
|
+
"content-type": "application/json",
|
|
149
|
+
},
|
|
150
|
+
request_options=request_options,
|
|
151
|
+
omit=OMIT,
|
|
152
|
+
)
|
|
153
|
+
try:
|
|
154
|
+
if 200 <= _response.status_code < 300:
|
|
155
|
+
return typing.cast(
|
|
156
|
+
ProjectRole,
|
|
157
|
+
construct_type(
|
|
158
|
+
type_=ProjectRole, # type: ignore
|
|
159
|
+
object_=_response.json(),
|
|
160
|
+
),
|
|
161
|
+
)
|
|
162
|
+
_response_json = _response.json()
|
|
163
|
+
except JSONDecodeError:
|
|
164
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
165
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
166
|
+
|
|
167
|
+
def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
168
|
+
"""
|
|
169
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
170
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
171
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
172
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
173
|
+
</p>
|
|
174
|
+
</Card>
|
|
175
|
+
|
|
176
|
+
Remove project role for user allowing the user the same access level provided by organization role.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
Parameters
|
|
180
|
+
----------
|
|
181
|
+
id : int
|
|
182
|
+
A unique integer value identifying this project role.
|
|
183
|
+
|
|
184
|
+
request_options : typing.Optional[RequestOptions]
|
|
185
|
+
Request-specific configuration.
|
|
186
|
+
|
|
187
|
+
Returns
|
|
188
|
+
-------
|
|
189
|
+
None
|
|
190
|
+
|
|
191
|
+
Examples
|
|
192
|
+
--------
|
|
193
|
+
from label_studio_sdk import LabelStudio
|
|
194
|
+
|
|
195
|
+
client = LabelStudio(
|
|
196
|
+
api_key="YOUR_API_KEY",
|
|
197
|
+
)
|
|
198
|
+
client.projects.roles.remove(
|
|
199
|
+
id=1,
|
|
200
|
+
)
|
|
201
|
+
"""
|
|
202
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
203
|
+
f"api/projects/roles/{jsonable_encoder(id)}/",
|
|
204
|
+
method="DELETE",
|
|
205
|
+
request_options=request_options,
|
|
206
|
+
)
|
|
207
|
+
try:
|
|
208
|
+
if 200 <= _response.status_code < 300:
|
|
209
|
+
return
|
|
210
|
+
_response_json = _response.json()
|
|
211
|
+
except JSONDecodeError:
|
|
212
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
213
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
214
|
+
|
|
215
|
+
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[ProjectRole]:
|
|
216
|
+
"""
|
|
217
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
218
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
219
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
220
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
221
|
+
</p>
|
|
222
|
+
</Card>
|
|
223
|
+
|
|
224
|
+
List users and their project level roles for a given project.
|
|
225
|
+
If user is not listed here and is a member of the project then they would behave as assigned role in organization.
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
Parameters
|
|
229
|
+
----------
|
|
230
|
+
id : int
|
|
231
|
+
|
|
232
|
+
request_options : typing.Optional[RequestOptions]
|
|
233
|
+
Request-specific configuration.
|
|
234
|
+
|
|
235
|
+
Returns
|
|
236
|
+
-------
|
|
237
|
+
typing.List[ProjectRole]
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
Examples
|
|
241
|
+
--------
|
|
242
|
+
from label_studio_sdk import LabelStudio
|
|
243
|
+
|
|
244
|
+
client = LabelStudio(
|
|
245
|
+
api_key="YOUR_API_KEY",
|
|
246
|
+
)
|
|
247
|
+
client.projects.roles.get(
|
|
248
|
+
id=1,
|
|
249
|
+
)
|
|
250
|
+
"""
|
|
251
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
252
|
+
f"api/projects/{jsonable_encoder(id)}/roles",
|
|
253
|
+
method="GET",
|
|
254
|
+
request_options=request_options,
|
|
255
|
+
)
|
|
256
|
+
try:
|
|
257
|
+
if 200 <= _response.status_code < 300:
|
|
258
|
+
return typing.cast(
|
|
259
|
+
typing.List[ProjectRole],
|
|
260
|
+
construct_type(
|
|
261
|
+
type_=typing.List[ProjectRole], # type: ignore
|
|
262
|
+
object_=_response.json(),
|
|
263
|
+
),
|
|
264
|
+
)
|
|
265
|
+
_response_json = _response.json()
|
|
266
|
+
except JSONDecodeError:
|
|
267
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
268
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class AsyncRolesClient:
|
|
272
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
273
|
+
self._client_wrapper = client_wrapper
|
|
274
|
+
|
|
275
|
+
async def list(
|
|
276
|
+
self,
|
|
277
|
+
*,
|
|
278
|
+
ids: typing.Optional[int] = None,
|
|
279
|
+
ordering: typing.Optional[str] = None,
|
|
280
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
281
|
+
) -> typing.List[ProjectRole]:
|
|
282
|
+
"""
|
|
283
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
284
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
285
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
286
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
287
|
+
</p>
|
|
288
|
+
</Card>
|
|
289
|
+
|
|
290
|
+
List project roles for requested IDs for the current user
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
Parameters
|
|
294
|
+
----------
|
|
295
|
+
ids : typing.Optional[int]
|
|
296
|
+
|
|
297
|
+
ordering : typing.Optional[str]
|
|
298
|
+
Which field to use when ordering the results.
|
|
299
|
+
|
|
300
|
+
request_options : typing.Optional[RequestOptions]
|
|
301
|
+
Request-specific configuration.
|
|
302
|
+
|
|
303
|
+
Returns
|
|
304
|
+
-------
|
|
305
|
+
typing.List[ProjectRole]
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
Examples
|
|
309
|
+
--------
|
|
310
|
+
import asyncio
|
|
311
|
+
|
|
312
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
313
|
+
|
|
314
|
+
client = AsyncLabelStudio(
|
|
315
|
+
api_key="YOUR_API_KEY",
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
async def main() -> None:
|
|
320
|
+
await client.projects.roles.list()
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
asyncio.run(main())
|
|
324
|
+
"""
|
|
325
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
326
|
+
"api/projects/roles/",
|
|
327
|
+
method="GET",
|
|
328
|
+
params={
|
|
329
|
+
"ids": ids,
|
|
330
|
+
"ordering": ordering,
|
|
331
|
+
},
|
|
332
|
+
request_options=request_options,
|
|
333
|
+
)
|
|
334
|
+
try:
|
|
335
|
+
if 200 <= _response.status_code < 300:
|
|
336
|
+
return typing.cast(
|
|
337
|
+
typing.List[ProjectRole],
|
|
338
|
+
construct_type(
|
|
339
|
+
type_=typing.List[ProjectRole], # type: ignore
|
|
340
|
+
object_=_response.json(),
|
|
341
|
+
),
|
|
342
|
+
)
|
|
343
|
+
_response_json = _response.json()
|
|
344
|
+
except JSONDecodeError:
|
|
345
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
346
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
347
|
+
|
|
348
|
+
async def add(
|
|
349
|
+
self, *, project: int, role: Role9E7Enum, user: int, request_options: typing.Optional[RequestOptions] = None
|
|
350
|
+
) -> ProjectRole:
|
|
351
|
+
"""
|
|
352
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
353
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
354
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
355
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
356
|
+
</p>
|
|
357
|
+
</Card>
|
|
358
|
+
|
|
359
|
+
Create project role for user allowing the user the same access level provided by organization role.
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
Parameters
|
|
363
|
+
----------
|
|
364
|
+
project : int
|
|
365
|
+
|
|
366
|
+
role : Role9E7Enum
|
|
367
|
+
User role in project
|
|
368
|
+
|
|
369
|
+
* `OW` - Owner
|
|
370
|
+
* `AD` - Administrator
|
|
371
|
+
* `MA` - Manager
|
|
372
|
+
* `RE` - Reviewer
|
|
373
|
+
* `AN` - Annotator
|
|
374
|
+
* `DI` - Deactivated
|
|
375
|
+
* `NO` - Not Activated
|
|
376
|
+
|
|
377
|
+
user : int
|
|
378
|
+
|
|
379
|
+
request_options : typing.Optional[RequestOptions]
|
|
380
|
+
Request-specific configuration.
|
|
381
|
+
|
|
382
|
+
Returns
|
|
383
|
+
-------
|
|
384
|
+
ProjectRole
|
|
385
|
+
Role created
|
|
386
|
+
|
|
387
|
+
Examples
|
|
388
|
+
--------
|
|
389
|
+
import asyncio
|
|
390
|
+
|
|
391
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
392
|
+
|
|
393
|
+
client = AsyncLabelStudio(
|
|
394
|
+
api_key="YOUR_API_KEY",
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
async def main() -> None:
|
|
399
|
+
await client.projects.roles.add(
|
|
400
|
+
project=1,
|
|
401
|
+
role="OW",
|
|
402
|
+
user=1,
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
asyncio.run(main())
|
|
407
|
+
"""
|
|
408
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
409
|
+
"api/projects/roles/",
|
|
410
|
+
method="POST",
|
|
411
|
+
json={
|
|
412
|
+
"project": project,
|
|
413
|
+
"role": role,
|
|
414
|
+
"user": user,
|
|
415
|
+
},
|
|
416
|
+
headers={
|
|
417
|
+
"content-type": "application/json",
|
|
418
|
+
},
|
|
419
|
+
request_options=request_options,
|
|
420
|
+
omit=OMIT,
|
|
421
|
+
)
|
|
422
|
+
try:
|
|
423
|
+
if 200 <= _response.status_code < 300:
|
|
424
|
+
return typing.cast(
|
|
425
|
+
ProjectRole,
|
|
426
|
+
construct_type(
|
|
427
|
+
type_=ProjectRole, # type: ignore
|
|
428
|
+
object_=_response.json(),
|
|
429
|
+
),
|
|
430
|
+
)
|
|
431
|
+
_response_json = _response.json()
|
|
432
|
+
except JSONDecodeError:
|
|
433
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
434
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
435
|
+
|
|
436
|
+
async def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
437
|
+
"""
|
|
438
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
439
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
440
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
441
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
442
|
+
</p>
|
|
443
|
+
</Card>
|
|
444
|
+
|
|
445
|
+
Remove project role for user allowing the user the same access level provided by organization role.
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
Parameters
|
|
449
|
+
----------
|
|
450
|
+
id : int
|
|
451
|
+
A unique integer value identifying this project role.
|
|
452
|
+
|
|
453
|
+
request_options : typing.Optional[RequestOptions]
|
|
454
|
+
Request-specific configuration.
|
|
455
|
+
|
|
456
|
+
Returns
|
|
457
|
+
-------
|
|
458
|
+
None
|
|
459
|
+
|
|
460
|
+
Examples
|
|
461
|
+
--------
|
|
462
|
+
import asyncio
|
|
463
|
+
|
|
464
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
465
|
+
|
|
466
|
+
client = AsyncLabelStudio(
|
|
467
|
+
api_key="YOUR_API_KEY",
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
async def main() -> None:
|
|
472
|
+
await client.projects.roles.remove(
|
|
473
|
+
id=1,
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
asyncio.run(main())
|
|
478
|
+
"""
|
|
479
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
480
|
+
f"api/projects/roles/{jsonable_encoder(id)}/",
|
|
481
|
+
method="DELETE",
|
|
482
|
+
request_options=request_options,
|
|
483
|
+
)
|
|
484
|
+
try:
|
|
485
|
+
if 200 <= _response.status_code < 300:
|
|
486
|
+
return
|
|
487
|
+
_response_json = _response.json()
|
|
488
|
+
except JSONDecodeError:
|
|
489
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
490
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
491
|
+
|
|
492
|
+
async def get(
|
|
493
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
494
|
+
) -> typing.List[ProjectRole]:
|
|
495
|
+
"""
|
|
496
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
497
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
498
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
499
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
500
|
+
</p>
|
|
501
|
+
</Card>
|
|
502
|
+
|
|
503
|
+
List users and their project level roles for a given project.
|
|
504
|
+
If user is not listed here and is a member of the project then they would behave as assigned role in organization.
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
Parameters
|
|
508
|
+
----------
|
|
509
|
+
id : int
|
|
510
|
+
|
|
511
|
+
request_options : typing.Optional[RequestOptions]
|
|
512
|
+
Request-specific configuration.
|
|
513
|
+
|
|
514
|
+
Returns
|
|
515
|
+
-------
|
|
516
|
+
typing.List[ProjectRole]
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
Examples
|
|
520
|
+
--------
|
|
521
|
+
import asyncio
|
|
522
|
+
|
|
523
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
524
|
+
|
|
525
|
+
client = AsyncLabelStudio(
|
|
526
|
+
api_key="YOUR_API_KEY",
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
async def main() -> None:
|
|
531
|
+
await client.projects.roles.get(
|
|
532
|
+
id=1,
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
asyncio.run(main())
|
|
537
|
+
"""
|
|
538
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
539
|
+
f"api/projects/{jsonable_encoder(id)}/roles",
|
|
540
|
+
method="GET",
|
|
541
|
+
request_options=request_options,
|
|
542
|
+
)
|
|
543
|
+
try:
|
|
544
|
+
if 200 <= _response.status_code < 300:
|
|
545
|
+
return typing.cast(
|
|
546
|
+
typing.List[ProjectRole],
|
|
547
|
+
construct_type(
|
|
548
|
+
type_=typing.List[ProjectRole], # type: ignore
|
|
549
|
+
object_=_response.json(),
|
|
550
|
+
),
|
|
551
|
+
)
|
|
552
|
+
_response_json = _response.json()
|
|
553
|
+
except JSONDecodeError:
|
|
554
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
555
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from .types import (
|
|
4
4
|
StatsAgreementAnnotatorResponse,
|
|
5
|
+
StatsAgreementAnnotatorsResponse,
|
|
5
6
|
StatsDataFiltersResponse,
|
|
6
7
|
StatsDataFiltersResponseUserFilters,
|
|
7
8
|
StatsDataFiltersResponseUserFiltersStatsItem,
|
|
@@ -12,6 +13,9 @@ from .types import (
|
|
|
12
13
|
StatsIaaResponseStd,
|
|
13
14
|
StatsLeadTimeResponse,
|
|
14
15
|
StatsLeadTimeResponseLeadTimeStatsItem,
|
|
16
|
+
StatsModelVersionAnnotatorAgreementResponse,
|
|
17
|
+
StatsModelVersionGroundTruthAgreementResponse,
|
|
18
|
+
StatsModelVersionPredictionAgreementResponse,
|
|
15
19
|
StatsTotalAgreementResponse,
|
|
16
20
|
StatsTotalAgreementResponseOne,
|
|
17
21
|
StatsTotalAgreementResponseZero,
|
|
@@ -22,10 +26,13 @@ from .types import (
|
|
|
22
26
|
StatsUserReviewScoreResponse,
|
|
23
27
|
StatsUserReviewScoreResponsePerformanceScore,
|
|
24
28
|
StatsUserReviewScoreResponseReviewScore,
|
|
29
|
+
StatsUsersPredictionAgreementResponse,
|
|
30
|
+
StatsUsersPredictionAgreementResponseAgreementValue,
|
|
25
31
|
)
|
|
26
32
|
|
|
27
33
|
__all__ = [
|
|
28
34
|
"StatsAgreementAnnotatorResponse",
|
|
35
|
+
"StatsAgreementAnnotatorsResponse",
|
|
29
36
|
"StatsDataFiltersResponse",
|
|
30
37
|
"StatsDataFiltersResponseUserFilters",
|
|
31
38
|
"StatsDataFiltersResponseUserFiltersStatsItem",
|
|
@@ -36,6 +43,9 @@ __all__ = [
|
|
|
36
43
|
"StatsIaaResponseStd",
|
|
37
44
|
"StatsLeadTimeResponse",
|
|
38
45
|
"StatsLeadTimeResponseLeadTimeStatsItem",
|
|
46
|
+
"StatsModelVersionAnnotatorAgreementResponse",
|
|
47
|
+
"StatsModelVersionGroundTruthAgreementResponse",
|
|
48
|
+
"StatsModelVersionPredictionAgreementResponse",
|
|
39
49
|
"StatsTotalAgreementResponse",
|
|
40
50
|
"StatsTotalAgreementResponseOne",
|
|
41
51
|
"StatsTotalAgreementResponseZero",
|
|
@@ -46,4 +56,6 @@ __all__ = [
|
|
|
46
56
|
"StatsUserReviewScoreResponse",
|
|
47
57
|
"StatsUserReviewScoreResponsePerformanceScore",
|
|
48
58
|
"StatsUserReviewScoreResponseReviewScore",
|
|
59
|
+
"StatsUsersPredictionAgreementResponse",
|
|
60
|
+
"StatsUsersPredictionAgreementResponseAgreementValue",
|
|
49
61
|
]
|