label-studio-sdk 1.0.10__py3-none-any.whl → 1.0.11__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 +17 -1
- label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +5 -0
- label_studio_sdk/base_client.py +8 -0
- label_studio_sdk/core/client_wrapper.py +34 -15
- label_studio_sdk/errors/__init__.py +3 -1
- label_studio_sdk/errors/not_found_error.py +9 -0
- label_studio_sdk/errors/unauthorized_error.py +9 -0
- label_studio_sdk/jwt_settings/__init__.py +2 -0
- label_studio_sdk/jwt_settings/client.py +259 -0
- label_studio_sdk/label_interface/control_tags.py +15 -2
- label_studio_sdk/label_interface/interface.py +80 -1
- label_studio_sdk/label_interface/object_tags.py +2 -2
- label_studio_sdk/projects/__init__.py +2 -1
- label_studio_sdk/projects/client.py +4 -0
- label_studio_sdk/projects/exports/client_ext.py +106 -40
- label_studio_sdk/projects/pauses/__init__.py +2 -0
- label_studio_sdk/projects/pauses/client.py +704 -0
- label_studio_sdk/projects/types/projects_update_response.py +10 -0
- label_studio_sdk/tokens/__init__.py +2 -0
- label_studio_sdk/tokens/client.py +470 -0
- label_studio_sdk/tokens/client_ext.py +94 -0
- label_studio_sdk/types/__init__.py +10 -0
- label_studio_sdk/types/access_token_response.py +22 -0
- label_studio_sdk/types/api_token_response.py +32 -0
- label_studio_sdk/types/jwt_settings_response.py +32 -0
- label_studio_sdk/types/model_provider_connection_provider.py +1 -1
- label_studio_sdk/types/pause.py +34 -0
- label_studio_sdk/types/pause_paused_by.py +5 -0
- label_studio_sdk/types/project.py +10 -0
- label_studio_sdk/types/prompt_version_provider.py +1 -1
- {label_studio_sdk-1.0.10.dist-info → label_studio_sdk-1.0.11.dist-info}/METADATA +2 -1
- {label_studio_sdk-1.0.10.dist-info → label_studio_sdk-1.0.11.dist-info}/RECORD +34 -20
- {label_studio_sdk-1.0.10.dist-info → label_studio_sdk-1.0.11.dist-info}/WHEEL +1 -1
- {label_studio_sdk-1.0.10.dist-info → label_studio_sdk-1.0.11.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,704 @@
|
|
|
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.pause import Pause
|
|
7
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
9
|
+
from json.decoder import JSONDecodeError
|
|
10
|
+
from ...core.api_error import ApiError
|
|
11
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class PausesClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._client_wrapper = client_wrapper
|
|
20
|
+
|
|
21
|
+
def list(
|
|
22
|
+
self,
|
|
23
|
+
project_pk: int,
|
|
24
|
+
user_pk: int,
|
|
25
|
+
*,
|
|
26
|
+
include_deleted: typing.Optional[bool] = None,
|
|
27
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
28
|
+
) -> typing.List[Pause]:
|
|
29
|
+
"""
|
|
30
|
+
Return a list of pause objects for the specified project and user.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
project_pk : int
|
|
35
|
+
Project ID
|
|
36
|
+
|
|
37
|
+
user_pk : int
|
|
38
|
+
User ID
|
|
39
|
+
|
|
40
|
+
include_deleted : typing.Optional[bool]
|
|
41
|
+
Include deleted pauses
|
|
42
|
+
|
|
43
|
+
request_options : typing.Optional[RequestOptions]
|
|
44
|
+
Request-specific configuration.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
typing.List[Pause]
|
|
49
|
+
Successfully retrieved a list of pauses
|
|
50
|
+
|
|
51
|
+
Examples
|
|
52
|
+
--------
|
|
53
|
+
from label_studio_sdk import LabelStudio
|
|
54
|
+
|
|
55
|
+
client = LabelStudio(
|
|
56
|
+
api_key="YOUR_API_KEY",
|
|
57
|
+
)
|
|
58
|
+
client.projects.pauses.list(
|
|
59
|
+
project_pk=1,
|
|
60
|
+
user_pk=1,
|
|
61
|
+
)
|
|
62
|
+
"""
|
|
63
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
64
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses",
|
|
65
|
+
method="GET",
|
|
66
|
+
params={
|
|
67
|
+
"include_deleted": include_deleted,
|
|
68
|
+
},
|
|
69
|
+
request_options=request_options,
|
|
70
|
+
)
|
|
71
|
+
try:
|
|
72
|
+
if 200 <= _response.status_code < 300:
|
|
73
|
+
return typing.cast(
|
|
74
|
+
typing.List[Pause],
|
|
75
|
+
parse_obj_as(
|
|
76
|
+
type_=typing.List[Pause], # type: ignore
|
|
77
|
+
object_=_response.json(),
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
_response_json = _response.json()
|
|
81
|
+
except JSONDecodeError:
|
|
82
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
83
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
84
|
+
|
|
85
|
+
def create(
|
|
86
|
+
self,
|
|
87
|
+
project_pk: int,
|
|
88
|
+
user_pk: int,
|
|
89
|
+
*,
|
|
90
|
+
reason: str,
|
|
91
|
+
verbose_reason: typing.Optional[str] = OMIT,
|
|
92
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
93
|
+
) -> Pause:
|
|
94
|
+
"""
|
|
95
|
+
Create a new pause object for the specified project and user.
|
|
96
|
+
|
|
97
|
+
Parameters
|
|
98
|
+
----------
|
|
99
|
+
project_pk : int
|
|
100
|
+
Project ID
|
|
101
|
+
|
|
102
|
+
user_pk : int
|
|
103
|
+
User ID
|
|
104
|
+
|
|
105
|
+
reason : str
|
|
106
|
+
|
|
107
|
+
verbose_reason : typing.Optional[str]
|
|
108
|
+
|
|
109
|
+
request_options : typing.Optional[RequestOptions]
|
|
110
|
+
Request-specific configuration.
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
Pause
|
|
115
|
+
Successfully created a pause
|
|
116
|
+
|
|
117
|
+
Examples
|
|
118
|
+
--------
|
|
119
|
+
from label_studio_sdk import LabelStudio
|
|
120
|
+
|
|
121
|
+
client = LabelStudio(
|
|
122
|
+
api_key="YOUR_API_KEY",
|
|
123
|
+
)
|
|
124
|
+
client.projects.pauses.create(
|
|
125
|
+
project_pk=1,
|
|
126
|
+
user_pk=1,
|
|
127
|
+
reason="reason",
|
|
128
|
+
)
|
|
129
|
+
"""
|
|
130
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
131
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses",
|
|
132
|
+
method="POST",
|
|
133
|
+
json={
|
|
134
|
+
"reason": reason,
|
|
135
|
+
"verbose_reason": verbose_reason,
|
|
136
|
+
},
|
|
137
|
+
headers={
|
|
138
|
+
"content-type": "application/json",
|
|
139
|
+
},
|
|
140
|
+
request_options=request_options,
|
|
141
|
+
omit=OMIT,
|
|
142
|
+
)
|
|
143
|
+
try:
|
|
144
|
+
if 200 <= _response.status_code < 300:
|
|
145
|
+
return typing.cast(
|
|
146
|
+
Pause,
|
|
147
|
+
parse_obj_as(
|
|
148
|
+
type_=Pause, # type: ignore
|
|
149
|
+
object_=_response.json(),
|
|
150
|
+
),
|
|
151
|
+
)
|
|
152
|
+
_response_json = _response.json()
|
|
153
|
+
except JSONDecodeError:
|
|
154
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
155
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
156
|
+
|
|
157
|
+
def get(
|
|
158
|
+
self, project_pk: int, user_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
159
|
+
) -> Pause:
|
|
160
|
+
"""
|
|
161
|
+
Return detailed information about a specific pause.
|
|
162
|
+
|
|
163
|
+
Parameters
|
|
164
|
+
----------
|
|
165
|
+
project_pk : int
|
|
166
|
+
Project ID
|
|
167
|
+
|
|
168
|
+
user_pk : int
|
|
169
|
+
User ID
|
|
170
|
+
|
|
171
|
+
id : int
|
|
172
|
+
Pause ID
|
|
173
|
+
|
|
174
|
+
request_options : typing.Optional[RequestOptions]
|
|
175
|
+
Request-specific configuration.
|
|
176
|
+
|
|
177
|
+
Returns
|
|
178
|
+
-------
|
|
179
|
+
Pause
|
|
180
|
+
Successfully retrieved the pause
|
|
181
|
+
|
|
182
|
+
Examples
|
|
183
|
+
--------
|
|
184
|
+
from label_studio_sdk import LabelStudio
|
|
185
|
+
|
|
186
|
+
client = LabelStudio(
|
|
187
|
+
api_key="YOUR_API_KEY",
|
|
188
|
+
)
|
|
189
|
+
client.projects.pauses.get(
|
|
190
|
+
project_pk=1,
|
|
191
|
+
user_pk=1,
|
|
192
|
+
id=1,
|
|
193
|
+
)
|
|
194
|
+
"""
|
|
195
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
196
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses/{jsonable_encoder(id)}",
|
|
197
|
+
method="GET",
|
|
198
|
+
request_options=request_options,
|
|
199
|
+
)
|
|
200
|
+
try:
|
|
201
|
+
if 200 <= _response.status_code < 300:
|
|
202
|
+
return typing.cast(
|
|
203
|
+
Pause,
|
|
204
|
+
parse_obj_as(
|
|
205
|
+
type_=Pause, # type: ignore
|
|
206
|
+
object_=_response.json(),
|
|
207
|
+
),
|
|
208
|
+
)
|
|
209
|
+
_response_json = _response.json()
|
|
210
|
+
except JSONDecodeError:
|
|
211
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
212
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
213
|
+
|
|
214
|
+
def delete(
|
|
215
|
+
self, project_pk: int, user_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
216
|
+
) -> None:
|
|
217
|
+
"""
|
|
218
|
+
Remove a pause from the database.
|
|
219
|
+
|
|
220
|
+
Parameters
|
|
221
|
+
----------
|
|
222
|
+
project_pk : int
|
|
223
|
+
Project ID
|
|
224
|
+
|
|
225
|
+
user_pk : int
|
|
226
|
+
User ID
|
|
227
|
+
|
|
228
|
+
id : int
|
|
229
|
+
Pause ID
|
|
230
|
+
|
|
231
|
+
request_options : typing.Optional[RequestOptions]
|
|
232
|
+
Request-specific configuration.
|
|
233
|
+
|
|
234
|
+
Returns
|
|
235
|
+
-------
|
|
236
|
+
None
|
|
237
|
+
|
|
238
|
+
Examples
|
|
239
|
+
--------
|
|
240
|
+
from label_studio_sdk import LabelStudio
|
|
241
|
+
|
|
242
|
+
client = LabelStudio(
|
|
243
|
+
api_key="YOUR_API_KEY",
|
|
244
|
+
)
|
|
245
|
+
client.projects.pauses.delete(
|
|
246
|
+
project_pk=1,
|
|
247
|
+
user_pk=1,
|
|
248
|
+
id=1,
|
|
249
|
+
)
|
|
250
|
+
"""
|
|
251
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
252
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses/{jsonable_encoder(id)}",
|
|
253
|
+
method="DELETE",
|
|
254
|
+
request_options=request_options,
|
|
255
|
+
)
|
|
256
|
+
try:
|
|
257
|
+
if 200 <= _response.status_code < 300:
|
|
258
|
+
return
|
|
259
|
+
_response_json = _response.json()
|
|
260
|
+
except JSONDecodeError:
|
|
261
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
262
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
263
|
+
|
|
264
|
+
def update(
|
|
265
|
+
self,
|
|
266
|
+
project_pk: int,
|
|
267
|
+
user_pk: int,
|
|
268
|
+
id: int,
|
|
269
|
+
*,
|
|
270
|
+
reason: str,
|
|
271
|
+
verbose_reason: typing.Optional[str] = OMIT,
|
|
272
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
273
|
+
) -> Pause:
|
|
274
|
+
"""
|
|
275
|
+
Partially update one or more fields of an existing pause.
|
|
276
|
+
|
|
277
|
+
Parameters
|
|
278
|
+
----------
|
|
279
|
+
project_pk : int
|
|
280
|
+
Project ID
|
|
281
|
+
|
|
282
|
+
user_pk : int
|
|
283
|
+
User ID
|
|
284
|
+
|
|
285
|
+
id : int
|
|
286
|
+
Pause ID
|
|
287
|
+
|
|
288
|
+
reason : str
|
|
289
|
+
|
|
290
|
+
verbose_reason : typing.Optional[str]
|
|
291
|
+
|
|
292
|
+
request_options : typing.Optional[RequestOptions]
|
|
293
|
+
Request-specific configuration.
|
|
294
|
+
|
|
295
|
+
Returns
|
|
296
|
+
-------
|
|
297
|
+
Pause
|
|
298
|
+
Successfully updated the pause (partial)
|
|
299
|
+
|
|
300
|
+
Examples
|
|
301
|
+
--------
|
|
302
|
+
from label_studio_sdk import LabelStudio
|
|
303
|
+
|
|
304
|
+
client = LabelStudio(
|
|
305
|
+
api_key="YOUR_API_KEY",
|
|
306
|
+
)
|
|
307
|
+
client.projects.pauses.update(
|
|
308
|
+
project_pk=1,
|
|
309
|
+
user_pk=1,
|
|
310
|
+
id=1,
|
|
311
|
+
reason="reason",
|
|
312
|
+
)
|
|
313
|
+
"""
|
|
314
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
315
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses/{jsonable_encoder(id)}",
|
|
316
|
+
method="PATCH",
|
|
317
|
+
json={
|
|
318
|
+
"reason": reason,
|
|
319
|
+
"verbose_reason": verbose_reason,
|
|
320
|
+
},
|
|
321
|
+
headers={
|
|
322
|
+
"content-type": "application/json",
|
|
323
|
+
},
|
|
324
|
+
request_options=request_options,
|
|
325
|
+
omit=OMIT,
|
|
326
|
+
)
|
|
327
|
+
try:
|
|
328
|
+
if 200 <= _response.status_code < 300:
|
|
329
|
+
return typing.cast(
|
|
330
|
+
Pause,
|
|
331
|
+
parse_obj_as(
|
|
332
|
+
type_=Pause, # type: ignore
|
|
333
|
+
object_=_response.json(),
|
|
334
|
+
),
|
|
335
|
+
)
|
|
336
|
+
_response_json = _response.json()
|
|
337
|
+
except JSONDecodeError:
|
|
338
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
339
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class AsyncPausesClient:
|
|
343
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
344
|
+
self._client_wrapper = client_wrapper
|
|
345
|
+
|
|
346
|
+
async def list(
|
|
347
|
+
self,
|
|
348
|
+
project_pk: int,
|
|
349
|
+
user_pk: int,
|
|
350
|
+
*,
|
|
351
|
+
include_deleted: typing.Optional[bool] = None,
|
|
352
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
353
|
+
) -> typing.List[Pause]:
|
|
354
|
+
"""
|
|
355
|
+
Return a list of pause objects for the specified project and user.
|
|
356
|
+
|
|
357
|
+
Parameters
|
|
358
|
+
----------
|
|
359
|
+
project_pk : int
|
|
360
|
+
Project ID
|
|
361
|
+
|
|
362
|
+
user_pk : int
|
|
363
|
+
User ID
|
|
364
|
+
|
|
365
|
+
include_deleted : typing.Optional[bool]
|
|
366
|
+
Include deleted pauses
|
|
367
|
+
|
|
368
|
+
request_options : typing.Optional[RequestOptions]
|
|
369
|
+
Request-specific configuration.
|
|
370
|
+
|
|
371
|
+
Returns
|
|
372
|
+
-------
|
|
373
|
+
typing.List[Pause]
|
|
374
|
+
Successfully retrieved a list of pauses
|
|
375
|
+
|
|
376
|
+
Examples
|
|
377
|
+
--------
|
|
378
|
+
import asyncio
|
|
379
|
+
|
|
380
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
381
|
+
|
|
382
|
+
client = AsyncLabelStudio(
|
|
383
|
+
api_key="YOUR_API_KEY",
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
async def main() -> None:
|
|
388
|
+
await client.projects.pauses.list(
|
|
389
|
+
project_pk=1,
|
|
390
|
+
user_pk=1,
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
asyncio.run(main())
|
|
395
|
+
"""
|
|
396
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
397
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses",
|
|
398
|
+
method="GET",
|
|
399
|
+
params={
|
|
400
|
+
"include_deleted": include_deleted,
|
|
401
|
+
},
|
|
402
|
+
request_options=request_options,
|
|
403
|
+
)
|
|
404
|
+
try:
|
|
405
|
+
if 200 <= _response.status_code < 300:
|
|
406
|
+
return typing.cast(
|
|
407
|
+
typing.List[Pause],
|
|
408
|
+
parse_obj_as(
|
|
409
|
+
type_=typing.List[Pause], # type: ignore
|
|
410
|
+
object_=_response.json(),
|
|
411
|
+
),
|
|
412
|
+
)
|
|
413
|
+
_response_json = _response.json()
|
|
414
|
+
except JSONDecodeError:
|
|
415
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
416
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
417
|
+
|
|
418
|
+
async def create(
|
|
419
|
+
self,
|
|
420
|
+
project_pk: int,
|
|
421
|
+
user_pk: int,
|
|
422
|
+
*,
|
|
423
|
+
reason: str,
|
|
424
|
+
verbose_reason: typing.Optional[str] = OMIT,
|
|
425
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
426
|
+
) -> Pause:
|
|
427
|
+
"""
|
|
428
|
+
Create a new pause object for the specified project and user.
|
|
429
|
+
|
|
430
|
+
Parameters
|
|
431
|
+
----------
|
|
432
|
+
project_pk : int
|
|
433
|
+
Project ID
|
|
434
|
+
|
|
435
|
+
user_pk : int
|
|
436
|
+
User ID
|
|
437
|
+
|
|
438
|
+
reason : str
|
|
439
|
+
|
|
440
|
+
verbose_reason : typing.Optional[str]
|
|
441
|
+
|
|
442
|
+
request_options : typing.Optional[RequestOptions]
|
|
443
|
+
Request-specific configuration.
|
|
444
|
+
|
|
445
|
+
Returns
|
|
446
|
+
-------
|
|
447
|
+
Pause
|
|
448
|
+
Successfully created a pause
|
|
449
|
+
|
|
450
|
+
Examples
|
|
451
|
+
--------
|
|
452
|
+
import asyncio
|
|
453
|
+
|
|
454
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
455
|
+
|
|
456
|
+
client = AsyncLabelStudio(
|
|
457
|
+
api_key="YOUR_API_KEY",
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
async def main() -> None:
|
|
462
|
+
await client.projects.pauses.create(
|
|
463
|
+
project_pk=1,
|
|
464
|
+
user_pk=1,
|
|
465
|
+
reason="reason",
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
asyncio.run(main())
|
|
470
|
+
"""
|
|
471
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
472
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses",
|
|
473
|
+
method="POST",
|
|
474
|
+
json={
|
|
475
|
+
"reason": reason,
|
|
476
|
+
"verbose_reason": verbose_reason,
|
|
477
|
+
},
|
|
478
|
+
headers={
|
|
479
|
+
"content-type": "application/json",
|
|
480
|
+
},
|
|
481
|
+
request_options=request_options,
|
|
482
|
+
omit=OMIT,
|
|
483
|
+
)
|
|
484
|
+
try:
|
|
485
|
+
if 200 <= _response.status_code < 300:
|
|
486
|
+
return typing.cast(
|
|
487
|
+
Pause,
|
|
488
|
+
parse_obj_as(
|
|
489
|
+
type_=Pause, # type: ignore
|
|
490
|
+
object_=_response.json(),
|
|
491
|
+
),
|
|
492
|
+
)
|
|
493
|
+
_response_json = _response.json()
|
|
494
|
+
except JSONDecodeError:
|
|
495
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
496
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
497
|
+
|
|
498
|
+
async def get(
|
|
499
|
+
self, project_pk: int, user_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
500
|
+
) -> Pause:
|
|
501
|
+
"""
|
|
502
|
+
Return detailed information about a specific pause.
|
|
503
|
+
|
|
504
|
+
Parameters
|
|
505
|
+
----------
|
|
506
|
+
project_pk : int
|
|
507
|
+
Project ID
|
|
508
|
+
|
|
509
|
+
user_pk : int
|
|
510
|
+
User ID
|
|
511
|
+
|
|
512
|
+
id : int
|
|
513
|
+
Pause ID
|
|
514
|
+
|
|
515
|
+
request_options : typing.Optional[RequestOptions]
|
|
516
|
+
Request-specific configuration.
|
|
517
|
+
|
|
518
|
+
Returns
|
|
519
|
+
-------
|
|
520
|
+
Pause
|
|
521
|
+
Successfully retrieved the pause
|
|
522
|
+
|
|
523
|
+
Examples
|
|
524
|
+
--------
|
|
525
|
+
import asyncio
|
|
526
|
+
|
|
527
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
528
|
+
|
|
529
|
+
client = AsyncLabelStudio(
|
|
530
|
+
api_key="YOUR_API_KEY",
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
async def main() -> None:
|
|
535
|
+
await client.projects.pauses.get(
|
|
536
|
+
project_pk=1,
|
|
537
|
+
user_pk=1,
|
|
538
|
+
id=1,
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
asyncio.run(main())
|
|
543
|
+
"""
|
|
544
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
545
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses/{jsonable_encoder(id)}",
|
|
546
|
+
method="GET",
|
|
547
|
+
request_options=request_options,
|
|
548
|
+
)
|
|
549
|
+
try:
|
|
550
|
+
if 200 <= _response.status_code < 300:
|
|
551
|
+
return typing.cast(
|
|
552
|
+
Pause,
|
|
553
|
+
parse_obj_as(
|
|
554
|
+
type_=Pause, # type: ignore
|
|
555
|
+
object_=_response.json(),
|
|
556
|
+
),
|
|
557
|
+
)
|
|
558
|
+
_response_json = _response.json()
|
|
559
|
+
except JSONDecodeError:
|
|
560
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
561
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
562
|
+
|
|
563
|
+
async def delete(
|
|
564
|
+
self, project_pk: int, user_pk: int, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
565
|
+
) -> None:
|
|
566
|
+
"""
|
|
567
|
+
Remove a pause from the database.
|
|
568
|
+
|
|
569
|
+
Parameters
|
|
570
|
+
----------
|
|
571
|
+
project_pk : int
|
|
572
|
+
Project ID
|
|
573
|
+
|
|
574
|
+
user_pk : int
|
|
575
|
+
User ID
|
|
576
|
+
|
|
577
|
+
id : int
|
|
578
|
+
Pause ID
|
|
579
|
+
|
|
580
|
+
request_options : typing.Optional[RequestOptions]
|
|
581
|
+
Request-specific configuration.
|
|
582
|
+
|
|
583
|
+
Returns
|
|
584
|
+
-------
|
|
585
|
+
None
|
|
586
|
+
|
|
587
|
+
Examples
|
|
588
|
+
--------
|
|
589
|
+
import asyncio
|
|
590
|
+
|
|
591
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
592
|
+
|
|
593
|
+
client = AsyncLabelStudio(
|
|
594
|
+
api_key="YOUR_API_KEY",
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
async def main() -> None:
|
|
599
|
+
await client.projects.pauses.delete(
|
|
600
|
+
project_pk=1,
|
|
601
|
+
user_pk=1,
|
|
602
|
+
id=1,
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
asyncio.run(main())
|
|
607
|
+
"""
|
|
608
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
609
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses/{jsonable_encoder(id)}",
|
|
610
|
+
method="DELETE",
|
|
611
|
+
request_options=request_options,
|
|
612
|
+
)
|
|
613
|
+
try:
|
|
614
|
+
if 200 <= _response.status_code < 300:
|
|
615
|
+
return
|
|
616
|
+
_response_json = _response.json()
|
|
617
|
+
except JSONDecodeError:
|
|
618
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
619
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
620
|
+
|
|
621
|
+
async def update(
|
|
622
|
+
self,
|
|
623
|
+
project_pk: int,
|
|
624
|
+
user_pk: int,
|
|
625
|
+
id: int,
|
|
626
|
+
*,
|
|
627
|
+
reason: str,
|
|
628
|
+
verbose_reason: typing.Optional[str] = OMIT,
|
|
629
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
630
|
+
) -> Pause:
|
|
631
|
+
"""
|
|
632
|
+
Partially update one or more fields of an existing pause.
|
|
633
|
+
|
|
634
|
+
Parameters
|
|
635
|
+
----------
|
|
636
|
+
project_pk : int
|
|
637
|
+
Project ID
|
|
638
|
+
|
|
639
|
+
user_pk : int
|
|
640
|
+
User ID
|
|
641
|
+
|
|
642
|
+
id : int
|
|
643
|
+
Pause ID
|
|
644
|
+
|
|
645
|
+
reason : str
|
|
646
|
+
|
|
647
|
+
verbose_reason : typing.Optional[str]
|
|
648
|
+
|
|
649
|
+
request_options : typing.Optional[RequestOptions]
|
|
650
|
+
Request-specific configuration.
|
|
651
|
+
|
|
652
|
+
Returns
|
|
653
|
+
-------
|
|
654
|
+
Pause
|
|
655
|
+
Successfully updated the pause (partial)
|
|
656
|
+
|
|
657
|
+
Examples
|
|
658
|
+
--------
|
|
659
|
+
import asyncio
|
|
660
|
+
|
|
661
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
662
|
+
|
|
663
|
+
client = AsyncLabelStudio(
|
|
664
|
+
api_key="YOUR_API_KEY",
|
|
665
|
+
)
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
async def main() -> None:
|
|
669
|
+
await client.projects.pauses.update(
|
|
670
|
+
project_pk=1,
|
|
671
|
+
user_pk=1,
|
|
672
|
+
id=1,
|
|
673
|
+
reason="reason",
|
|
674
|
+
)
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
asyncio.run(main())
|
|
678
|
+
"""
|
|
679
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
680
|
+
f"api/projects/{jsonable_encoder(project_pk)}/members/{jsonable_encoder(user_pk)}/pauses/{jsonable_encoder(id)}",
|
|
681
|
+
method="PATCH",
|
|
682
|
+
json={
|
|
683
|
+
"reason": reason,
|
|
684
|
+
"verbose_reason": verbose_reason,
|
|
685
|
+
},
|
|
686
|
+
headers={
|
|
687
|
+
"content-type": "application/json",
|
|
688
|
+
},
|
|
689
|
+
request_options=request_options,
|
|
690
|
+
omit=OMIT,
|
|
691
|
+
)
|
|
692
|
+
try:
|
|
693
|
+
if 200 <= _response.status_code < 300:
|
|
694
|
+
return typing.cast(
|
|
695
|
+
Pause,
|
|
696
|
+
parse_obj_as(
|
|
697
|
+
type_=Pause, # type: ignore
|
|
698
|
+
object_=_response.json(),
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
_response_json = _response.json()
|
|
702
|
+
except JSONDecodeError:
|
|
703
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
704
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -66,6 +66,16 @@ class ProjectsUpdateResponse(UniversalBaseModel):
|
|
|
66
66
|
Maximum annotations per task
|
|
67
67
|
"""
|
|
68
68
|
|
|
69
|
+
annotation_limit_count: typing.Optional[int] = pydantic.Field(default=None)
|
|
70
|
+
"""
|
|
71
|
+
Maximum number of annotations per annotator
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
annotation_limit_percent: typing.Optional[float] = pydantic.Field(default=None)
|
|
75
|
+
"""
|
|
76
|
+
Maximum percentage of annotations per annotator
|
|
77
|
+
"""
|
|
78
|
+
|
|
69
79
|
color: typing.Optional[str] = pydantic.Field(default=None)
|
|
70
80
|
"""
|
|
71
81
|
Project color in HEX format
|