label-studio-sdk 1.0.3__py3-none-any.whl → 1.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +10 -0
- label_studio_sdk/actions/client.py +8 -8
- label_studio_sdk/annotations/client.py +24 -24
- label_studio_sdk/base_client.py +3 -0
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/core/http_client.py +36 -8
- label_studio_sdk/core/request_options.py +2 -2
- label_studio_sdk/export_storage/__init__.py +2 -1
- label_studio_sdk/export_storage/azure/client.py +28 -28
- label_studio_sdk/export_storage/client.py +7 -4
- label_studio_sdk/export_storage/gcs/client.py +28 -28
- label_studio_sdk/export_storage/local/client.py +28 -28
- label_studio_sdk/export_storage/redis/client.py +28 -28
- label_studio_sdk/export_storage/s3/client.py +28 -28
- label_studio_sdk/export_storage/s3s/__init__.py +2 -0
- label_studio_sdk/export_storage/s3s/client.py +836 -0
- label_studio_sdk/files/client.py +24 -24
- label_studio_sdk/import_storage/__init__.py +2 -1
- label_studio_sdk/import_storage/azure/client.py +28 -28
- label_studio_sdk/import_storage/client.py +7 -4
- label_studio_sdk/import_storage/gcs/client.py +28 -28
- label_studio_sdk/import_storage/local/client.py +28 -28
- label_studio_sdk/import_storage/redis/client.py +28 -28
- label_studio_sdk/import_storage/s3/client.py +28 -28
- label_studio_sdk/import_storage/s3s/__init__.py +2 -0
- label_studio_sdk/import_storage/s3s/client.py +1054 -0
- label_studio_sdk/label_interface/base.py +2 -2
- label_studio_sdk/label_interface/control_tags.py +32 -18
- label_studio_sdk/label_interface/create.py +241 -0
- label_studio_sdk/label_interface/interface.py +68 -0
- label_studio_sdk/label_interface/object_tags.py +26 -10
- label_studio_sdk/label_interface/objects.py +5 -5
- label_studio_sdk/ml/client.py +36 -36
- label_studio_sdk/predictions/client.py +24 -24
- label_studio_sdk/projects/client.py +86 -56
- label_studio_sdk/projects/client_ext.py +16 -1
- label_studio_sdk/projects/exports/client.py +38 -38
- label_studio_sdk/tasks/client.py +70 -60
- label_studio_sdk/tasks/client_ext.py +4 -0
- label_studio_sdk/types/__init__.py +8 -0
- label_studio_sdk/types/s3s_export_storage.py +80 -0
- label_studio_sdk/types/s3s_import_storage.py +129 -0
- label_studio_sdk/types/s3s_import_storage_status.py +7 -0
- label_studio_sdk/types/workspace.py +77 -0
- label_studio_sdk/users/client.py +32 -32
- label_studio_sdk/views/client.py +24 -24
- label_studio_sdk/webhooks/client.py +24 -24
- label_studio_sdk/workspaces/__init__.py +6 -0
- label_studio_sdk/workspaces/client.py +569 -0
- label_studio_sdk/workspaces/members/__init__.py +5 -0
- label_studio_sdk/workspaces/members/client.py +297 -0
- label_studio_sdk/workspaces/members/types/__init__.py +6 -0
- label_studio_sdk/workspaces/members/types/members_create_response.py +32 -0
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +32 -0
- {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.4.dist-info}/METADATA +11 -12
- {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.4.dist-info}/RECORD +57 -41
- {label_studio_sdk-1.0.3.dist-info → label_studio_sdk-1.0.4.dist-info}/WHEEL +0 -0
label_studio_sdk/__init__.py
CHANGED
|
@@ -54,6 +54,9 @@ from .types import (
|
|
|
54
54
|
S3ExportStorageStatus,
|
|
55
55
|
S3ImportStorage,
|
|
56
56
|
S3ImportStorageStatus,
|
|
57
|
+
S3SExportStorage,
|
|
58
|
+
S3SImportStorage,
|
|
59
|
+
S3SImportStorageStatus,
|
|
57
60
|
SerializationOption,
|
|
58
61
|
SerializationOptions,
|
|
59
62
|
Task,
|
|
@@ -65,6 +68,7 @@ from .types import (
|
|
|
65
68
|
WebhookActionsItem,
|
|
66
69
|
WebhookSerializerForUpdate,
|
|
67
70
|
WebhookSerializerForUpdateActionsItem,
|
|
71
|
+
Workspace,
|
|
68
72
|
)
|
|
69
73
|
from .errors import BadRequestError, InternalServerError
|
|
70
74
|
from . import (
|
|
@@ -80,6 +84,7 @@ from . import (
|
|
|
80
84
|
users,
|
|
81
85
|
views,
|
|
82
86
|
webhooks,
|
|
87
|
+
workspaces,
|
|
83
88
|
)
|
|
84
89
|
from ._legacy import Client
|
|
85
90
|
from .actions import (
|
|
@@ -211,6 +216,9 @@ __all__ = [
|
|
|
211
216
|
"S3ExportStorageStatus",
|
|
212
217
|
"S3ImportStorage",
|
|
213
218
|
"S3ImportStorageStatus",
|
|
219
|
+
"S3SExportStorage",
|
|
220
|
+
"S3SImportStorage",
|
|
221
|
+
"S3SImportStorageStatus",
|
|
214
222
|
"SerializationOption",
|
|
215
223
|
"SerializationOptions",
|
|
216
224
|
"Task",
|
|
@@ -243,6 +251,7 @@ __all__ = [
|
|
|
243
251
|
"WebhookSerializerForUpdate",
|
|
244
252
|
"WebhookSerializerForUpdateActionsItem",
|
|
245
253
|
"WebhooksUpdateRequestActionsItem",
|
|
254
|
+
"Workspace",
|
|
246
255
|
"__version__",
|
|
247
256
|
"actions",
|
|
248
257
|
"annotations",
|
|
@@ -256,4 +265,5 @@ __all__ = [
|
|
|
256
265
|
"users",
|
|
257
266
|
"views",
|
|
258
267
|
"webhooks",
|
|
268
|
+
"workspaces",
|
|
259
269
|
]
|
|
@@ -44,9 +44,9 @@ class ActionsClient:
|
|
|
44
44
|
_response = self._client_wrapper.httpx_client.request(
|
|
45
45
|
"api/dm/actions/", method="GET", request_options=request_options
|
|
46
46
|
)
|
|
47
|
-
if 200 <= _response.status_code < 300:
|
|
48
|
-
return
|
|
49
47
|
try:
|
|
48
|
+
if 200 <= _response.status_code < 300:
|
|
49
|
+
return
|
|
50
50
|
_response_json = _response.json()
|
|
51
51
|
except JSONDecodeError:
|
|
52
52
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -134,9 +134,9 @@ class ActionsClient:
|
|
|
134
134
|
request_options=request_options,
|
|
135
135
|
omit=OMIT,
|
|
136
136
|
)
|
|
137
|
-
if 200 <= _response.status_code < 300:
|
|
138
|
-
return
|
|
139
137
|
try:
|
|
138
|
+
if 200 <= _response.status_code < 300:
|
|
139
|
+
return
|
|
140
140
|
_response_json = _response.json()
|
|
141
141
|
except JSONDecodeError:
|
|
142
142
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -172,9 +172,9 @@ class AsyncActionsClient:
|
|
|
172
172
|
_response = await self._client_wrapper.httpx_client.request(
|
|
173
173
|
"api/dm/actions/", method="GET", request_options=request_options
|
|
174
174
|
)
|
|
175
|
-
if 200 <= _response.status_code < 300:
|
|
176
|
-
return
|
|
177
175
|
try:
|
|
176
|
+
if 200 <= _response.status_code < 300:
|
|
177
|
+
return
|
|
178
178
|
_response_json = _response.json()
|
|
179
179
|
except JSONDecodeError:
|
|
180
180
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -262,9 +262,9 @@ class AsyncActionsClient:
|
|
|
262
262
|
request_options=request_options,
|
|
263
263
|
omit=OMIT,
|
|
264
264
|
)
|
|
265
|
-
if 200 <= _response.status_code < 300:
|
|
266
|
-
return
|
|
267
265
|
try:
|
|
266
|
+
if 200 <= _response.status_code < 300:
|
|
267
|
+
return
|
|
268
268
|
_response_json = _response.json()
|
|
269
269
|
except JSONDecodeError:
|
|
270
270
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -51,9 +51,9 @@ class AnnotationsClient:
|
|
|
51
51
|
_response = self._client_wrapper.httpx_client.request(
|
|
52
52
|
f"api/annotations/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
53
53
|
)
|
|
54
|
-
if 200 <= _response.status_code < 300:
|
|
55
|
-
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
56
54
|
try:
|
|
55
|
+
if 200 <= _response.status_code < 300:
|
|
56
|
+
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
57
57
|
_response_json = _response.json()
|
|
58
58
|
except JSONDecodeError:
|
|
59
59
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -93,9 +93,9 @@ class AnnotationsClient:
|
|
|
93
93
|
_response = self._client_wrapper.httpx_client.request(
|
|
94
94
|
f"api/annotations/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
|
|
95
95
|
)
|
|
96
|
-
if 200 <= _response.status_code < 300:
|
|
97
|
-
return
|
|
98
96
|
try:
|
|
97
|
+
if 200 <= _response.status_code < 300:
|
|
98
|
+
return
|
|
99
99
|
_response_json = _response.json()
|
|
100
100
|
except JSONDecodeError:
|
|
101
101
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -182,7 +182,7 @@ class AnnotationsClient:
|
|
|
182
182
|
"width": 50,
|
|
183
183
|
"height": 60,
|
|
184
184
|
"rotation": 0,
|
|
185
|
-
"values": {"rectanglelabels":
|
|
185
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
186
186
|
},
|
|
187
187
|
}
|
|
188
188
|
],
|
|
@@ -206,9 +206,9 @@ class AnnotationsClient:
|
|
|
206
206
|
request_options=request_options,
|
|
207
207
|
omit=OMIT,
|
|
208
208
|
)
|
|
209
|
-
if 200 <= _response.status_code < 300:
|
|
210
|
-
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
211
209
|
try:
|
|
210
|
+
if 200 <= _response.status_code < 300:
|
|
211
|
+
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
212
212
|
_response_json = _response.json()
|
|
213
213
|
except JSONDecodeError:
|
|
214
214
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -247,9 +247,9 @@ class AnnotationsClient:
|
|
|
247
247
|
_response = self._client_wrapper.httpx_client.request(
|
|
248
248
|
f"api/tasks/{jsonable_encoder(id)}/annotations/", method="GET", request_options=request_options
|
|
249
249
|
)
|
|
250
|
-
if 200 <= _response.status_code < 300:
|
|
251
|
-
return pydantic_v1.parse_obj_as(typing.List[Annotation], _response.json()) # type: ignore
|
|
252
250
|
try:
|
|
251
|
+
if 200 <= _response.status_code < 300:
|
|
252
|
+
return pydantic_v1.parse_obj_as(typing.List[Annotation], _response.json()) # type: ignore
|
|
253
253
|
_response_json = _response.json()
|
|
254
254
|
except JSONDecodeError:
|
|
255
255
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -348,7 +348,7 @@ class AnnotationsClient:
|
|
|
348
348
|
"width": 50,
|
|
349
349
|
"height": 60,
|
|
350
350
|
"rotation": 0,
|
|
351
|
-
"values": {"rectanglelabels":
|
|
351
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
352
352
|
},
|
|
353
353
|
}
|
|
354
354
|
],
|
|
@@ -372,9 +372,9 @@ class AnnotationsClient:
|
|
|
372
372
|
request_options=request_options,
|
|
373
373
|
omit=OMIT,
|
|
374
374
|
)
|
|
375
|
-
if 200 <= _response.status_code < 300:
|
|
376
|
-
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
377
375
|
try:
|
|
376
|
+
if 200 <= _response.status_code < 300:
|
|
377
|
+
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
378
378
|
_response_json = _response.json()
|
|
379
379
|
except JSONDecodeError:
|
|
380
380
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -418,9 +418,9 @@ class AsyncAnnotationsClient:
|
|
|
418
418
|
_response = await self._client_wrapper.httpx_client.request(
|
|
419
419
|
f"api/annotations/{jsonable_encoder(id)}/", method="GET", request_options=request_options
|
|
420
420
|
)
|
|
421
|
-
if 200 <= _response.status_code < 300:
|
|
422
|
-
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
423
421
|
try:
|
|
422
|
+
if 200 <= _response.status_code < 300:
|
|
423
|
+
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
424
424
|
_response_json = _response.json()
|
|
425
425
|
except JSONDecodeError:
|
|
426
426
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -460,9 +460,9 @@ class AsyncAnnotationsClient:
|
|
|
460
460
|
_response = await self._client_wrapper.httpx_client.request(
|
|
461
461
|
f"api/annotations/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
|
|
462
462
|
)
|
|
463
|
-
if 200 <= _response.status_code < 300:
|
|
464
|
-
return
|
|
465
463
|
try:
|
|
464
|
+
if 200 <= _response.status_code < 300:
|
|
465
|
+
return
|
|
466
466
|
_response_json = _response.json()
|
|
467
467
|
except JSONDecodeError:
|
|
468
468
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -549,7 +549,7 @@ class AsyncAnnotationsClient:
|
|
|
549
549
|
"width": 50,
|
|
550
550
|
"height": 60,
|
|
551
551
|
"rotation": 0,
|
|
552
|
-
"values": {"rectanglelabels":
|
|
552
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
553
553
|
},
|
|
554
554
|
}
|
|
555
555
|
],
|
|
@@ -573,9 +573,9 @@ class AsyncAnnotationsClient:
|
|
|
573
573
|
request_options=request_options,
|
|
574
574
|
omit=OMIT,
|
|
575
575
|
)
|
|
576
|
-
if 200 <= _response.status_code < 300:
|
|
577
|
-
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
578
576
|
try:
|
|
577
|
+
if 200 <= _response.status_code < 300:
|
|
578
|
+
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
579
579
|
_response_json = _response.json()
|
|
580
580
|
except JSONDecodeError:
|
|
581
581
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -616,9 +616,9 @@ class AsyncAnnotationsClient:
|
|
|
616
616
|
_response = await self._client_wrapper.httpx_client.request(
|
|
617
617
|
f"api/tasks/{jsonable_encoder(id)}/annotations/", method="GET", request_options=request_options
|
|
618
618
|
)
|
|
619
|
-
if 200 <= _response.status_code < 300:
|
|
620
|
-
return pydantic_v1.parse_obj_as(typing.List[Annotation], _response.json()) # type: ignore
|
|
621
619
|
try:
|
|
620
|
+
if 200 <= _response.status_code < 300:
|
|
621
|
+
return pydantic_v1.parse_obj_as(typing.List[Annotation], _response.json()) # type: ignore
|
|
622
622
|
_response_json = _response.json()
|
|
623
623
|
except JSONDecodeError:
|
|
624
624
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -717,7 +717,7 @@ class AsyncAnnotationsClient:
|
|
|
717
717
|
"width": 50,
|
|
718
718
|
"height": 60,
|
|
719
719
|
"rotation": 0,
|
|
720
|
-
"values": {"rectanglelabels":
|
|
720
|
+
"values": {"rectanglelabels": ["Person"]},
|
|
721
721
|
},
|
|
722
722
|
}
|
|
723
723
|
],
|
|
@@ -741,9 +741,9 @@ class AsyncAnnotationsClient:
|
|
|
741
741
|
request_options=request_options,
|
|
742
742
|
omit=OMIT,
|
|
743
743
|
)
|
|
744
|
-
if 200 <= _response.status_code < 300:
|
|
745
|
-
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
746
744
|
try:
|
|
745
|
+
if 200 <= _response.status_code < 300:
|
|
746
|
+
return pydantic_v1.parse_obj_as(Annotation, _response.json()) # type: ignore
|
|
747
747
|
_response_json = _response.json()
|
|
748
748
|
except JSONDecodeError:
|
|
749
749
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
label_studio_sdk/base_client.py
CHANGED
|
@@ -20,6 +20,7 @@ from .tasks.client import AsyncTasksClient, TasksClient
|
|
|
20
20
|
from .users.client import AsyncUsersClient, UsersClient
|
|
21
21
|
from .views.client import AsyncViewsClient, ViewsClient
|
|
22
22
|
from .webhooks.client import AsyncWebhooksClient, WebhooksClient
|
|
23
|
+
from .workspaces.client import AsyncWorkspacesClient, WorkspacesClient
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class LabelStudioBase:
|
|
@@ -96,6 +97,7 @@ class LabelStudioBase:
|
|
|
96
97
|
self.import_storage = ImportStorageClient(client_wrapper=self._client_wrapper)
|
|
97
98
|
self.export_storage = ExportStorageClient(client_wrapper=self._client_wrapper)
|
|
98
99
|
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
|
|
100
|
+
self.workspaces = WorkspacesClient(client_wrapper=self._client_wrapper)
|
|
99
101
|
|
|
100
102
|
|
|
101
103
|
class AsyncLabelStudioBase:
|
|
@@ -172,6 +174,7 @@ class AsyncLabelStudioBase:
|
|
|
172
174
|
self.import_storage = AsyncImportStorageClient(client_wrapper=self._client_wrapper)
|
|
173
175
|
self.export_storage = AsyncExportStorageClient(client_wrapper=self._client_wrapper)
|
|
174
176
|
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
|
|
177
|
+
self.workspaces = AsyncWorkspacesClient(client_wrapper=self._client_wrapper)
|
|
175
178
|
|
|
176
179
|
|
|
177
180
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: LabelStudioEnvironment) -> str:
|
|
@@ -17,7 +17,7 @@ class BaseClientWrapper:
|
|
|
17
17
|
headers: typing.Dict[str, str] = {
|
|
18
18
|
"X-Fern-Language": "Python",
|
|
19
19
|
"X-Fern-SDK-Name": "label-studio-sdk",
|
|
20
|
-
"X-Fern-SDK-Version": "1.0.
|
|
20
|
+
"X-Fern-SDK-Version": "1.0.4",
|
|
21
21
|
}
|
|
22
22
|
headers["Authorization"] = f"Token {self.api_key}"
|
|
23
23
|
return headers
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import email.utils
|
|
5
|
+
import json
|
|
5
6
|
import re
|
|
6
7
|
import time
|
|
7
8
|
import typing
|
|
@@ -125,6 +126,25 @@ def maybe_filter_request_body(
|
|
|
125
126
|
return data_content
|
|
126
127
|
|
|
127
128
|
|
|
129
|
+
# Abstracted out for testing purposes
|
|
130
|
+
def get_request_body(
|
|
131
|
+
*,
|
|
132
|
+
json: typing.Optional[typing.Any],
|
|
133
|
+
data: typing.Optional[typing.Any],
|
|
134
|
+
request_options: typing.Optional[RequestOptions],
|
|
135
|
+
omit: typing.Optional[typing.Any],
|
|
136
|
+
) -> typing.Tuple[typing.Optional[typing.Any], typing.Optional[typing.Any]]:
|
|
137
|
+
json_body = None
|
|
138
|
+
data_body = None
|
|
139
|
+
if data is not None:
|
|
140
|
+
data_body = maybe_filter_request_body(data, request_options, omit)
|
|
141
|
+
else:
|
|
142
|
+
# If both data and json are None, we send json data in the event extra properties are specified
|
|
143
|
+
json_body = maybe_filter_request_body(json, request_options, omit)
|
|
144
|
+
|
|
145
|
+
return json_body, data_body
|
|
146
|
+
|
|
147
|
+
|
|
128
148
|
class HttpClient:
|
|
129
149
|
def __init__(
|
|
130
150
|
self,
|
|
@@ -168,6 +188,8 @@ class HttpClient:
|
|
|
168
188
|
else self.base_timeout
|
|
169
189
|
)
|
|
170
190
|
|
|
191
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
192
|
+
|
|
171
193
|
response = self.httpx_client.request(
|
|
172
194
|
method=method,
|
|
173
195
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
|
@@ -197,8 +219,8 @@ class HttpClient:
|
|
|
197
219
|
)
|
|
198
220
|
)
|
|
199
221
|
),
|
|
200
|
-
json=
|
|
201
|
-
data=
|
|
222
|
+
json=json_body,
|
|
223
|
+
data=data_body,
|
|
202
224
|
content=content,
|
|
203
225
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
204
226
|
timeout=timeout,
|
|
@@ -248,6 +270,8 @@ class HttpClient:
|
|
|
248
270
|
else self.base_timeout
|
|
249
271
|
)
|
|
250
272
|
|
|
273
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
274
|
+
|
|
251
275
|
with self.httpx_client.stream(
|
|
252
276
|
method=method,
|
|
253
277
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
|
@@ -277,8 +301,8 @@ class HttpClient:
|
|
|
277
301
|
)
|
|
278
302
|
)
|
|
279
303
|
),
|
|
280
|
-
json=
|
|
281
|
-
data=
|
|
304
|
+
json=json_body,
|
|
305
|
+
data=data_body,
|
|
282
306
|
content=content,
|
|
283
307
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
284
308
|
timeout=timeout,
|
|
@@ -329,6 +353,8 @@ class AsyncHttpClient:
|
|
|
329
353
|
else self.base_timeout
|
|
330
354
|
)
|
|
331
355
|
|
|
356
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
357
|
+
|
|
332
358
|
# Add the input to each of these and do None-safety checks
|
|
333
359
|
response = await self.httpx_client.request(
|
|
334
360
|
method=method,
|
|
@@ -359,8 +385,8 @@ class AsyncHttpClient:
|
|
|
359
385
|
)
|
|
360
386
|
)
|
|
361
387
|
),
|
|
362
|
-
json=
|
|
363
|
-
data=
|
|
388
|
+
json=json_body,
|
|
389
|
+
data=data_body,
|
|
364
390
|
content=content,
|
|
365
391
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
366
392
|
timeout=timeout,
|
|
@@ -409,6 +435,8 @@ class AsyncHttpClient:
|
|
|
409
435
|
else self.base_timeout
|
|
410
436
|
)
|
|
411
437
|
|
|
438
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
439
|
+
|
|
412
440
|
async with self.httpx_client.stream(
|
|
413
441
|
method=method,
|
|
414
442
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
|
@@ -438,8 +466,8 @@ class AsyncHttpClient:
|
|
|
438
466
|
)
|
|
439
467
|
)
|
|
440
468
|
),
|
|
441
|
-
json=
|
|
442
|
-
data=
|
|
469
|
+
json=json_body,
|
|
470
|
+
data=data_body,
|
|
443
471
|
content=content,
|
|
444
472
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
445
473
|
timeout=timeout,
|
|
@@ -5,10 +5,10 @@ import typing
|
|
|
5
5
|
try:
|
|
6
6
|
from typing import NotRequired # type: ignore
|
|
7
7
|
except ImportError:
|
|
8
|
-
from typing_extensions import NotRequired
|
|
8
|
+
from typing_extensions import NotRequired
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class RequestOptions(typing.TypedDict):
|
|
11
|
+
class RequestOptions(typing.TypedDict, total=False):
|
|
12
12
|
"""
|
|
13
13
|
Additional options for request-specific configuration when calling APIs via the SDK.
|
|
14
14
|
This is used primarily as an optional final parameter for service functions.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from .types import ExportStorageListTypesResponseItem
|
|
4
|
-
from . import azure, gcs, local, redis, s3
|
|
4
|
+
from . import azure, gcs, local, redis, s3, s3s
|
|
5
5
|
from .azure import AzureCreateResponse, AzureUpdateResponse
|
|
6
6
|
from .gcs import GcsCreateResponse, GcsUpdateResponse
|
|
7
7
|
from .local import LocalCreateResponse, LocalUpdateResponse
|
|
@@ -25,4 +25,5 @@ __all__ = [
|
|
|
25
25
|
"local",
|
|
26
26
|
"redis",
|
|
27
27
|
"s3",
|
|
28
|
+
"s3s",
|
|
28
29
|
]
|
|
@@ -55,9 +55,9 @@ class AzureClient:
|
|
|
55
55
|
_response = self._client_wrapper.httpx_client.request(
|
|
56
56
|
"api/storages/export/azure", method="GET", params={"project": project}, request_options=request_options
|
|
57
57
|
)
|
|
58
|
-
if 200 <= _response.status_code < 300:
|
|
59
|
-
return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
|
|
60
58
|
try:
|
|
59
|
+
if 200 <= _response.status_code < 300:
|
|
60
|
+
return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
|
|
61
61
|
_response_json = _response.json()
|
|
62
62
|
except JSONDecodeError:
|
|
63
63
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -142,9 +142,9 @@ class AzureClient:
|
|
|
142
142
|
request_options=request_options,
|
|
143
143
|
omit=OMIT,
|
|
144
144
|
)
|
|
145
|
-
if 200 <= _response.status_code < 300:
|
|
146
|
-
return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
|
|
147
145
|
try:
|
|
146
|
+
if 200 <= _response.status_code < 300:
|
|
147
|
+
return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
|
|
148
148
|
_response_json = _response.json()
|
|
149
149
|
except JSONDecodeError:
|
|
150
150
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -229,9 +229,9 @@ class AzureClient:
|
|
|
229
229
|
request_options=request_options,
|
|
230
230
|
omit=OMIT,
|
|
231
231
|
)
|
|
232
|
-
if 200 <= _response.status_code < 300:
|
|
233
|
-
return
|
|
234
232
|
try:
|
|
233
|
+
if 200 <= _response.status_code < 300:
|
|
234
|
+
return
|
|
235
235
|
_response_json = _response.json()
|
|
236
236
|
except JSONDecodeError:
|
|
237
237
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -270,9 +270,9 @@ class AzureClient:
|
|
|
270
270
|
_response = self._client_wrapper.httpx_client.request(
|
|
271
271
|
f"api/storages/export/azure/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
272
272
|
)
|
|
273
|
-
if 200 <= _response.status_code < 300:
|
|
274
|
-
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
275
273
|
try:
|
|
274
|
+
if 200 <= _response.status_code < 300:
|
|
275
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
276
276
|
_response_json = _response.json()
|
|
277
277
|
except JSONDecodeError:
|
|
278
278
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -310,9 +310,9 @@ class AzureClient:
|
|
|
310
310
|
_response = self._client_wrapper.httpx_client.request(
|
|
311
311
|
f"api/storages/export/azure/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
312
312
|
)
|
|
313
|
-
if 200 <= _response.status_code < 300:
|
|
314
|
-
return
|
|
315
313
|
try:
|
|
314
|
+
if 200 <= _response.status_code < 300:
|
|
315
|
+
return
|
|
316
316
|
_response_json = _response.json()
|
|
317
317
|
except JSONDecodeError:
|
|
318
318
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -401,9 +401,9 @@ class AzureClient:
|
|
|
401
401
|
request_options=request_options,
|
|
402
402
|
omit=OMIT,
|
|
403
403
|
)
|
|
404
|
-
if 200 <= _response.status_code < 300:
|
|
405
|
-
return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
|
|
406
404
|
try:
|
|
405
|
+
if 200 <= _response.status_code < 300:
|
|
406
|
+
return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
|
|
407
407
|
_response_json = _response.json()
|
|
408
408
|
except JSONDecodeError:
|
|
409
409
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -443,9 +443,9 @@ class AzureClient:
|
|
|
443
443
|
_response = self._client_wrapper.httpx_client.request(
|
|
444
444
|
f"api/storages/export/azure/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
|
|
445
445
|
)
|
|
446
|
-
if 200 <= _response.status_code < 300:
|
|
447
|
-
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
448
446
|
try:
|
|
447
|
+
if 200 <= _response.status_code < 300:
|
|
448
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
449
449
|
_response_json = _response.json()
|
|
450
450
|
except JSONDecodeError:
|
|
451
451
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -491,9 +491,9 @@ class AsyncAzureClient:
|
|
|
491
491
|
_response = await self._client_wrapper.httpx_client.request(
|
|
492
492
|
"api/storages/export/azure", method="GET", params={"project": project}, request_options=request_options
|
|
493
493
|
)
|
|
494
|
-
if 200 <= _response.status_code < 300:
|
|
495
|
-
return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
|
|
496
494
|
try:
|
|
495
|
+
if 200 <= _response.status_code < 300:
|
|
496
|
+
return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
|
|
497
497
|
_response_json = _response.json()
|
|
498
498
|
except JSONDecodeError:
|
|
499
499
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -578,9 +578,9 @@ class AsyncAzureClient:
|
|
|
578
578
|
request_options=request_options,
|
|
579
579
|
omit=OMIT,
|
|
580
580
|
)
|
|
581
|
-
if 200 <= _response.status_code < 300:
|
|
582
|
-
return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
|
|
583
581
|
try:
|
|
582
|
+
if 200 <= _response.status_code < 300:
|
|
583
|
+
return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
|
|
584
584
|
_response_json = _response.json()
|
|
585
585
|
except JSONDecodeError:
|
|
586
586
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -665,9 +665,9 @@ class AsyncAzureClient:
|
|
|
665
665
|
request_options=request_options,
|
|
666
666
|
omit=OMIT,
|
|
667
667
|
)
|
|
668
|
-
if 200 <= _response.status_code < 300:
|
|
669
|
-
return
|
|
670
668
|
try:
|
|
669
|
+
if 200 <= _response.status_code < 300:
|
|
670
|
+
return
|
|
671
671
|
_response_json = _response.json()
|
|
672
672
|
except JSONDecodeError:
|
|
673
673
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -706,9 +706,9 @@ class AsyncAzureClient:
|
|
|
706
706
|
_response = await self._client_wrapper.httpx_client.request(
|
|
707
707
|
f"api/storages/export/azure/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
708
708
|
)
|
|
709
|
-
if 200 <= _response.status_code < 300:
|
|
710
|
-
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
711
709
|
try:
|
|
710
|
+
if 200 <= _response.status_code < 300:
|
|
711
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
712
712
|
_response_json = _response.json()
|
|
713
713
|
except JSONDecodeError:
|
|
714
714
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -746,9 +746,9 @@ class AsyncAzureClient:
|
|
|
746
746
|
_response = await self._client_wrapper.httpx_client.request(
|
|
747
747
|
f"api/storages/export/azure/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
748
748
|
)
|
|
749
|
-
if 200 <= _response.status_code < 300:
|
|
750
|
-
return
|
|
751
749
|
try:
|
|
750
|
+
if 200 <= _response.status_code < 300:
|
|
751
|
+
return
|
|
752
752
|
_response_json = _response.json()
|
|
753
753
|
except JSONDecodeError:
|
|
754
754
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -837,9 +837,9 @@ class AsyncAzureClient:
|
|
|
837
837
|
request_options=request_options,
|
|
838
838
|
omit=OMIT,
|
|
839
839
|
)
|
|
840
|
-
if 200 <= _response.status_code < 300:
|
|
841
|
-
return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
|
|
842
840
|
try:
|
|
841
|
+
if 200 <= _response.status_code < 300:
|
|
842
|
+
return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
|
|
843
843
|
_response_json = _response.json()
|
|
844
844
|
except JSONDecodeError:
|
|
845
845
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -879,9 +879,9 @@ class AsyncAzureClient:
|
|
|
879
879
|
_response = await self._client_wrapper.httpx_client.request(
|
|
880
880
|
f"api/storages/export/azure/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
|
|
881
881
|
)
|
|
882
|
-
if 200 <= _response.status_code < 300:
|
|
883
|
-
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
884
882
|
try:
|
|
883
|
+
if 200 <= _response.status_code < 300:
|
|
884
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
885
885
|
_response_json = _response.json()
|
|
886
886
|
except JSONDecodeError:
|
|
887
887
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -12,6 +12,7 @@ from .gcs.client import AsyncGcsClient, GcsClient
|
|
|
12
12
|
from .local.client import AsyncLocalClient, LocalClient
|
|
13
13
|
from .redis.client import AsyncRedisClient, RedisClient
|
|
14
14
|
from .s3.client import AsyncS3Client, S3Client
|
|
15
|
+
from .s3s.client import AsyncS3SClient, S3SClient
|
|
15
16
|
from .types.export_storage_list_types_response_item import ExportStorageListTypesResponseItem
|
|
16
17
|
|
|
17
18
|
|
|
@@ -23,6 +24,7 @@ class ExportStorageClient:
|
|
|
23
24
|
self.local = LocalClient(client_wrapper=self._client_wrapper)
|
|
24
25
|
self.redis = RedisClient(client_wrapper=self._client_wrapper)
|
|
25
26
|
self.s3 = S3Client(client_wrapper=self._client_wrapper)
|
|
27
|
+
self.s3s = S3SClient(client_wrapper=self._client_wrapper)
|
|
26
28
|
|
|
27
29
|
def list_types(
|
|
28
30
|
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
@@ -52,9 +54,9 @@ class ExportStorageClient:
|
|
|
52
54
|
_response = self._client_wrapper.httpx_client.request(
|
|
53
55
|
"api/storages/export/types", method="GET", request_options=request_options
|
|
54
56
|
)
|
|
55
|
-
if 200 <= _response.status_code < 300:
|
|
56
|
-
return pydantic_v1.parse_obj_as(typing.List[ExportStorageListTypesResponseItem], _response.json()) # type: ignore
|
|
57
57
|
try:
|
|
58
|
+
if 200 <= _response.status_code < 300:
|
|
59
|
+
return pydantic_v1.parse_obj_as(typing.List[ExportStorageListTypesResponseItem], _response.json()) # type: ignore
|
|
58
60
|
_response_json = _response.json()
|
|
59
61
|
except JSONDecodeError:
|
|
60
62
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -69,6 +71,7 @@ class AsyncExportStorageClient:
|
|
|
69
71
|
self.local = AsyncLocalClient(client_wrapper=self._client_wrapper)
|
|
70
72
|
self.redis = AsyncRedisClient(client_wrapper=self._client_wrapper)
|
|
71
73
|
self.s3 = AsyncS3Client(client_wrapper=self._client_wrapper)
|
|
74
|
+
self.s3s = AsyncS3SClient(client_wrapper=self._client_wrapper)
|
|
72
75
|
|
|
73
76
|
async def list_types(
|
|
74
77
|
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
@@ -98,9 +101,9 @@ class AsyncExportStorageClient:
|
|
|
98
101
|
_response = await self._client_wrapper.httpx_client.request(
|
|
99
102
|
"api/storages/export/types", method="GET", request_options=request_options
|
|
100
103
|
)
|
|
101
|
-
if 200 <= _response.status_code < 300:
|
|
102
|
-
return pydantic_v1.parse_obj_as(typing.List[ExportStorageListTypesResponseItem], _response.json()) # type: ignore
|
|
103
104
|
try:
|
|
105
|
+
if 200 <= _response.status_code < 300:
|
|
106
|
+
return pydantic_v1.parse_obj_as(typing.List[ExportStorageListTypesResponseItem], _response.json()) # type: ignore
|
|
104
107
|
_response_json = _response.json()
|
|
105
108
|
except JSONDecodeError:
|
|
106
109
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|