-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathclient.py
More file actions
300 lines (233 loc) · 9.62 KB
/
client.py
File metadata and controls
300 lines (233 loc) · 9.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# This file was auto-generated by Fern from our API Definition.
from __future__ import annotations
import typing
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from .raw_client import AsyncRawImportStorageClient, RawImportStorageClient
from .types.list_types_import_storage_response_item import ListTypesImportStorageResponseItem
if typing.TYPE_CHECKING:
from .azure.client import AsyncAzureClient, AzureClient
from .azure_spi.client import AsyncAzureSpiClient, AzureSpiClient
from .databricks.client import AsyncDatabricksClient, DatabricksClient
from .gcs.client import AsyncGcsClient, GcsClient
from .gcs_sa.client import AsyncGcsSaClient, GcsSaClient
from .gcswif.client import AsyncGcswifClient, GcswifClient
from .local.client import AsyncLocalClient, LocalClient
from .redis.client import AsyncRedisClient, RedisClient
from .s3.client import AsyncS3Client, S3Client
from .s3s.client import AsyncS3SClient, S3SClient
class ImportStorageClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._raw_client = RawImportStorageClient(client_wrapper=client_wrapper)
self._client_wrapper = client_wrapper
self._azure: typing.Optional[AzureClient] = None
self._azure_spi: typing.Optional[AzureSpiClient] = None
self._databricks: typing.Optional[DatabricksClient] = None
self._gcs: typing.Optional[GcsClient] = None
self._gcs_sa: typing.Optional[GcsSaClient] = None
self._gcswif: typing.Optional[GcswifClient] = None
self._local: typing.Optional[LocalClient] = None
self._redis: typing.Optional[RedisClient] = None
self._s3: typing.Optional[S3Client] = None
self._s3s: typing.Optional[S3SClient] = None
@property
def with_raw_response(self) -> RawImportStorageClient:
"""
Retrieves a raw implementation of this client that returns raw responses.
Returns
-------
RawImportStorageClient
"""
return self._raw_client
def list_types(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[ListTypesImportStorageResponseItem]:
"""
Retrieve a list of the import storages types.
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[ListTypesImportStorageResponseItem]
List of import storage types
Examples
--------
from label_studio_sdk import LabelStudio
client = LabelStudio(
api_key="YOUR_API_KEY",
)
client.import_storage.list_types()
"""
_response = self._raw_client.list_types(request_options=request_options)
return _response.data
@property
def azure(self):
if self._azure is None:
from .azure.client import AzureClient # noqa: E402
self._azure = AzureClient(client_wrapper=self._client_wrapper)
return self._azure
@property
def azure_spi(self):
if self._azure_spi is None:
from .azure_spi.client import AzureSpiClient # noqa: E402
self._azure_spi = AzureSpiClient(client_wrapper=self._client_wrapper)
return self._azure_spi
@property
def databricks(self):
if self._databricks is None:
from .databricks.client import DatabricksClient # noqa: E402
self._databricks = DatabricksClient(client_wrapper=self._client_wrapper)
return self._databricks
@property
def gcs(self):
if self._gcs is None:
from .gcs.client import GcsClient # noqa: E402
self._gcs = GcsClient(client_wrapper=self._client_wrapper)
return self._gcs
@property
def gcs_sa(self):
if self._gcs_sa is None:
from .gcs_sa.client import GcsSaClient # noqa: E402
self._gcs_sa = GcsSaClient(client_wrapper=self._client_wrapper)
return self._gcs_sa
@property
def gcswif(self):
if self._gcswif is None:
from .gcswif.client import GcswifClient # noqa: E402
self._gcswif = GcswifClient(client_wrapper=self._client_wrapper)
return self._gcswif
@property
def local(self):
if self._local is None:
from .local.client import LocalClient # noqa: E402
self._local = LocalClient(client_wrapper=self._client_wrapper)
return self._local
@property
def redis(self):
if self._redis is None:
from .redis.client import RedisClient # noqa: E402
self._redis = RedisClient(client_wrapper=self._client_wrapper)
return self._redis
@property
def s3(self):
if self._s3 is None:
from .s3.client import S3Client # noqa: E402
self._s3 = S3Client(client_wrapper=self._client_wrapper)
return self._s3
@property
def s3s(self):
if self._s3s is None:
from .s3s.client import S3SClient # noqa: E402
self._s3s = S3SClient(client_wrapper=self._client_wrapper)
return self._s3s
class AsyncImportStorageClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._raw_client = AsyncRawImportStorageClient(client_wrapper=client_wrapper)
self._client_wrapper = client_wrapper
self._azure: typing.Optional[AsyncAzureClient] = None
self._azure_spi: typing.Optional[AsyncAzureSpiClient] = None
self._databricks: typing.Optional[AsyncDatabricksClient] = None
self._gcs: typing.Optional[AsyncGcsClient] = None
self._gcs_sa: typing.Optional[AsyncGcsSaClient] = None
self._gcswif: typing.Optional[AsyncGcswifClient] = None
self._local: typing.Optional[AsyncLocalClient] = None
self._redis: typing.Optional[AsyncRedisClient] = None
self._s3: typing.Optional[AsyncS3Client] = None
self._s3s: typing.Optional[AsyncS3SClient] = None
@property
def with_raw_response(self) -> AsyncRawImportStorageClient:
"""
Retrieves a raw implementation of this client that returns raw responses.
Returns
-------
AsyncRawImportStorageClient
"""
return self._raw_client
async def list_types(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[ListTypesImportStorageResponseItem]:
"""
Retrieve a list of the import storages types.
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[ListTypesImportStorageResponseItem]
List of import storage types
Examples
--------
import asyncio
from label_studio_sdk import AsyncLabelStudio
client = AsyncLabelStudio(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.import_storage.list_types()
asyncio.run(main())
"""
_response = await self._raw_client.list_types(request_options=request_options)
return _response.data
@property
def azure(self):
if self._azure is None:
from .azure.client import AsyncAzureClient # noqa: E402
self._azure = AsyncAzureClient(client_wrapper=self._client_wrapper)
return self._azure
@property
def azure_spi(self):
if self._azure_spi is None:
from .azure_spi.client import AsyncAzureSpiClient # noqa: E402
self._azure_spi = AsyncAzureSpiClient(client_wrapper=self._client_wrapper)
return self._azure_spi
@property
def databricks(self):
if self._databricks is None:
from .databricks.client import AsyncDatabricksClient # noqa: E402
self._databricks = AsyncDatabricksClient(client_wrapper=self._client_wrapper)
return self._databricks
@property
def gcs(self):
if self._gcs is None:
from .gcs.client import AsyncGcsClient # noqa: E402
self._gcs = AsyncGcsClient(client_wrapper=self._client_wrapper)
return self._gcs
@property
def gcs_sa(self):
if self._gcs_sa is None:
from .gcs_sa.client import AsyncGcsSaClient # noqa: E402
self._gcs_sa = AsyncGcsSaClient(client_wrapper=self._client_wrapper)
return self._gcs_sa
@property
def gcswif(self):
if self._gcswif is None:
from .gcswif.client import AsyncGcswifClient # noqa: E402
self._gcswif = AsyncGcswifClient(client_wrapper=self._client_wrapper)
return self._gcswif
@property
def local(self):
if self._local is None:
from .local.client import AsyncLocalClient # noqa: E402
self._local = AsyncLocalClient(client_wrapper=self._client_wrapper)
return self._local
@property
def redis(self):
if self._redis is None:
from .redis.client import AsyncRedisClient # noqa: E402
self._redis = AsyncRedisClient(client_wrapper=self._client_wrapper)
return self._redis
@property
def s3(self):
if self._s3 is None:
from .s3.client import AsyncS3Client # noqa: E402
self._s3 = AsyncS3Client(client_wrapper=self._client_wrapper)
return self._s3
@property
def s3s(self):
if self._s3s is None:
from .s3s.client import AsyncS3SClient # noqa: E402
self._s3s = AsyncS3SClient(client_wrapper=self._client_wrapper)
return self._s3s