label-studio-sdk 2.0.5__py3-none-any.whl → 2.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

Files changed (92) hide show
  1. label_studio_sdk/__init__.py +70 -0
  2. label_studio_sdk/annotation_history/__init__.py +5 -0
  3. label_studio_sdk/annotation_history/client.py +415 -0
  4. label_studio_sdk/annotation_history/types/__init__.py +5 -0
  5. label_studio_sdk/annotation_history/types/annotation_history_delete_response.py +22 -0
  6. label_studio_sdk/annotation_reviews/__init__.py +2 -0
  7. label_studio_sdk/annotation_reviews/client.py +713 -0
  8. label_studio_sdk/base_client.py +20 -0
  9. label_studio_sdk/blueprints/__init__.py +2 -0
  10. label_studio_sdk/blueprints/client.py +272 -0
  11. label_studio_sdk/core/client_wrapper.py +2 -1
  12. label_studio_sdk/export_storage/__init__.py +2 -2
  13. label_studio_sdk/export_storage/azure_spi/__init__.py +2 -0
  14. label_studio_sdk/export_storage/azure_spi/client.py +1354 -0
  15. label_studio_sdk/export_storage/client.py +8 -0
  16. label_studio_sdk/export_storage/gcswif/__init__.py +2 -0
  17. label_studio_sdk/export_storage/gcswif/client.py +1376 -0
  18. label_studio_sdk/import_storage/__init__.py +2 -2
  19. label_studio_sdk/import_storage/azure_spi/__init__.py +2 -0
  20. label_studio_sdk/import_storage/azure_spi/client.py +1378 -0
  21. label_studio_sdk/import_storage/client.py +8 -0
  22. label_studio_sdk/import_storage/gcswif/__init__.py +2 -0
  23. label_studio_sdk/import_storage/gcswif/client.py +1400 -0
  24. label_studio_sdk/jwt_settings/client.py +10 -8
  25. label_studio_sdk/label_interface/control_tags.py +38 -0
  26. label_studio_sdk/label_interface/data_examples.json +10 -0
  27. label_studio_sdk/label_interface/interface.py +13 -0
  28. label_studio_sdk/label_interface/object_tags.py +9 -0
  29. label_studio_sdk/ml/client.py +124 -0
  30. label_studio_sdk/organizations/__init__.py +3 -2
  31. label_studio_sdk/organizations/client.py +536 -1
  32. label_studio_sdk/organizations/invites/__init__.py +2 -0
  33. label_studio_sdk/organizations/invites/client.py +368 -0
  34. label_studio_sdk/organizations/types/__init__.py +5 -0
  35. label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py +7 -0
  36. label_studio_sdk/project_templates/__init__.py +2 -0
  37. label_studio_sdk/project_templates/client.py +909 -0
  38. label_studio_sdk/projects/client.py +8 -0
  39. label_studio_sdk/projects/members/__init__.py +2 -2
  40. label_studio_sdk/projects/members/bulk/client.py +46 -2
  41. label_studio_sdk/projects/members/client.py +4 -0
  42. label_studio_sdk/projects/members/paginated/__init__.py +2 -0
  43. label_studio_sdk/projects/members/paginated/client.py +248 -0
  44. label_studio_sdk/session_policy/__init__.py +2 -0
  45. label_studio_sdk/session_policy/client.py +247 -0
  46. label_studio_sdk/tasks/client.py +371 -0
  47. label_studio_sdk/types/__init__.py +56 -0
  48. label_studio_sdk/types/action_enum.py +19 -0
  49. label_studio_sdk/types/all_roles_project_list.py +1 -1
  50. label_studio_sdk/types/annotation.py +7 -0
  51. label_studio_sdk/types/annotation_history.py +81 -0
  52. label_studio_sdk/types/annotation_history_action.py +7 -0
  53. label_studio_sdk/types/annotation_request.py +7 -0
  54. label_studio_sdk/types/annotation_review.py +61 -0
  55. label_studio_sdk/types/annotation_review_request.py +41 -0
  56. label_studio_sdk/types/azure_service_principal_export_storage.py +114 -0
  57. label_studio_sdk/types/azure_service_principal_export_storage_request.py +107 -0
  58. label_studio_sdk/types/azure_service_principal_import_storage.py +115 -0
  59. label_studio_sdk/types/azure_service_principal_import_storage_request.py +108 -0
  60. label_studio_sdk/types/blueprint.py +41 -0
  61. label_studio_sdk/types/default_role.py +75 -0
  62. label_studio_sdk/types/default_role_custom_scripts_editable_by.py +7 -0
  63. label_studio_sdk/types/gcswif_export_storage.py +119 -0
  64. label_studio_sdk/types/gcswif_export_storage_request.py +112 -0
  65. label_studio_sdk/types/gcswif_import_storage.py +120 -0
  66. label_studio_sdk/types/gcswif_import_storage_request.py +113 -0
  67. label_studio_sdk/types/lse_project.py +223 -0
  68. label_studio_sdk/types/lse_project_sampling.py +7 -0
  69. label_studio_sdk/types/lse_project_skip_queue.py +7 -0
  70. label_studio_sdk/types/lse_project_update.py +1 -0
  71. label_studio_sdk/types/lse_task.py +1 -0
  72. label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -0
  73. label_studio_sdk/types/lsejwt_settings.py +1 -5
  74. label_studio_sdk/types/paginated_annotation_history_list.py +23 -0
  75. label_studio_sdk/types/paginated_lse_user_list.py +23 -0
  76. label_studio_sdk/types/paginated_paginated_project_member_list.py +23 -0
  77. label_studio_sdk/types/paginated_project_member.py +50 -0
  78. label_studio_sdk/types/project_member_bulk_assign_roles_request.py +21 -0
  79. label_studio_sdk/types/project_template.py +41 -0
  80. label_studio_sdk/types/project_template_request.py +38 -0
  81. label_studio_sdk/types/review_settings.py +5 -0
  82. label_studio_sdk/types/review_settings_request.py +5 -0
  83. label_studio_sdk/types/session_timeout_policy.py +31 -0
  84. label_studio_sdk/types/task_event.py +61 -0
  85. label_studio_sdk/workspaces/members/__init__.py +2 -2
  86. label_studio_sdk/workspaces/members/client.py +4 -0
  87. label_studio_sdk/workspaces/members/paginated/__init__.py +2 -0
  88. label_studio_sdk/workspaces/members/paginated/client.py +212 -0
  89. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/METADATA +2 -2
  90. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/RECORD +92 -36
  91. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/LICENSE +0 -0
  92. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/WHEEL +0 -0
