label-studio-sdk 2.0.5__py3-none-any.whl → 2.0.6__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 +52 -0
- label_studio_sdk/annotation_history/__init__.py +5 -0
- label_studio_sdk/annotation_history/client.py +415 -0
- label_studio_sdk/annotation_history/types/__init__.py +5 -0
- label_studio_sdk/annotation_history/types/annotation_history_delete_response.py +22 -0
- label_studio_sdk/annotation_reviews/__init__.py +2 -0
- label_studio_sdk/annotation_reviews/client.py +713 -0
- label_studio_sdk/base_client.py +16 -0
- label_studio_sdk/blueprints/__init__.py +2 -0
- label_studio_sdk/blueprints/client.py +272 -0
- label_studio_sdk/core/client_wrapper.py +2 -1
- label_studio_sdk/export_storage/__init__.py +2 -2
- label_studio_sdk/export_storage/azure_spi/__init__.py +2 -0
- label_studio_sdk/export_storage/azure_spi/client.py +1354 -0
- label_studio_sdk/export_storage/client.py +8 -0
- label_studio_sdk/export_storage/gcswif/__init__.py +2 -0
- label_studio_sdk/export_storage/gcswif/client.py +1376 -0
- label_studio_sdk/import_storage/__init__.py +2 -2
- label_studio_sdk/import_storage/azure_spi/__init__.py +2 -0
- label_studio_sdk/import_storage/azure_spi/client.py +1378 -0
- label_studio_sdk/import_storage/client.py +8 -0
- label_studio_sdk/import_storage/gcswif/__init__.py +2 -0
- label_studio_sdk/import_storage/gcswif/client.py +1400 -0
- label_studio_sdk/jwt_settings/client.py +10 -8
- label_studio_sdk/projects/client.py +8 -0
- label_studio_sdk/projects/members/__init__.py +2 -2
- label_studio_sdk/projects/members/bulk/client.py +46 -2
- label_studio_sdk/projects/members/client.py +4 -0
- label_studio_sdk/projects/members/paginated/__init__.py +2 -0
- label_studio_sdk/projects/members/paginated/client.py +248 -0
- label_studio_sdk/session_policy/__init__.py +2 -0
- label_studio_sdk/session_policy/client.py +247 -0
- label_studio_sdk/tasks/client.py +371 -0
- label_studio_sdk/types/__init__.py +42 -0
- label_studio_sdk/types/action_enum.py +19 -0
- label_studio_sdk/types/all_roles_project_list.py +1 -1
- label_studio_sdk/types/annotation.py +7 -0
- label_studio_sdk/types/annotation_history.py +81 -0
- label_studio_sdk/types/annotation_history_action.py +7 -0
- label_studio_sdk/types/annotation_request.py +7 -0
- label_studio_sdk/types/annotation_review.py +61 -0
- label_studio_sdk/types/annotation_review_request.py +41 -0
- label_studio_sdk/types/azure_service_principal_export_storage.py +114 -0
- label_studio_sdk/types/azure_service_principal_export_storage_request.py +107 -0
- label_studio_sdk/types/azure_service_principal_import_storage.py +115 -0
- label_studio_sdk/types/azure_service_principal_import_storage_request.py +108 -0
- label_studio_sdk/types/blueprint.py +41 -0
- label_studio_sdk/types/gcswif_export_storage.py +119 -0
- label_studio_sdk/types/gcswif_export_storage_request.py +112 -0
- label_studio_sdk/types/gcswif_import_storage.py +120 -0
- label_studio_sdk/types/gcswif_import_storage_request.py +113 -0
- label_studio_sdk/types/lse_project_update.py +1 -0
- label_studio_sdk/types/lse_task.py +1 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -0
- label_studio_sdk/types/lsejwt_settings.py +1 -5
- label_studio_sdk/types/paginated_annotation_history_list.py +23 -0
- label_studio_sdk/types/paginated_lse_user_list.py +23 -0
- label_studio_sdk/types/paginated_paginated_project_member_list.py +23 -0
- label_studio_sdk/types/paginated_project_member.py +50 -0
- label_studio_sdk/types/project_member_bulk_assign_roles_request.py +21 -0
- label_studio_sdk/types/review_settings.py +5 -0
- label_studio_sdk/types/review_settings_request.py +5 -0
- label_studio_sdk/types/session_timeout_policy.py +31 -0
- label_studio_sdk/types/task_event.py +61 -0
- label_studio_sdk/workspaces/members/__init__.py +2 -2
- label_studio_sdk/workspaces/members/client.py +4 -0
- label_studio_sdk/workspaces/members/paginated/__init__.py +2 -0
- label_studio_sdk/workspaces/members/paginated/client.py +212 -0
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/METADATA +2 -2
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/RECORD +72 -29
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/WHEEL +0 -0
label_studio_sdk/__init__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from .types import (
|
|
4
|
+
ActionEnum,
|
|
4
5
|
ActionsEnum,
|
|
5
6
|
ActivityLog,
|
|
6
7
|
ActivityLogResponse,
|
|
@@ -9,9 +10,13 @@ from .types import (
|
|
|
9
10
|
AllRolesProjectListSkipQueue,
|
|
10
11
|
AnnotatedEnum,
|
|
11
12
|
Annotation,
|
|
13
|
+
AnnotationHistory,
|
|
14
|
+
AnnotationHistoryAction,
|
|
12
15
|
AnnotationLastAction,
|
|
13
16
|
AnnotationRequest,
|
|
14
17
|
AnnotationRequestLastAction,
|
|
18
|
+
AnnotationReview,
|
|
19
|
+
AnnotationReviewRequest,
|
|
15
20
|
AssignmentSettings,
|
|
16
21
|
AssignmentSettingsLabelStreamTaskDistribution,
|
|
17
22
|
AssignmentSettingsRequest,
|
|
@@ -20,12 +25,17 @@ from .types import (
|
|
|
20
25
|
AuthMethodEnum,
|
|
21
26
|
AzureBlobExportStorage,
|
|
22
27
|
AzureBlobImportStorage,
|
|
28
|
+
AzureServicePrincipalExportStorage,
|
|
29
|
+
AzureServicePrincipalExportStorageRequest,
|
|
30
|
+
AzureServicePrincipalImportStorage,
|
|
31
|
+
AzureServicePrincipalImportStorageRequest,
|
|
23
32
|
BatchFailedPredictions,
|
|
24
33
|
BatchPredictions,
|
|
25
34
|
BillingChecks,
|
|
26
35
|
BillingFlags,
|
|
27
36
|
BillingInfoResponse,
|
|
28
37
|
BlankEnum,
|
|
38
|
+
Blueprint,
|
|
29
39
|
BlueprintList,
|
|
30
40
|
BudgetResetPeriodEnum,
|
|
31
41
|
ChildFilter,
|
|
@@ -45,6 +55,10 @@ from .types import (
|
|
|
45
55
|
FinishedEnum,
|
|
46
56
|
GcsExportStorage,
|
|
47
57
|
GcsImportStorage,
|
|
58
|
+
GcswifExportStorage,
|
|
59
|
+
GcswifExportStorageRequest,
|
|
60
|
+
GcswifImportStorage,
|
|
61
|
+
GcswifImportStorageRequest,
|
|
48
62
|
Hotkeys,
|
|
49
63
|
ImportApiRequest,
|
|
50
64
|
InferenceRunCostEstimate,
|
|
@@ -119,7 +133,11 @@ from .types import (
|
|
|
119
133
|
OrganizationMember,
|
|
120
134
|
OrganizationMembership,
|
|
121
135
|
PaginatedAllRolesProjectListList,
|
|
136
|
+
PaginatedAnnotationHistoryList,
|
|
122
137
|
PaginatedLseOrganizationMemberListList,
|
|
138
|
+
PaginatedLseUserList,
|
|
139
|
+
PaginatedPaginatedProjectMemberList,
|
|
140
|
+
PaginatedProjectMember,
|
|
123
141
|
PaginatedRoleBasedTaskList,
|
|
124
142
|
Pause,
|
|
125
143
|
PauseRequest,
|
|
@@ -132,6 +150,7 @@ from .types import (
|
|
|
132
150
|
ProjectImport,
|
|
133
151
|
ProjectLabelConfig,
|
|
134
152
|
ProjectLabelConfigRequest,
|
|
153
|
+
ProjectMemberBulkAssignRolesRequest,
|
|
135
154
|
ProjectSampling,
|
|
136
155
|
ProjectSkipQueue,
|
|
137
156
|
ProjectSubsetEnum,
|
|
@@ -165,6 +184,7 @@ from .types import (
|
|
|
165
184
|
SerializationOptionRequest,
|
|
166
185
|
SerializationOptions,
|
|
167
186
|
SerializationOptionsRequest,
|
|
187
|
+
SessionTimeoutPolicy,
|
|
168
188
|
SkillNameEnum,
|
|
169
189
|
SkipQueueEnum,
|
|
170
190
|
SkippedEnum,
|
|
@@ -172,6 +192,7 @@ from .types import (
|
|
|
172
192
|
Status7BfEnum,
|
|
173
193
|
StatusC5AEnum,
|
|
174
194
|
TaskAssignment,
|
|
195
|
+
TaskEvent,
|
|
175
196
|
ThirdPartyModelVersion,
|
|
176
197
|
ThirdPartyModelVersionRequest,
|
|
177
198
|
TokenRefreshResponse,
|
|
@@ -203,8 +224,11 @@ from .errors import (
|
|
|
203
224
|
from . import (
|
|
204
225
|
actions,
|
|
205
226
|
activity_logs,
|
|
227
|
+
annotation_history,
|
|
228
|
+
annotation_reviews,
|
|
206
229
|
annotations,
|
|
207
230
|
billing,
|
|
231
|
+
blueprints,
|
|
208
232
|
comments,
|
|
209
233
|
export_storage,
|
|
210
234
|
files,
|
|
@@ -216,6 +240,7 @@ from . import (
|
|
|
216
240
|
predictions,
|
|
217
241
|
projects,
|
|
218
242
|
prompts,
|
|
243
|
+
session_policy,
|
|
219
244
|
sso,
|
|
220
245
|
tasks,
|
|
221
246
|
tokens,
|
|
@@ -242,6 +267,7 @@ from .actions import (
|
|
|
242
267
|
ActionsListResponseItemDialog,
|
|
243
268
|
)
|
|
244
269
|
from .activity_logs import ActivityLogsListRequestMethod
|
|
270
|
+
from .annotation_history import AnnotationHistoryDeleteResponse
|
|
245
271
|
from .annotations import AnnotationBulkSerializerWithSelectedItemsRequestLastAction, AnnotationsCreateBulkResponseItem
|
|
246
272
|
from .client import AsyncLabelStudio, LabelStudio
|
|
247
273
|
from .environment import LabelStudioEnvironment
|
|
@@ -300,6 +326,7 @@ from .webhooks import (
|
|
|
300
326
|
)
|
|
301
327
|
|
|
302
328
|
__all__ = [
|
|
329
|
+
"ActionEnum",
|
|
303
330
|
"ActionsCreateRequestFilters",
|
|
304
331
|
"ActionsCreateRequestFiltersConjunction",
|
|
305
332
|
"ActionsCreateRequestFiltersItemsItem",
|
|
@@ -323,9 +350,14 @@ __all__ = [
|
|
|
323
350
|
"AnnotatedEnum",
|
|
324
351
|
"Annotation",
|
|
325
352
|
"AnnotationBulkSerializerWithSelectedItemsRequestLastAction",
|
|
353
|
+
"AnnotationHistory",
|
|
354
|
+
"AnnotationHistoryAction",
|
|
355
|
+
"AnnotationHistoryDeleteResponse",
|
|
326
356
|
"AnnotationLastAction",
|
|
327
357
|
"AnnotationRequest",
|
|
328
358
|
"AnnotationRequestLastAction",
|
|
359
|
+
"AnnotationReview",
|
|
360
|
+
"AnnotationReviewRequest",
|
|
329
361
|
"AnnotationsCreateBulkResponseItem",
|
|
330
362
|
"AssignmentSettings",
|
|
331
363
|
"AssignmentSettingsLabelStreamTaskDistribution",
|
|
@@ -336,6 +368,10 @@ __all__ = [
|
|
|
336
368
|
"AuthMethodEnum",
|
|
337
369
|
"AzureBlobExportStorage",
|
|
338
370
|
"AzureBlobImportStorage",
|
|
371
|
+
"AzureServicePrincipalExportStorage",
|
|
372
|
+
"AzureServicePrincipalExportStorageRequest",
|
|
373
|
+
"AzureServicePrincipalImportStorage",
|
|
374
|
+
"AzureServicePrincipalImportStorageRequest",
|
|
339
375
|
"BadRequestError",
|
|
340
376
|
"BatchFailedPredictions",
|
|
341
377
|
"BatchPredictions",
|
|
@@ -343,6 +379,7 @@ __all__ = [
|
|
|
343
379
|
"BillingFlags",
|
|
344
380
|
"BillingInfoResponse",
|
|
345
381
|
"BlankEnum",
|
|
382
|
+
"Blueprint",
|
|
346
383
|
"BlueprintList",
|
|
347
384
|
"BudgetResetPeriodEnum",
|
|
348
385
|
"ChildFilter",
|
|
@@ -365,6 +402,10 @@ __all__ = [
|
|
|
365
402
|
"ForbiddenError",
|
|
366
403
|
"GcsExportStorage",
|
|
367
404
|
"GcsImportStorage",
|
|
405
|
+
"GcswifExportStorage",
|
|
406
|
+
"GcswifExportStorageRequest",
|
|
407
|
+
"GcswifImportStorage",
|
|
408
|
+
"GcswifImportStorageRequest",
|
|
368
409
|
"Hotkeys",
|
|
369
410
|
"ImportApiRequest",
|
|
370
411
|
"ImportStorageListTypesResponseItem",
|
|
@@ -451,7 +492,11 @@ __all__ = [
|
|
|
451
492
|
"OrganizationMember",
|
|
452
493
|
"OrganizationMembership",
|
|
453
494
|
"PaginatedAllRolesProjectListList",
|
|
495
|
+
"PaginatedAnnotationHistoryList",
|
|
454
496
|
"PaginatedLseOrganizationMemberListList",
|
|
497
|
+
"PaginatedLseUserList",
|
|
498
|
+
"PaginatedPaginatedProjectMemberList",
|
|
499
|
+
"PaginatedProjectMember",
|
|
455
500
|
"PaginatedRoleBasedTaskList",
|
|
456
501
|
"PatchedLseProjectUpdateRequestSampling",
|
|
457
502
|
"PatchedLseProjectUpdateRequestSkipQueue",
|
|
@@ -466,6 +511,7 @@ __all__ = [
|
|
|
466
511
|
"ProjectImport",
|
|
467
512
|
"ProjectLabelConfig",
|
|
468
513
|
"ProjectLabelConfigRequest",
|
|
514
|
+
"ProjectMemberBulkAssignRolesRequest",
|
|
469
515
|
"ProjectSampling",
|
|
470
516
|
"ProjectSkipQueue",
|
|
471
517
|
"ProjectSubsetEnum",
|
|
@@ -503,6 +549,7 @@ __all__ = [
|
|
|
503
549
|
"SerializationOptionRequest",
|
|
504
550
|
"SerializationOptions",
|
|
505
551
|
"SerializationOptionsRequest",
|
|
552
|
+
"SessionTimeoutPolicy",
|
|
506
553
|
"SkillNameEnum",
|
|
507
554
|
"SkipQueueEnum",
|
|
508
555
|
"SkippedEnum",
|
|
@@ -510,6 +557,7 @@ __all__ = [
|
|
|
510
557
|
"Status7BfEnum",
|
|
511
558
|
"StatusC5AEnum",
|
|
512
559
|
"TaskAssignment",
|
|
560
|
+
"TaskEvent",
|
|
513
561
|
"TasksListRequestFields",
|
|
514
562
|
"ThirdPartyModelVersion",
|
|
515
563
|
"ThirdPartyModelVersionRequest",
|
|
@@ -568,8 +616,11 @@ __all__ = [
|
|
|
568
616
|
"__version__",
|
|
569
617
|
"actions",
|
|
570
618
|
"activity_logs",
|
|
619
|
+
"annotation_history",
|
|
620
|
+
"annotation_reviews",
|
|
571
621
|
"annotations",
|
|
572
622
|
"billing",
|
|
623
|
+
"blueprints",
|
|
573
624
|
"comments",
|
|
574
625
|
"export_storage",
|
|
575
626
|
"files",
|
|
@@ -581,6 +632,7 @@ __all__ = [
|
|
|
581
632
|
"predictions",
|
|
582
633
|
"projects",
|
|
583
634
|
"prompts",
|
|
635
|
+
"session_policy",
|
|
584
636
|
"sso",
|
|
585
637
|
"tasks",
|
|
586
638
|
"tokens",
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
4
|
+
import typing
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.annotation_history import AnnotationHistory
|
|
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.annotation_history_delete_response import AnnotationHistoryDeleteResponse
|
|
11
|
+
from ..types.paginated_annotation_history_list import PaginatedAnnotationHistoryList
|
|
12
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
13
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AnnotationHistoryClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._client_wrapper = client_wrapper
|
|
19
|
+
|
|
20
|
+
def list(
|
|
21
|
+
self,
|
|
22
|
+
*,
|
|
23
|
+
annotation: typing.Optional[int] = None,
|
|
24
|
+
ordering: typing.Optional[str] = None,
|
|
25
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
26
|
+
) -> typing.List[AnnotationHistory]:
|
|
27
|
+
"""
|
|
28
|
+
List annotation history items for an annotation. Annotation history logs all actions performed with annotations, such as: imports, submits, updates, reviews, and more. Users can view annotation history items in the Annotation History panel during labeling.
|
|
29
|
+
|
|
30
|
+
Parameters
|
|
31
|
+
----------
|
|
32
|
+
annotation : typing.Optional[int]
|
|
33
|
+
Annotation ID to get annotation history items for.
|
|
34
|
+
|
|
35
|
+
ordering : typing.Optional[str]
|
|
36
|
+
Which field to use when ordering the results.
|
|
37
|
+
|
|
38
|
+
request_options : typing.Optional[RequestOptions]
|
|
39
|
+
Request-specific configuration.
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
typing.List[AnnotationHistory]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
--------
|
|
48
|
+
from label_studio_sdk import LabelStudio
|
|
49
|
+
|
|
50
|
+
client = LabelStudio(
|
|
51
|
+
api_key="YOUR_API_KEY",
|
|
52
|
+
)
|
|
53
|
+
client.annotation_history.list()
|
|
54
|
+
"""
|
|
55
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
56
|
+
"api/annotation-history/",
|
|
57
|
+
method="GET",
|
|
58
|
+
params={
|
|
59
|
+
"annotation": annotation,
|
|
60
|
+
"ordering": ordering,
|
|
61
|
+
},
|
|
62
|
+
request_options=request_options,
|
|
63
|
+
)
|
|
64
|
+
try:
|
|
65
|
+
if 200 <= _response.status_code < 300:
|
|
66
|
+
return typing.cast(
|
|
67
|
+
typing.List[AnnotationHistory],
|
|
68
|
+
construct_type(
|
|
69
|
+
type_=typing.List[AnnotationHistory], # type: ignore
|
|
70
|
+
object_=_response.json(),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
_response_json = _response.json()
|
|
74
|
+
except JSONDecodeError:
|
|
75
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
76
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
77
|
+
|
|
78
|
+
def delete(
|
|
79
|
+
self,
|
|
80
|
+
*,
|
|
81
|
+
annotation: typing.Optional[int] = None,
|
|
82
|
+
project: typing.Optional[int] = None,
|
|
83
|
+
task: typing.Optional[int] = None,
|
|
84
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
85
|
+
) -> AnnotationHistoryDeleteResponse:
|
|
86
|
+
"""
|
|
87
|
+
Delete all annotation history items for a specific annotation, task or project. This method is available only for users with administrator roles.
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
annotation : typing.Optional[int]
|
|
92
|
+
Annotation ID to delete annotation history items for.
|
|
93
|
+
|
|
94
|
+
project : typing.Optional[int]
|
|
95
|
+
Project ID to delete annotation history items for.
|
|
96
|
+
|
|
97
|
+
task : typing.Optional[int]
|
|
98
|
+
Task ID to delete annotation history items for.
|
|
99
|
+
|
|
100
|
+
request_options : typing.Optional[RequestOptions]
|
|
101
|
+
Request-specific configuration.
|
|
102
|
+
|
|
103
|
+
Returns
|
|
104
|
+
-------
|
|
105
|
+
AnnotationHistoryDeleteResponse
|
|
106
|
+
Returns a dict containing the count of removed items.
|
|
107
|
+
|
|
108
|
+
Examples
|
|
109
|
+
--------
|
|
110
|
+
from label_studio_sdk import LabelStudio
|
|
111
|
+
|
|
112
|
+
client = LabelStudio(
|
|
113
|
+
api_key="YOUR_API_KEY",
|
|
114
|
+
)
|
|
115
|
+
client.annotation_history.delete()
|
|
116
|
+
"""
|
|
117
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
118
|
+
"api/annotation-history/",
|
|
119
|
+
method="DELETE",
|
|
120
|
+
params={
|
|
121
|
+
"annotation": annotation,
|
|
122
|
+
"project": project,
|
|
123
|
+
"task": task,
|
|
124
|
+
},
|
|
125
|
+
request_options=request_options,
|
|
126
|
+
)
|
|
127
|
+
try:
|
|
128
|
+
if 200 <= _response.status_code < 300:
|
|
129
|
+
return typing.cast(
|
|
130
|
+
AnnotationHistoryDeleteResponse,
|
|
131
|
+
construct_type(
|
|
132
|
+
type_=AnnotationHistoryDeleteResponse, # 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
|
+
def list_for_project(
|
|
142
|
+
self,
|
|
143
|
+
id: int,
|
|
144
|
+
*,
|
|
145
|
+
page: typing.Optional[int] = None,
|
|
146
|
+
page_size: typing.Optional[int] = None,
|
|
147
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
148
|
+
) -> PaginatedAnnotationHistoryList:
|
|
149
|
+
"""
|
|
150
|
+
List all annotation history items for the project with pagination.
|
|
151
|
+
|
|
152
|
+
Parameters
|
|
153
|
+
----------
|
|
154
|
+
id : int
|
|
155
|
+
|
|
156
|
+
page : typing.Optional[int]
|
|
157
|
+
A page number within the paginated result set.
|
|
158
|
+
|
|
159
|
+
page_size : typing.Optional[int]
|
|
160
|
+
Number of results to return per page.
|
|
161
|
+
|
|
162
|
+
request_options : typing.Optional[RequestOptions]
|
|
163
|
+
Request-specific configuration.
|
|
164
|
+
|
|
165
|
+
Returns
|
|
166
|
+
-------
|
|
167
|
+
PaginatedAnnotationHistoryList
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
Examples
|
|
171
|
+
--------
|
|
172
|
+
from label_studio_sdk import LabelStudio
|
|
173
|
+
|
|
174
|
+
client = LabelStudio(
|
|
175
|
+
api_key="YOUR_API_KEY",
|
|
176
|
+
)
|
|
177
|
+
client.annotation_history.list_for_project(
|
|
178
|
+
id=1,
|
|
179
|
+
)
|
|
180
|
+
"""
|
|
181
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
182
|
+
f"api/projects/{jsonable_encoder(id)}/annotation-history/",
|
|
183
|
+
method="GET",
|
|
184
|
+
params={
|
|
185
|
+
"page": page,
|
|
186
|
+
"page_size": page_size,
|
|
187
|
+
},
|
|
188
|
+
request_options=request_options,
|
|
189
|
+
)
|
|
190
|
+
try:
|
|
191
|
+
if 200 <= _response.status_code < 300:
|
|
192
|
+
return typing.cast(
|
|
193
|
+
PaginatedAnnotationHistoryList,
|
|
194
|
+
construct_type(
|
|
195
|
+
type_=PaginatedAnnotationHistoryList, # type: ignore
|
|
196
|
+
object_=_response.json(),
|
|
197
|
+
),
|
|
198
|
+
)
|
|
199
|
+
_response_json = _response.json()
|
|
200
|
+
except JSONDecodeError:
|
|
201
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
202
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class AsyncAnnotationHistoryClient:
|
|
206
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
207
|
+
self._client_wrapper = client_wrapper
|
|
208
|
+
|
|
209
|
+
async def list(
|
|
210
|
+
self,
|
|
211
|
+
*,
|
|
212
|
+
annotation: typing.Optional[int] = None,
|
|
213
|
+
ordering: typing.Optional[str] = None,
|
|
214
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
215
|
+
) -> typing.List[AnnotationHistory]:
|
|
216
|
+
"""
|
|
217
|
+
List annotation history items for an annotation. Annotation history logs all actions performed with annotations, such as: imports, submits, updates, reviews, and more. Users can view annotation history items in the Annotation History panel during labeling.
|
|
218
|
+
|
|
219
|
+
Parameters
|
|
220
|
+
----------
|
|
221
|
+
annotation : typing.Optional[int]
|
|
222
|
+
Annotation ID to get annotation history items for.
|
|
223
|
+
|
|
224
|
+
ordering : typing.Optional[str]
|
|
225
|
+
Which field to use when ordering the results.
|
|
226
|
+
|
|
227
|
+
request_options : typing.Optional[RequestOptions]
|
|
228
|
+
Request-specific configuration.
|
|
229
|
+
|
|
230
|
+
Returns
|
|
231
|
+
-------
|
|
232
|
+
typing.List[AnnotationHistory]
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
Examples
|
|
236
|
+
--------
|
|
237
|
+
import asyncio
|
|
238
|
+
|
|
239
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
240
|
+
|
|
241
|
+
client = AsyncLabelStudio(
|
|
242
|
+
api_key="YOUR_API_KEY",
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
async def main() -> None:
|
|
247
|
+
await client.annotation_history.list()
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
asyncio.run(main())
|
|
251
|
+
"""
|
|
252
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
253
|
+
"api/annotation-history/",
|
|
254
|
+
method="GET",
|
|
255
|
+
params={
|
|
256
|
+
"annotation": annotation,
|
|
257
|
+
"ordering": ordering,
|
|
258
|
+
},
|
|
259
|
+
request_options=request_options,
|
|
260
|
+
)
|
|
261
|
+
try:
|
|
262
|
+
if 200 <= _response.status_code < 300:
|
|
263
|
+
return typing.cast(
|
|
264
|
+
typing.List[AnnotationHistory],
|
|
265
|
+
construct_type(
|
|
266
|
+
type_=typing.List[AnnotationHistory], # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
_response_json = _response.json()
|
|
271
|
+
except JSONDecodeError:
|
|
272
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
273
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
274
|
+
|
|
275
|
+
async def delete(
|
|
276
|
+
self,
|
|
277
|
+
*,
|
|
278
|
+
annotation: typing.Optional[int] = None,
|
|
279
|
+
project: typing.Optional[int] = None,
|
|
280
|
+
task: typing.Optional[int] = None,
|
|
281
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
282
|
+
) -> AnnotationHistoryDeleteResponse:
|
|
283
|
+
"""
|
|
284
|
+
Delete all annotation history items for a specific annotation, task or project. This method is available only for users with administrator roles.
|
|
285
|
+
|
|
286
|
+
Parameters
|
|
287
|
+
----------
|
|
288
|
+
annotation : typing.Optional[int]
|
|
289
|
+
Annotation ID to delete annotation history items for.
|
|
290
|
+
|
|
291
|
+
project : typing.Optional[int]
|
|
292
|
+
Project ID to delete annotation history items for.
|
|
293
|
+
|
|
294
|
+
task : typing.Optional[int]
|
|
295
|
+
Task ID to delete annotation history items for.
|
|
296
|
+
|
|
297
|
+
request_options : typing.Optional[RequestOptions]
|
|
298
|
+
Request-specific configuration.
|
|
299
|
+
|
|
300
|
+
Returns
|
|
301
|
+
-------
|
|
302
|
+
AnnotationHistoryDeleteResponse
|
|
303
|
+
Returns a dict containing the count of removed items.
|
|
304
|
+
|
|
305
|
+
Examples
|
|
306
|
+
--------
|
|
307
|
+
import asyncio
|
|
308
|
+
|
|
309
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
310
|
+
|
|
311
|
+
client = AsyncLabelStudio(
|
|
312
|
+
api_key="YOUR_API_KEY",
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
async def main() -> None:
|
|
317
|
+
await client.annotation_history.delete()
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
asyncio.run(main())
|
|
321
|
+
"""
|
|
322
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
323
|
+
"api/annotation-history/",
|
|
324
|
+
method="DELETE",
|
|
325
|
+
params={
|
|
326
|
+
"annotation": annotation,
|
|
327
|
+
"project": project,
|
|
328
|
+
"task": task,
|
|
329
|
+
},
|
|
330
|
+
request_options=request_options,
|
|
331
|
+
)
|
|
332
|
+
try:
|
|
333
|
+
if 200 <= _response.status_code < 300:
|
|
334
|
+
return typing.cast(
|
|
335
|
+
AnnotationHistoryDeleteResponse,
|
|
336
|
+
construct_type(
|
|
337
|
+
type_=AnnotationHistoryDeleteResponse, # type: ignore
|
|
338
|
+
object_=_response.json(),
|
|
339
|
+
),
|
|
340
|
+
)
|
|
341
|
+
_response_json = _response.json()
|
|
342
|
+
except JSONDecodeError:
|
|
343
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
344
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
345
|
+
|
|
346
|
+
async def list_for_project(
|
|
347
|
+
self,
|
|
348
|
+
id: int,
|
|
349
|
+
*,
|
|
350
|
+
page: typing.Optional[int] = None,
|
|
351
|
+
page_size: typing.Optional[int] = None,
|
|
352
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
353
|
+
) -> PaginatedAnnotationHistoryList:
|
|
354
|
+
"""
|
|
355
|
+
List all annotation history items for the project with pagination.
|
|
356
|
+
|
|
357
|
+
Parameters
|
|
358
|
+
----------
|
|
359
|
+
id : int
|
|
360
|
+
|
|
361
|
+
page : typing.Optional[int]
|
|
362
|
+
A page number within the paginated result set.
|
|
363
|
+
|
|
364
|
+
page_size : typing.Optional[int]
|
|
365
|
+
Number of results to return per page.
|
|
366
|
+
|
|
367
|
+
request_options : typing.Optional[RequestOptions]
|
|
368
|
+
Request-specific configuration.
|
|
369
|
+
|
|
370
|
+
Returns
|
|
371
|
+
-------
|
|
372
|
+
PaginatedAnnotationHistoryList
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
Examples
|
|
376
|
+
--------
|
|
377
|
+
import asyncio
|
|
378
|
+
|
|
379
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
380
|
+
|
|
381
|
+
client = AsyncLabelStudio(
|
|
382
|
+
api_key="YOUR_API_KEY",
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
async def main() -> None:
|
|
387
|
+
await client.annotation_history.list_for_project(
|
|
388
|
+
id=1,
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
asyncio.run(main())
|
|
393
|
+
"""
|
|
394
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
395
|
+
f"api/projects/{jsonable_encoder(id)}/annotation-history/",
|
|
396
|
+
method="GET",
|
|
397
|
+
params={
|
|
398
|
+
"page": page,
|
|
399
|
+
"page_size": page_size,
|
|
400
|
+
},
|
|
401
|
+
request_options=request_options,
|
|
402
|
+
)
|
|
403
|
+
try:
|
|
404
|
+
if 200 <= _response.status_code < 300:
|
|
405
|
+
return typing.cast(
|
|
406
|
+
PaginatedAnnotationHistoryList,
|
|
407
|
+
construct_type(
|
|
408
|
+
type_=PaginatedAnnotationHistoryList, # type: ignore
|
|
409
|
+
object_=_response.json(),
|
|
410
|
+
),
|
|
411
|
+
)
|
|
412
|
+
_response_json = _response.json()
|
|
413
|
+
except JSONDecodeError:
|
|
414
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
415
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -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
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AnnotationHistoryDeleteResponse(UncheckedBaseModel):
|
|
10
|
+
removed: typing.Optional[int] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Number of removed items
|
|
13
|
+
"""
|
|
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
|