label-studio-sdk 1.0.8__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 +37 -8
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +5 -0
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/actions/client.py +91 -40
- label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +278 -104
- label_studio_sdk/annotations/types/__init__.py +2 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
- label_studio_sdk/base_client.py +54 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +56 -13
- label_studio_sdk/converter/imports/yolo.py +1 -1
- label_studio_sdk/converter/utils.py +3 -2
- label_studio_sdk/core/__init__.py +21 -4
- label_studio_sdk/core/client_wrapper.py +37 -19
- label_studio_sdk/core/file.py +37 -8
- label_studio_sdk/core/http_client.py +52 -28
- label_studio_sdk/core/jsonable_encoder.py +33 -31
- label_studio_sdk/core/pagination.py +5 -4
- label_studio_sdk/core/pydantic_utilities.py +272 -4
- label_studio_sdk/core/query_encoder.py +38 -13
- label_studio_sdk/core/request_options.py +3 -0
- label_studio_sdk/core/serialization.py +272 -0
- label_studio_sdk/errors/__init__.py +3 -1
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/errors/not_found_error.py +9 -0
- label_studio_sdk/errors/unauthorized_error.py +9 -0
- label_studio_sdk/export_storage/azure/client.py +228 -58
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
- label_studio_sdk/export_storage/client.py +48 -18
- label_studio_sdk/export_storage/gcs/client.py +228 -58
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
- label_studio_sdk/export_storage/local/client.py +222 -56
- label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/export_storage/redis/client.py +228 -58
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/export_storage/s3/client.py +228 -58
- label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
- label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
- label_studio_sdk/export_storage/s3s/client.py +187 -43
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
- label_studio_sdk/files/client.py +172 -56
- label_studio_sdk/import_storage/azure/client.py +223 -53
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
- label_studio_sdk/import_storage/client.py +48 -18
- label_studio_sdk/import_storage/gcs/client.py +223 -53
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
- label_studio_sdk/import_storage/local/client.py +223 -53
- label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/import_storage/redis/client.py +223 -53
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/import_storage/s3/client.py +223 -53
- label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
- label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
- label_studio_sdk/import_storage/s3s/client.py +222 -52
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
- 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 +16 -3
- label_studio_sdk/label_interface/interface.py +80 -1
- label_studio_sdk/label_interface/object_tags.py +2 -2
- label_studio_sdk/ml/client.py +280 -78
- label_studio_sdk/ml/types/ml_create_response.py +21 -31
- label_studio_sdk/ml/types/ml_update_response.py +21 -31
- label_studio_sdk/model_providers/client.py +173 -56
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +5 -1
- label_studio_sdk/projects/client.py +313 -115
- label_studio_sdk/projects/client_ext.py +16 -0
- label_studio_sdk/projects/exports/__init__.py +3 -0
- label_studio_sdk/projects/exports/client.py +447 -296
- label_studio_sdk/projects/exports/client_ext.py +200 -0
- label_studio_sdk/projects/exports/types/__init__.py +6 -0
- label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
- label_studio_sdk/projects/pauses/__init__.py +2 -0
- label_studio_sdk/projects/pauses/client.py +704 -0
- label_studio_sdk/projects/types/projects_create_response.py +29 -34
- label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
- label_studio_sdk/projects/types/projects_list_response.py +11 -21
- label_studio_sdk/projects/types/projects_update_response.py +34 -34
- label_studio_sdk/prompts/client.py +309 -92
- label_studio_sdk/prompts/indicators/client.py +67 -23
- label_studio_sdk/prompts/runs/client.py +95 -40
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
- label_studio_sdk/prompts/versions/client.py +277 -88
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- 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 +20 -6
- label_studio_sdk/types/access_token_response.py +22 -0
- label_studio_sdk/types/annotation.py +29 -38
- label_studio_sdk/types/annotation_filter_options.py +14 -24
- label_studio_sdk/types/annotations_dm_field.py +30 -39
- label_studio_sdk/types/api_token_response.py +32 -0
- label_studio_sdk/types/azure_blob_export_storage.py +28 -37
- label_studio_sdk/types/azure_blob_import_storage.py +28 -37
- label_studio_sdk/types/base_task.py +30 -39
- label_studio_sdk/types/base_task_updated_by.py +3 -1
- label_studio_sdk/types/base_user.py +14 -21
- label_studio_sdk/types/comment.py +12 -21
- label_studio_sdk/types/comment_created_by.py +1 -1
- label_studio_sdk/types/converted_format.py +12 -22
- label_studio_sdk/types/data_manager_task_serializer.py +31 -40
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
- label_studio_sdk/types/export.py +17 -26
- label_studio_sdk/types/export_format.py +25 -0
- label_studio_sdk/types/export_snapshot.py +45 -0
- label_studio_sdk/types/export_snapshot_status.py +5 -0
- label_studio_sdk/types/file_upload.py +11 -21
- label_studio_sdk/types/filter.py +16 -26
- label_studio_sdk/types/filter_group.py +12 -22
- label_studio_sdk/types/gcs_export_storage.py +28 -37
- label_studio_sdk/types/gcs_import_storage.py +28 -37
- label_studio_sdk/types/inference_run.py +14 -23
- label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
- label_studio_sdk/types/inference_run_created_by.py +1 -1
- label_studio_sdk/types/inference_run_organization.py +1 -1
- label_studio_sdk/types/jwt_settings_response.py +32 -0
- label_studio_sdk/types/key_indicator_value.py +12 -22
- label_studio_sdk/types/key_indicators.py +0 -1
- label_studio_sdk/types/key_indicators_item.py +15 -25
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
- label_studio_sdk/types/local_files_export_storage.py +25 -34
- label_studio_sdk/types/local_files_import_storage.py +24 -33
- label_studio_sdk/types/ml_backend.py +23 -32
- label_studio_sdk/types/model_provider_connection.py +22 -31
- label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
- label_studio_sdk/types/model_provider_connection_organization.py +1 -1
- label_studio_sdk/types/model_provider_connection_provider.py +3 -1
- label_studio_sdk/types/pause.py +34 -0
- label_studio_sdk/types/pause_paused_by.py +5 -0
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +58 -55
- label_studio_sdk/types/project_import.py +21 -30
- label_studio_sdk/types/project_label_config.py +12 -22
- label_studio_sdk/types/prompt.py +24 -32
- label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
- label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
- label_studio_sdk/types/prompt_created_by.py +1 -1
- label_studio_sdk/types/prompt_organization.py +1 -1
- label_studio_sdk/types/prompt_version.py +13 -22
- label_studio_sdk/types/prompt_version_created_by.py +1 -1
- label_studio_sdk/types/prompt_version_organization.py +1 -1
- label_studio_sdk/types/prompt_version_provider.py +3 -1
- label_studio_sdk/types/redis_export_storage.py +29 -38
- label_studio_sdk/types/redis_import_storage.py +28 -37
- label_studio_sdk/types/refined_prompt_response.py +19 -29
- label_studio_sdk/types/s3export_storage.py +36 -43
- label_studio_sdk/types/s3import_storage.py +37 -44
- label_studio_sdk/types/s3s_export_storage.py +26 -33
- label_studio_sdk/types/s3s_import_storage.py +35 -42
- label_studio_sdk/types/serialization_option.py +12 -22
- label_studio_sdk/types/serialization_options.py +18 -28
- label_studio_sdk/types/task.py +44 -47
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +1 -1
- label_studio_sdk/types/task_filter_options.py +15 -25
- label_studio_sdk/types/user_simple.py +11 -21
- label_studio_sdk/types/view.py +16 -26
- label_studio_sdk/types/webhook.py +19 -28
- label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
- label_studio_sdk/types/workspace.py +22 -31
- label_studio_sdk/users/client.py +257 -63
- label_studio_sdk/users/types/users_get_token_response.py +12 -22
- label_studio_sdk/users/types/users_reset_token_response.py +12 -22
- label_studio_sdk/version.py +0 -1
- label_studio_sdk/versions/__init__.py +5 -0
- label_studio_sdk/versions/client.py +112 -0
- label_studio_sdk/versions/types/__init__.py +6 -0
- label_studio_sdk/versions/types/versions_get_response.py +73 -0
- label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
- label_studio_sdk/views/client.py +219 -52
- label_studio_sdk/views/types/views_create_request_data.py +13 -23
- label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/views/types/views_update_request_data.py +13 -23
- label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/webhooks/client.py +191 -61
- label_studio_sdk/workspaces/client.py +164 -41
- label_studio_sdk/workspaces/members/client.py +109 -31
- label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/METADATA +8 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/RECORD +215 -188
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/WHEEL +1 -1
- label_studio_sdk/types/export_convert.py +0 -32
- label_studio_sdk/types/export_create.py +0 -54
- label_studio_sdk/types/export_create_status.py +0 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/LICENSE +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import datetime as dt
|
|
4
3
|
import typing
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
from ..core.api_error import ApiError
|
|
8
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
-
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
|
-
from ..core.pydantic_utilities import pydantic_v1
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
11
5
|
from ..core.request_options import RequestOptions
|
|
12
6
|
from ..types.webhook import Webhook
|
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
13
10
|
from ..types.webhook_actions_item import WebhookActionsItem
|
|
14
|
-
|
|
15
|
-
from ..
|
|
11
|
+
import datetime as dt
|
|
12
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
16
13
|
from .types.webhooks_update_request_actions_item import WebhooksUpdateRequestActionsItem
|
|
14
|
+
from ..types.webhook_serializer_for_update_actions_item import WebhookSerializerForUpdateActionsItem
|
|
15
|
+
from ..types.webhook_serializer_for_update import WebhookSerializerForUpdate
|
|
16
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
17
17
|
|
|
18
18
|
# this is used as the default value for optional parameters
|
|
19
19
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -27,6 +27,7 @@ class WebhooksClient:
|
|
|
27
27
|
self, *, project: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
28
28
|
) -> typing.List[Webhook]:
|
|
29
29
|
"""
|
|
30
|
+
|
|
30
31
|
List all webhooks set up for your organization.
|
|
31
32
|
|
|
32
33
|
Webhooks in Label Studio let you set up integrations that subscribe to certain events that occur inside Label Studio. When an event is triggered, Label Studio sends an HTTP POST request to the configured webhook URL.
|
|
@@ -48,7 +49,7 @@ class WebhooksClient:
|
|
|
48
49
|
|
|
49
50
|
Examples
|
|
50
51
|
--------
|
|
51
|
-
from label_studio_sdk
|
|
52
|
+
from label_studio_sdk import LabelStudio
|
|
52
53
|
|
|
53
54
|
client = LabelStudio(
|
|
54
55
|
api_key="YOUR_API_KEY",
|
|
@@ -56,11 +57,22 @@ class WebhooksClient:
|
|
|
56
57
|
client.webhooks.list()
|
|
57
58
|
"""
|
|
58
59
|
_response = self._client_wrapper.httpx_client.request(
|
|
59
|
-
"api/webhooks/",
|
|
60
|
+
"api/webhooks/",
|
|
61
|
+
method="GET",
|
|
62
|
+
params={
|
|
63
|
+
"project": project,
|
|
64
|
+
},
|
|
65
|
+
request_options=request_options,
|
|
60
66
|
)
|
|
61
67
|
try:
|
|
62
68
|
if 200 <= _response.status_code < 300:
|
|
63
|
-
return
|
|
69
|
+
return typing.cast(
|
|
70
|
+
typing.List[Webhook],
|
|
71
|
+
parse_obj_as(
|
|
72
|
+
type_=typing.List[Webhook], # type: ignore
|
|
73
|
+
object_=_response.json(),
|
|
74
|
+
),
|
|
75
|
+
)
|
|
64
76
|
_response_json = _response.json()
|
|
65
77
|
except JSONDecodeError:
|
|
66
78
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -75,7 +87,7 @@ class WebhooksClient:
|
|
|
75
87
|
project: typing.Optional[int] = OMIT,
|
|
76
88
|
send_payload: typing.Optional[bool] = OMIT,
|
|
77
89
|
send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
78
|
-
headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
90
|
+
headers: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
79
91
|
is_active: typing.Optional[bool] = OMIT,
|
|
80
92
|
actions: typing.Optional[typing.Sequence[WebhookActionsItem]] = OMIT,
|
|
81
93
|
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
@@ -83,6 +95,7 @@ class WebhooksClient:
|
|
|
83
95
|
request_options: typing.Optional[RequestOptions] = None,
|
|
84
96
|
) -> Webhook:
|
|
85
97
|
"""
|
|
98
|
+
|
|
86
99
|
Create a webhook.
|
|
87
100
|
Label Studio provides several out-of-the box webhook events, which you can find listed here: [Available Label Studio webhooks](https://labelstud.io/guide/webhooks#Available-Label-Studio-webhooks).
|
|
88
101
|
|
|
@@ -107,7 +120,7 @@ class WebhooksClient:
|
|
|
107
120
|
send_for_all_actions : typing.Optional[bool]
|
|
108
121
|
If value is False - used only for actions from WebhookAction
|
|
109
122
|
|
|
110
|
-
headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
123
|
+
headers : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
111
124
|
Key Value Json of headers
|
|
112
125
|
|
|
113
126
|
is_active : typing.Optional[bool]
|
|
@@ -131,7 +144,7 @@ class WebhooksClient:
|
|
|
131
144
|
|
|
132
145
|
Examples
|
|
133
146
|
--------
|
|
134
|
-
from label_studio_sdk
|
|
147
|
+
from label_studio_sdk import LabelStudio
|
|
135
148
|
|
|
136
149
|
client = LabelStudio(
|
|
137
150
|
api_key="YOUR_API_KEY",
|
|
@@ -161,7 +174,13 @@ class WebhooksClient:
|
|
|
161
174
|
)
|
|
162
175
|
try:
|
|
163
176
|
if 200 <= _response.status_code < 300:
|
|
164
|
-
return
|
|
177
|
+
return typing.cast(
|
|
178
|
+
Webhook,
|
|
179
|
+
parse_obj_as(
|
|
180
|
+
type_=Webhook, # type: ignore
|
|
181
|
+
object_=_response.json(),
|
|
182
|
+
),
|
|
183
|
+
)
|
|
165
184
|
_response_json = _response.json()
|
|
166
185
|
except JSONDecodeError:
|
|
167
186
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -174,6 +193,7 @@ class WebhooksClient:
|
|
|
174
193
|
request_options: typing.Optional[RequestOptions] = None,
|
|
175
194
|
) -> None:
|
|
176
195
|
"""
|
|
196
|
+
|
|
177
197
|
Get descriptions of all available webhook actions to set up webhooks. For more information, see the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
178
198
|
|
|
179
199
|
Parameters
|
|
@@ -190,7 +210,7 @@ class WebhooksClient:
|
|
|
190
210
|
|
|
191
211
|
Examples
|
|
192
212
|
--------
|
|
193
|
-
from label_studio_sdk
|
|
213
|
+
from label_studio_sdk import LabelStudio
|
|
194
214
|
|
|
195
215
|
client = LabelStudio(
|
|
196
216
|
api_key="YOUR_API_KEY",
|
|
@@ -200,7 +220,9 @@ class WebhooksClient:
|
|
|
200
220
|
_response = self._client_wrapper.httpx_client.request(
|
|
201
221
|
"api/webhooks/info/",
|
|
202
222
|
method="GET",
|
|
203
|
-
params={
|
|
223
|
+
params={
|
|
224
|
+
"organization-only": organization_only,
|
|
225
|
+
},
|
|
204
226
|
request_options=request_options,
|
|
205
227
|
)
|
|
206
228
|
try:
|
|
@@ -213,6 +235,7 @@ class WebhooksClient:
|
|
|
213
235
|
|
|
214
236
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Webhook:
|
|
215
237
|
"""
|
|
238
|
+
|
|
216
239
|
Get information about a specific webhook. You will need to provide the webhook ID. You can get this from [List all webhooks](list).
|
|
217
240
|
|
|
218
241
|
For more information about webhooks, see [Set up webhooks in Label Studio](https://labelstud.io/guide/webhooks) and the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
@@ -232,7 +255,7 @@ class WebhooksClient:
|
|
|
232
255
|
|
|
233
256
|
Examples
|
|
234
257
|
--------
|
|
235
|
-
from label_studio_sdk
|
|
258
|
+
from label_studio_sdk import LabelStudio
|
|
236
259
|
|
|
237
260
|
client = LabelStudio(
|
|
238
261
|
api_key="YOUR_API_KEY",
|
|
@@ -242,11 +265,19 @@ class WebhooksClient:
|
|
|
242
265
|
)
|
|
243
266
|
"""
|
|
244
267
|
_response = self._client_wrapper.httpx_client.request(
|
|
245
|
-
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
268
|
+
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
269
|
+
method="GET",
|
|
270
|
+
request_options=request_options,
|
|
246
271
|
)
|
|
247
272
|
try:
|
|
248
273
|
if 200 <= _response.status_code < 300:
|
|
249
|
-
return
|
|
274
|
+
return typing.cast(
|
|
275
|
+
Webhook,
|
|
276
|
+
parse_obj_as(
|
|
277
|
+
type_=Webhook, # type: ignore
|
|
278
|
+
object_=_response.json(),
|
|
279
|
+
),
|
|
280
|
+
)
|
|
250
281
|
_response_json = _response.json()
|
|
251
282
|
except JSONDecodeError:
|
|
252
283
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -254,6 +285,7 @@ class WebhooksClient:
|
|
|
254
285
|
|
|
255
286
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
256
287
|
"""
|
|
288
|
+
|
|
257
289
|
Delete a webhook. You will need to provide the webhook ID. You can get this from [List all webhooks](list).
|
|
258
290
|
|
|
259
291
|
For more information about webhooks, see [Set up webhooks in Label Studio](https://labelstud.io/guide/webhooks) and the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
@@ -272,7 +304,7 @@ class WebhooksClient:
|
|
|
272
304
|
|
|
273
305
|
Examples
|
|
274
306
|
--------
|
|
275
|
-
from label_studio_sdk
|
|
307
|
+
from label_studio_sdk import LabelStudio
|
|
276
308
|
|
|
277
309
|
client = LabelStudio(
|
|
278
310
|
api_key="YOUR_API_KEY",
|
|
@@ -282,7 +314,9 @@ class WebhooksClient:
|
|
|
282
314
|
)
|
|
283
315
|
"""
|
|
284
316
|
_response = self._client_wrapper.httpx_client.request(
|
|
285
|
-
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
317
|
+
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
318
|
+
method="DELETE",
|
|
319
|
+
request_options=request_options,
|
|
286
320
|
)
|
|
287
321
|
try:
|
|
288
322
|
if 200 <= _response.status_code < 300:
|
|
@@ -310,7 +344,7 @@ class WebhooksClient:
|
|
|
310
344
|
project: typing.Optional[int] = OMIT,
|
|
311
345
|
webhook_serializer_for_update_send_payload: typing.Optional[bool] = OMIT,
|
|
312
346
|
webhook_serializer_for_update_send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
313
|
-
webhook_serializer_for_update_headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
347
|
+
webhook_serializer_for_update_headers: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
314
348
|
webhook_serializer_for_update_is_active: typing.Optional[bool] = OMIT,
|
|
315
349
|
webhook_serializer_for_update_actions: typing.Optional[
|
|
316
350
|
typing.Sequence[WebhookSerializerForUpdateActionsItem]
|
|
@@ -320,6 +354,7 @@ class WebhooksClient:
|
|
|
320
354
|
request_options: typing.Optional[RequestOptions] = None,
|
|
321
355
|
) -> WebhookSerializerForUpdate:
|
|
322
356
|
"""
|
|
357
|
+
|
|
323
358
|
Update a webhook. You will need to provide the webhook ID. You can get this from [List all webhooks](list).
|
|
324
359
|
|
|
325
360
|
For more information about webhooks, see [Set up webhooks in Label Studio](https://labelstud.io/guide/webhooks) and the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
@@ -361,7 +396,7 @@ class WebhooksClient:
|
|
|
361
396
|
webhook_serializer_for_update_send_for_all_actions : typing.Optional[bool]
|
|
362
397
|
If value is False - used only for actions from WebhookAction
|
|
363
398
|
|
|
364
|
-
webhook_serializer_for_update_headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
399
|
+
webhook_serializer_for_update_headers : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
365
400
|
Key Value Json of headers
|
|
366
401
|
|
|
367
402
|
webhook_serializer_for_update_is_active : typing.Optional[bool]
|
|
@@ -385,7 +420,7 @@ class WebhooksClient:
|
|
|
385
420
|
|
|
386
421
|
Examples
|
|
387
422
|
--------
|
|
388
|
-
from label_studio_sdk
|
|
423
|
+
from label_studio_sdk import LabelStudio
|
|
389
424
|
|
|
390
425
|
client = LabelStudio(
|
|
391
426
|
api_key="YOUR_API_KEY",
|
|
@@ -425,7 +460,13 @@ class WebhooksClient:
|
|
|
425
460
|
)
|
|
426
461
|
try:
|
|
427
462
|
if 200 <= _response.status_code < 300:
|
|
428
|
-
return
|
|
463
|
+
return typing.cast(
|
|
464
|
+
WebhookSerializerForUpdate,
|
|
465
|
+
parse_obj_as(
|
|
466
|
+
type_=WebhookSerializerForUpdate, # type: ignore
|
|
467
|
+
object_=_response.json(),
|
|
468
|
+
),
|
|
469
|
+
)
|
|
429
470
|
_response_json = _response.json()
|
|
430
471
|
except JSONDecodeError:
|
|
431
472
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -440,6 +481,7 @@ class AsyncWebhooksClient:
|
|
|
440
481
|
self, *, project: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
441
482
|
) -> typing.List[Webhook]:
|
|
442
483
|
"""
|
|
484
|
+
|
|
443
485
|
List all webhooks set up for your organization.
|
|
444
486
|
|
|
445
487
|
Webhooks in Label Studio let you set up integrations that subscribe to certain events that occur inside Label Studio. When an event is triggered, Label Studio sends an HTTP POST request to the configured webhook URL.
|
|
@@ -461,19 +503,38 @@ class AsyncWebhooksClient:
|
|
|
461
503
|
|
|
462
504
|
Examples
|
|
463
505
|
--------
|
|
464
|
-
|
|
506
|
+
import asyncio
|
|
507
|
+
|
|
508
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
465
509
|
|
|
466
510
|
client = AsyncLabelStudio(
|
|
467
511
|
api_key="YOUR_API_KEY",
|
|
468
512
|
)
|
|
469
|
-
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
async def main() -> None:
|
|
516
|
+
await client.webhooks.list()
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
asyncio.run(main())
|
|
470
520
|
"""
|
|
471
521
|
_response = await self._client_wrapper.httpx_client.request(
|
|
472
|
-
"api/webhooks/",
|
|
522
|
+
"api/webhooks/",
|
|
523
|
+
method="GET",
|
|
524
|
+
params={
|
|
525
|
+
"project": project,
|
|
526
|
+
},
|
|
527
|
+
request_options=request_options,
|
|
473
528
|
)
|
|
474
529
|
try:
|
|
475
530
|
if 200 <= _response.status_code < 300:
|
|
476
|
-
return
|
|
531
|
+
return typing.cast(
|
|
532
|
+
typing.List[Webhook],
|
|
533
|
+
parse_obj_as(
|
|
534
|
+
type_=typing.List[Webhook], # type: ignore
|
|
535
|
+
object_=_response.json(),
|
|
536
|
+
),
|
|
537
|
+
)
|
|
477
538
|
_response_json = _response.json()
|
|
478
539
|
except JSONDecodeError:
|
|
479
540
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -488,7 +549,7 @@ class AsyncWebhooksClient:
|
|
|
488
549
|
project: typing.Optional[int] = OMIT,
|
|
489
550
|
send_payload: typing.Optional[bool] = OMIT,
|
|
490
551
|
send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
491
|
-
headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
552
|
+
headers: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
492
553
|
is_active: typing.Optional[bool] = OMIT,
|
|
493
554
|
actions: typing.Optional[typing.Sequence[WebhookActionsItem]] = OMIT,
|
|
494
555
|
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
@@ -496,6 +557,7 @@ class AsyncWebhooksClient:
|
|
|
496
557
|
request_options: typing.Optional[RequestOptions] = None,
|
|
497
558
|
) -> Webhook:
|
|
498
559
|
"""
|
|
560
|
+
|
|
499
561
|
Create a webhook.
|
|
500
562
|
Label Studio provides several out-of-the box webhook events, which you can find listed here: [Available Label Studio webhooks](https://labelstud.io/guide/webhooks#Available-Label-Studio-webhooks).
|
|
501
563
|
|
|
@@ -520,7 +582,7 @@ class AsyncWebhooksClient:
|
|
|
520
582
|
send_for_all_actions : typing.Optional[bool]
|
|
521
583
|
If value is False - used only for actions from WebhookAction
|
|
522
584
|
|
|
523
|
-
headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
585
|
+
headers : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
524
586
|
Key Value Json of headers
|
|
525
587
|
|
|
526
588
|
is_active : typing.Optional[bool]
|
|
@@ -544,14 +606,22 @@ class AsyncWebhooksClient:
|
|
|
544
606
|
|
|
545
607
|
Examples
|
|
546
608
|
--------
|
|
547
|
-
|
|
609
|
+
import asyncio
|
|
610
|
+
|
|
611
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
548
612
|
|
|
549
613
|
client = AsyncLabelStudio(
|
|
550
614
|
api_key="YOUR_API_KEY",
|
|
551
615
|
)
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
)
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
async def main() -> None:
|
|
619
|
+
await client.webhooks.create(
|
|
620
|
+
url="url",
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
asyncio.run(main())
|
|
555
625
|
"""
|
|
556
626
|
_response = await self._client_wrapper.httpx_client.request(
|
|
557
627
|
"api/webhooks/",
|
|
@@ -574,7 +644,13 @@ class AsyncWebhooksClient:
|
|
|
574
644
|
)
|
|
575
645
|
try:
|
|
576
646
|
if 200 <= _response.status_code < 300:
|
|
577
|
-
return
|
|
647
|
+
return typing.cast(
|
|
648
|
+
Webhook,
|
|
649
|
+
parse_obj_as(
|
|
650
|
+
type_=Webhook, # type: ignore
|
|
651
|
+
object_=_response.json(),
|
|
652
|
+
),
|
|
653
|
+
)
|
|
578
654
|
_response_json = _response.json()
|
|
579
655
|
except JSONDecodeError:
|
|
580
656
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -587,6 +663,7 @@ class AsyncWebhooksClient:
|
|
|
587
663
|
request_options: typing.Optional[RequestOptions] = None,
|
|
588
664
|
) -> None:
|
|
589
665
|
"""
|
|
666
|
+
|
|
590
667
|
Get descriptions of all available webhook actions to set up webhooks. For more information, see the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
591
668
|
|
|
592
669
|
Parameters
|
|
@@ -603,17 +680,27 @@ class AsyncWebhooksClient:
|
|
|
603
680
|
|
|
604
681
|
Examples
|
|
605
682
|
--------
|
|
606
|
-
|
|
683
|
+
import asyncio
|
|
684
|
+
|
|
685
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
607
686
|
|
|
608
687
|
client = AsyncLabelStudio(
|
|
609
688
|
api_key="YOUR_API_KEY",
|
|
610
689
|
)
|
|
611
|
-
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
async def main() -> None:
|
|
693
|
+
await client.webhooks.info()
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
asyncio.run(main())
|
|
612
697
|
"""
|
|
613
698
|
_response = await self._client_wrapper.httpx_client.request(
|
|
614
699
|
"api/webhooks/info/",
|
|
615
700
|
method="GET",
|
|
616
|
-
params={
|
|
701
|
+
params={
|
|
702
|
+
"organization-only": organization_only,
|
|
703
|
+
},
|
|
617
704
|
request_options=request_options,
|
|
618
705
|
)
|
|
619
706
|
try:
|
|
@@ -626,6 +713,7 @@ class AsyncWebhooksClient:
|
|
|
626
713
|
|
|
627
714
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Webhook:
|
|
628
715
|
"""
|
|
716
|
+
|
|
629
717
|
Get information about a specific webhook. You will need to provide the webhook ID. You can get this from [List all webhooks](list).
|
|
630
718
|
|
|
631
719
|
For more information about webhooks, see [Set up webhooks in Label Studio](https://labelstud.io/guide/webhooks) and the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
@@ -645,21 +733,37 @@ class AsyncWebhooksClient:
|
|
|
645
733
|
|
|
646
734
|
Examples
|
|
647
735
|
--------
|
|
648
|
-
|
|
736
|
+
import asyncio
|
|
737
|
+
|
|
738
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
649
739
|
|
|
650
740
|
client = AsyncLabelStudio(
|
|
651
741
|
api_key="YOUR_API_KEY",
|
|
652
742
|
)
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
)
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
async def main() -> None:
|
|
746
|
+
await client.webhooks.get(
|
|
747
|
+
id=1,
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
asyncio.run(main())
|
|
656
752
|
"""
|
|
657
753
|
_response = await self._client_wrapper.httpx_client.request(
|
|
658
|
-
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
754
|
+
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
755
|
+
method="GET",
|
|
756
|
+
request_options=request_options,
|
|
659
757
|
)
|
|
660
758
|
try:
|
|
661
759
|
if 200 <= _response.status_code < 300:
|
|
662
|
-
return
|
|
760
|
+
return typing.cast(
|
|
761
|
+
Webhook,
|
|
762
|
+
parse_obj_as(
|
|
763
|
+
type_=Webhook, # type: ignore
|
|
764
|
+
object_=_response.json(),
|
|
765
|
+
),
|
|
766
|
+
)
|
|
663
767
|
_response_json = _response.json()
|
|
664
768
|
except JSONDecodeError:
|
|
665
769
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -667,6 +771,7 @@ class AsyncWebhooksClient:
|
|
|
667
771
|
|
|
668
772
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
669
773
|
"""
|
|
774
|
+
|
|
670
775
|
Delete a webhook. You will need to provide the webhook ID. You can get this from [List all webhooks](list).
|
|
671
776
|
|
|
672
777
|
For more information about webhooks, see [Set up webhooks in Label Studio](https://labelstud.io/guide/webhooks) and the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
@@ -685,17 +790,27 @@ class AsyncWebhooksClient:
|
|
|
685
790
|
|
|
686
791
|
Examples
|
|
687
792
|
--------
|
|
688
|
-
|
|
793
|
+
import asyncio
|
|
794
|
+
|
|
795
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
689
796
|
|
|
690
797
|
client = AsyncLabelStudio(
|
|
691
798
|
api_key="YOUR_API_KEY",
|
|
692
799
|
)
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
)
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
async def main() -> None:
|
|
803
|
+
await client.webhooks.delete(
|
|
804
|
+
id=1,
|
|
805
|
+
)
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
asyncio.run(main())
|
|
696
809
|
"""
|
|
697
810
|
_response = await self._client_wrapper.httpx_client.request(
|
|
698
|
-
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
811
|
+
f"api/webhooks/{jsonable_encoder(id)}/",
|
|
812
|
+
method="DELETE",
|
|
813
|
+
request_options=request_options,
|
|
699
814
|
)
|
|
700
815
|
try:
|
|
701
816
|
if 200 <= _response.status_code < 300:
|
|
@@ -723,7 +838,7 @@ class AsyncWebhooksClient:
|
|
|
723
838
|
project: typing.Optional[int] = OMIT,
|
|
724
839
|
webhook_serializer_for_update_send_payload: typing.Optional[bool] = OMIT,
|
|
725
840
|
webhook_serializer_for_update_send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
726
|
-
webhook_serializer_for_update_headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
841
|
+
webhook_serializer_for_update_headers: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
727
842
|
webhook_serializer_for_update_is_active: typing.Optional[bool] = OMIT,
|
|
728
843
|
webhook_serializer_for_update_actions: typing.Optional[
|
|
729
844
|
typing.Sequence[WebhookSerializerForUpdateActionsItem]
|
|
@@ -733,6 +848,7 @@ class AsyncWebhooksClient:
|
|
|
733
848
|
request_options: typing.Optional[RequestOptions] = None,
|
|
734
849
|
) -> WebhookSerializerForUpdate:
|
|
735
850
|
"""
|
|
851
|
+
|
|
736
852
|
Update a webhook. You will need to provide the webhook ID. You can get this from [List all webhooks](list).
|
|
737
853
|
|
|
738
854
|
For more information about webhooks, see [Set up webhooks in Label Studio](https://labelstud.io/guide/webhooks) and the [Webhook event reference](https://labelstud.io/guide/webhook_reference).
|
|
@@ -774,7 +890,7 @@ class AsyncWebhooksClient:
|
|
|
774
890
|
webhook_serializer_for_update_send_for_all_actions : typing.Optional[bool]
|
|
775
891
|
If value is False - used only for actions from WebhookAction
|
|
776
892
|
|
|
777
|
-
webhook_serializer_for_update_headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
893
|
+
webhook_serializer_for_update_headers : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
778
894
|
Key Value Json of headers
|
|
779
895
|
|
|
780
896
|
webhook_serializer_for_update_is_active : typing.Optional[bool]
|
|
@@ -798,16 +914,24 @@ class AsyncWebhooksClient:
|
|
|
798
914
|
|
|
799
915
|
Examples
|
|
800
916
|
--------
|
|
801
|
-
|
|
917
|
+
import asyncio
|
|
918
|
+
|
|
919
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
802
920
|
|
|
803
921
|
client = AsyncLabelStudio(
|
|
804
922
|
api_key="YOUR_API_KEY",
|
|
805
923
|
)
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
async def main() -> None:
|
|
927
|
+
await client.webhooks.update(
|
|
928
|
+
id_=1,
|
|
929
|
+
url="url",
|
|
930
|
+
webhook_serializer_for_update_url="url",
|
|
931
|
+
)
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
asyncio.run(main())
|
|
811
935
|
"""
|
|
812
936
|
_response = await self._client_wrapper.httpx_client.request(
|
|
813
937
|
f"api/webhooks/{jsonable_encoder(id_)}/",
|
|
@@ -838,7 +962,13 @@ class AsyncWebhooksClient:
|
|
|
838
962
|
)
|
|
839
963
|
try:
|
|
840
964
|
if 200 <= _response.status_code < 300:
|
|
841
|
-
return
|
|
965
|
+
return typing.cast(
|
|
966
|
+
WebhookSerializerForUpdate,
|
|
967
|
+
parse_obj_as(
|
|
968
|
+
type_=WebhookSerializerForUpdate, # type: ignore
|
|
969
|
+
object_=_response.json(),
|
|
970
|
+
),
|
|
971
|
+
)
|
|
842
972
|
_response_json = _response.json()
|
|
843
973
|
except JSONDecodeError:
|
|
844
974
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|