@@ -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,
@@ -36,6 +46,8 @@ from .types import (
36
46
  ConvertedFormatRequest,
37
47
  CountLimit,
38
48
  CustomScriptsEditableByEnum,
49
+ DefaultRole,
50
+ DefaultRoleCustomScriptsEditableBy,
39
51
  DefaultRoleEnum,
40
52
  EditionEnum,
41
53
  Export,
@@ -45,6 +57,10 @@ from .types import (
45
57
  FinishedEnum,
46
58
  GcsExportStorage,
47
59
  GcsImportStorage,
60
+ GcswifExportStorage,
61
+ GcswifExportStorageRequest,
62
+ GcswifImportStorage,
63
+ GcswifImportStorageRequest,
48
64
  Hotkeys,
49
65
  ImportApiRequest,
50
66
  InferenceRunCostEstimate,
@@ -64,9 +80,12 @@ from .types import (
64
80
  LseOrganization,
65
81
  LseOrganizationCustomScriptsEditableBy,
66
82
  LseOrganizationMemberList,
83
+ LseProject,
67
84
  LseProjectCreate,
68
85
  LseProjectCreateSampling,
69
86
  LseProjectCreateSkipQueue,
87
+ LseProjectSampling,
88
+ LseProjectSkipQueue,
70
89
  LseProjectUpdate,
71
90
  LseProjectUpdateSampling,
72
91
  LseProjectUpdateSkipQueue,
@@ -119,7 +138,11 @@ from .types import (
119
138
  OrganizationMember,
120
139
  OrganizationMembership,
121
140
  PaginatedAllRolesProjectListList,
141
+ PaginatedAnnotationHistoryList,
122
142
  PaginatedLseOrganizationMemberListList,
143
+ PaginatedLseUserList,
144
+ PaginatedPaginatedProjectMemberList,
145
+ PaginatedProjectMember,
123
146
  PaginatedRoleBasedTaskList,
124
147
  Pause,
125
148
  PauseRequest,
@@ -132,9 +155,12 @@ from .types import (
132
155
  ProjectImport,
133
156
  ProjectLabelConfig,
134
157
  ProjectLabelConfigRequest,
158
+ ProjectMemberBulkAssignRolesRequest,
135
159
  ProjectSampling,
136
160
  ProjectSkipQueue,
137
161
  ProjectSubsetEnum,
162
+ ProjectTemplate,
163
+ ProjectTemplateRequest,
138
164
  PromptsStatusEnum,
139
165
  ProviderEnum,
140
166
  ReasonEnum,
@@ -165,6 +191,7 @@ from .types import (
165
191
  SerializationOptionRequest,
166
192
  SerializationOptions,
167
193
  SerializationOptionsRequest,
194
+ SessionTimeoutPolicy,
168
195
  SkillNameEnum,
169
196
  SkipQueueEnum,
170
197
  SkippedEnum,
@@ -172,6 +199,7 @@ from .types import (
172
199
  Status7BfEnum,
173
200
  StatusC5AEnum,
174
201
  TaskAssignment,
202
+ TaskEvent,
175
203
  ThirdPartyModelVersion,
176
204
  ThirdPartyModelVersionRequest,
177
205
  TokenRefreshResponse,
@@ -203,8 +231,11 @@ from .errors import (
203
231
  from . import (
204
232
  actions,
205
233
  activity_logs,
234
+ annotation_history,
235
+ annotation_reviews,
206
236
  annotations,
207
237
  billing,
238
+ blueprints,
208
239
  comments,
209
240
  export_storage,
210
241
  files,
@@ -214,8 +245,10 @@ from . import (
214
245
  model_providers,
215
246
  organizations,
216
247
  predictions,
248
+ project_templates,
217
249
  projects,
218
250
  prompts,
251
+ session_policy,
219
252
  sso,
220
253
  tasks,
221
254
  tokens,
@@ -242,6 +275,7 @@ from .actions import (
242
275
  ActionsListResponseItemDialog,
243
276
  )
244
277
  from .activity_logs import ActivityLogsListRequestMethod
278
+ from .annotation_history import AnnotationHistoryDeleteResponse
245
279
  from .annotations import AnnotationBulkSerializerWithSelectedItemsRequestLastAction, AnnotationsCreateBulkResponseItem
246
280
  from .client import AsyncLabelStudio, LabelStudio
247
281
  from .environment import LabelStudioEnvironment
@@ -249,6 +283,7 @@ from .export_storage import ExportStorageListTypesResponseItem
249
283
  from .import_storage import ImportStorageListTypesResponseItem
250
284
  from .ml import MlCreateRequestAuthMethod, MlListModelVersionsResponse, MlUpdateRequestAuthMethod
251
285
  from .model_providers import ModelProvidersListModelProviderChoicesResponse
286
+ from .organizations import PatchedDefaultRoleRequestCustomScriptsEditableBy
252
287
  from .projects import (
253
288
  LseProjectCreateRequestSampling,
254
289
  LseProjectCreateRequestSkipQueue,
@@ -300,6 +335,7 @@ from .webhooks import (
300
335
  )
301
336
 
302
337
  __all__ = [
338
+ "ActionEnum",
303
339
  "ActionsCreateRequestFilters",
304
340
  "ActionsCreateRequestFiltersConjunction",
305
341
  "ActionsCreateRequestFiltersItemsItem",
@@ -323,9 +359,14 @@ __all__ = [
323
359
  "AnnotatedEnum",
324
360
  "Annotation",
325
361
  "AnnotationBulkSerializerWithSelectedItemsRequestLastAction",
362
+ "AnnotationHistory",
363
+ "AnnotationHistoryAction",
364
+ "AnnotationHistoryDeleteResponse",
326
365
  "AnnotationLastAction",
327
366
  "AnnotationRequest",
328
367
  "AnnotationRequestLastAction",
368
+ "AnnotationReview",
369
+ "AnnotationReviewRequest",
329
370
  "AnnotationsCreateBulkResponseItem",
330
371
  "AssignmentSettings",
331
372
  "AssignmentSettingsLabelStreamTaskDistribution",
@@ -336,6 +377,10 @@ __all__ = [
336
377
  "AuthMethodEnum",
337
378
  "AzureBlobExportStorage",
338
379
  "AzureBlobImportStorage",
380
+ "AzureServicePrincipalExportStorage",
381
+ "AzureServicePrincipalExportStorageRequest",
382
+ "AzureServicePrincipalImportStorage",
383
+ "AzureServicePrincipalImportStorageRequest",
339
384
  "BadRequestError",
340
385
  "BatchFailedPredictions",
341
386
  "BatchPredictions",
@@ -343,6 +388,7 @@ __all__ = [
343
388
  "BillingFlags",
344
389
  "BillingInfoResponse",
345
390
  "BlankEnum",
391
+ "Blueprint",
346
392
  "BlueprintList",
347
393
  "BudgetResetPeriodEnum",
348
394
  "ChildFilter",
@@ -354,6 +400,8 @@ __all__ = [
354
400
  "ConvertedFormatRequest",
355
401
  "CountLimit",
356
402
  "CustomScriptsEditableByEnum",
403
+ "DefaultRole",
404
+ "DefaultRoleCustomScriptsEditableBy",
357
405
  "DefaultRoleEnum",
358
406
  "EditionEnum",
359
407
  "Export",
@@ -365,6 +413,10 @@ __all__ = [
365
413
  "ForbiddenError",
366
414
  "GcsExportStorage",
367
415
  "GcsImportStorage",
416
+ "GcswifExportStorage",
417
+ "GcswifExportStorageRequest",
418
+ "GcswifImportStorage",
419
+ "GcswifImportStorageRequest",
368
420
  "Hotkeys",
369
421
  "ImportApiRequest",
370
422
  "ImportStorageListTypesResponseItem",
@@ -388,11 +440,14 @@ __all__ = [
388
440
  "LseOrganization",
389
441
  "LseOrganizationCustomScriptsEditableBy",
390
442
  "LseOrganizationMemberList",
443
+ "LseProject",
391
444
  "LseProjectCreate",
392
445
  "LseProjectCreateRequestSampling",
393
446
  "LseProjectCreateRequestSkipQueue",
394
447
  "LseProjectCreateSampling",
395
448
  "LseProjectCreateSkipQueue",
449
+ "LseProjectSampling",
450
+ "LseProjectSkipQueue",
396
451
  "LseProjectUpdate",
397
452
  "LseProjectUpdateSampling",
398
453
  "LseProjectUpdateSkipQueue",
@@ -451,8 +506,13 @@ __all__ = [
451
506
  "OrganizationMember",
452
507
  "OrganizationMembership",
453
508
  "PaginatedAllRolesProjectListList",
509
+ "PaginatedAnnotationHistoryList",
454
510
  "PaginatedLseOrganizationMemberListList",
511
+ "PaginatedLseUserList",
512
+ "PaginatedPaginatedProjectMemberList",
513
+ "PaginatedProjectMember",
455
514
  "PaginatedRoleBasedTaskList",
515
+ "PatchedDefaultRoleRequestCustomScriptsEditableBy",
456
516
  "PatchedLseProjectUpdateRequestSampling",
457
517
  "PatchedLseProjectUpdateRequestSkipQueue",
458
518
  "Pause",
@@ -466,9 +526,12 @@ __all__ = [
466
526
  "ProjectImport",
467
527
  "ProjectLabelConfig",
468
528
  "ProjectLabelConfigRequest",
529
+ "ProjectMemberBulkAssignRolesRequest",
469
530
  "ProjectSampling",
470
531
  "ProjectSkipQueue",
471
532
  "ProjectSubsetEnum",
533
+ "ProjectTemplate",
534
+ "ProjectTemplateRequest",
472
535
  "ProjectsDuplicateResponse",
473
536
  "ProjectsImportTasksResponse",
474
537
  "ProjectsListRequestFilter",
@@ -503,6 +566,7 @@ __all__ = [
503
566
  "SerializationOptionRequest",
504
567
  "SerializationOptions",
505
568
  "SerializationOptionsRequest",
569
+ "SessionTimeoutPolicy",
506
570
  "SkillNameEnum",
507
571
  "SkipQueueEnum",
508
572
  "SkippedEnum",
@@ -510,6 +574,7 @@ __all__ = [
510
574
  "Status7BfEnum",
511
575
  "StatusC5AEnum",
512
576
  "TaskAssignment",
577
+ "TaskEvent",
513
578
  "TasksListRequestFields",
514
579
  "ThirdPartyModelVersion",
515
580
  "ThirdPartyModelVersionRequest",
@@ -568,8 +633,11 @@ __all__ = [
568
633
  "__version__",
569
634
  "actions",
570
635
  "activity_logs",
636
+ "annotation_history",
637
+ "annotation_reviews",
571
638
  "annotations",
572
639
  "billing",
640
+ "blueprints",
573
641
  "comments",
574
642
  "export_storage",
575
643
  "files",
@@ -579,8 +647,10 @@ __all__ = [
579
647
  "model_providers",
580
648
  "organizations",
581
649
  "predictions",
650
+ "project_templates",
582
651
  "projects",
583
652
  "prompts",
653
+ "session_policy",
584
654
  "sso",
585
655
  "tasks",
586
656
  "tokens",
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import AnnotationHistoryDeleteResponse
4
+
5
+ __all__ = ["AnnotationHistoryDeleteResponse"]
@@ -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,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .annotation_history_delete_response import AnnotationHistoryDeleteResponse
4
+
5
+ __all__ = ["AnnotationHistoryDeleteResponse"]