mlops-python-sdk 0.0.1__tar.gz → 1.0.1__tar.gz

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.
Files changed (52) hide show
  1. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/PKG-INFO +21 -30
  2. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/README.md +20 -29
  3. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/__init__.py +3 -3
  4. mlops_python_sdk-1.0.1/mlops/api/client/api/storage/get_storage_presign_download.py +175 -0
  5. mlops_python_sdk-1.0.1/mlops/api/client/api/storage/get_storage_presign_upload.py +175 -0
  6. mlops_python_sdk-1.0.1/mlops/api/client/api/tasks/__init__.py +1 -0
  7. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/api/tasks/cancel_task.py +14 -14
  8. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/api/tasks/delete_task.py +14 -14
  9. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/api/tasks/get_task.py +15 -15
  10. mlops_python_sdk-1.0.1/mlops/api/client/api/tasks/get_task_by_task_id.py +204 -0
  11. mlops_python_sdk-1.0.1/mlops/api/client/api/tasks/get_task_logs.py +300 -0
  12. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/api/tasks/list_tasks.py +14 -14
  13. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/__init__.py +22 -0
  14. mlops_python_sdk-1.0.1/mlops/api/client/models/get_storage_presign_download_response_200.py +60 -0
  15. mlops_python_sdk-1.0.1/mlops/api/client/models/get_storage_presign_upload_response_200.py +79 -0
  16. mlops_python_sdk-1.0.1/mlops/api/client/models/get_task_logs_direction.py +9 -0
  17. mlops_python_sdk-1.0.1/mlops/api/client/models/get_task_logs_log_type.py +10 -0
  18. mlops_python_sdk-1.0.1/mlops/api/client/models/job_spec.py +273 -0
  19. mlops_python_sdk-1.0.1/mlops/api/client/models/job_spec_env.py +44 -0
  20. mlops_python_sdk-1.0.1/mlops/api/client/models/job_spec_master_strategy.py +8 -0
  21. mlops_python_sdk-1.0.1/mlops/api/client/models/log_pagination.py +90 -0
  22. mlops_python_sdk-1.0.1/mlops/api/client/models/task_log_entry.py +105 -0
  23. mlops_python_sdk-1.0.1/mlops/api/client/models/task_log_entry_log_type.py +9 -0
  24. mlops_python_sdk-1.0.1/mlops/api/client/models/task_logs_response.py +112 -0
  25. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_submit_request.py +24 -6
  26. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/connection_config.py +4 -11
  27. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/exceptions.py +10 -10
  28. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/task/__init__.py +1 -1
  29. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/task/client.py +11 -35
  30. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/task/task.py +186 -40
  31. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/pyproject.toml +1 -1
  32. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/__init__.py +0 -0
  33. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/api/__init__.py +0 -0
  34. {mlops_python_sdk-0.0.1/mlops/api/client/api/tasks → mlops_python_sdk-1.0.1/mlops/api/client/api/storage}/__init__.py +0 -0
  35. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/api/tasks/submit_task.py +0 -0
  36. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/client.py +0 -0
  37. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/errors.py +0 -0
  38. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/error_response.py +0 -0
  39. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/message_response.py +0 -0
  40. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task.py +0 -0
  41. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_alloc_tres_type_0.py +0 -0
  42. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_gres_detail_type_0_item.py +0 -0
  43. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_job_resources_type_0.py +0 -0
  44. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_list_response.py +0 -0
  45. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_resources_type_0.py +0 -0
  46. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_status.py +0 -0
  47. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_submit_request_environment_type_0.py +0 -0
  48. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_submit_response.py +0 -0
  49. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_tres_type_0.py +0 -0
  50. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/models/task_tres_used_type_0.py +0 -0
  51. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/py.typed +0 -0
  52. {mlops_python_sdk-0.0.1 → mlops_python_sdk-1.0.1}/mlops/api/client/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mlops-python-sdk
3
- Version: 0.0.1
3
+ Version: 1.0.1
4
4
  Summary: MLOps Python SDK for XCloud Service API
5
5
  License: MIT
6
6
  Author: mlops
@@ -25,7 +25,7 @@ Description-Content-Type: text/markdown
25
25
 
26
26
  # MLOps Python SDK
27
27
 
28
- [MLOps](https://mlops.cloud) Python SDK for XCloud Service API. Manage and execute tasks with confidence.
28
+ [MLOps](https://xcloud-service.com) Python SDK for XCloud Service API. Manage and execute tasks with confidence.
29
29
 
30
30
  ## Installation
31
31
 
@@ -39,9 +39,9 @@ pip install mlops-python-sdk
39
39
 
40
40
  ### 1. Setup Authentication
41
41
 
42
- You can authenticate using either an API Key or an Access Token.
42
+ You can authenticate using either an API Key.
43
43
 
44
- #### Option 1: API Key (Recommended for programmatic access)
44
+ #### API Key (Recommended for programmatic access)
45
45
 
46
46
  1. Sign up at [MLOps](https://xcloud-service.com)
47
47
  2. Create an API key from [API Keys](https://xcloud-service.com/home/api-keys)
@@ -52,18 +52,11 @@ export MLOPS_API_KEY=xck_******
52
52
  export MLOPS_DOMAIN=localhost:8090 # optional, default is localhost:8090
53
53
  ```
54
54
 
55
- #### Option 2: Access Token (For user authentication)
56
-
57
- ```bash
58
- export MLOPS_ACCESS_TOKEN=your_access_token
59
- export MLOPS_DOMAIN=localhost:8090 # optional
60
- ```
61
-
62
55
  ### 2. Basic Usage
63
56
 
64
57
  ```python
65
- from client import Task, ConnectionConfig
66
- from client.api.client.models.task_status import TaskStatus
58
+ from mlops import Task, ConnectionConfig
59
+ from mlops.api.client.models.task_status import TaskStatus
67
60
 
68
61
  # Initialize Task client (uses environment variables by default)
69
62
  task = Task()
@@ -119,7 +112,7 @@ The `Task` class provides a high-level interface for managing tasks.
119
112
  #### Initialization
120
113
 
121
114
  ```python
122
- from client import Task, ConnectionConfig
115
+ from mlops import Task, ConnectionConfig
123
116
 
124
117
  # Using environment variables
125
118
  task = Task()
@@ -127,7 +120,6 @@ task = Task()
127
120
  # With explicit configuration
128
121
  config = ConnectionConfig(
129
122
  api_key="xck_******", # API key for authentication
130
- access_token="token_******", # Access token (alternative to API key)
131
123
  domain="localhost:8090", # API domain
132
124
  debug=False, # Enable debug mode
133
125
  request_timeout=30.0 # Request timeout in seconds
@@ -222,7 +214,7 @@ tasks = task.list(
222
214
  **Example:**
223
215
 
224
216
  ```python
225
- from client.api.client.models.task_status import TaskStatus
217
+ from mlops.api.client.models.task_status import TaskStatus
226
218
 
227
219
  # List all running tasks
228
220
  running_tasks = task.list(status=TaskStatus.RUNNING)
@@ -261,7 +253,7 @@ task.cancel(task_id=12345, cluster_id=1)
261
253
  Task status values for filtering:
262
254
 
263
255
  ```python
264
- from client.api.client.models.task_status import TaskStatus
256
+ from mlops.api.client.models.task_status import TaskStatus
265
257
 
266
258
  TaskStatus.PENDING # Task is pending
267
259
  TaskStatus.QUEUED # Task is queued
@@ -280,7 +272,6 @@ TaskStatus.CREATED # Task was created
280
272
  The SDK reads configuration from environment variables:
281
273
 
282
274
  - `MLOPS_API_KEY`: API key for authentication
283
- - `MLOPS_ACCESS_TOKEN`: Access token for authentication (alternative to API key)
284
275
  - `MLOPS_DOMAIN`: API domain (default: `localhost:8090`)
285
276
  - `MLOPS_DEBUG`: Enable debug mode (`true`/`false`, default: `false`)
286
277
  - `MLOPS_API_PATH`: API path prefix (default: `/api/v1`)
@@ -290,7 +281,7 @@ The SDK reads configuration from environment variables:
290
281
  You can also configure the connection programmatically:
291
282
 
292
283
  ```python
293
- from client import ConnectionConfig
284
+ from mlops import ConnectionConfig
294
285
 
295
286
  config = ConnectionConfig(
296
287
  domain="api.example.com",
@@ -306,7 +297,7 @@ config = ConnectionConfig(
306
297
  The SDK provides specific exception types:
307
298
 
308
299
  ```python
309
- from client.exceptions import (
300
+ from mlops.exceptions import (
310
301
  APIException, # General API errors
311
302
  AuthenticationException, # Authentication failures
312
303
  NotFoundException, # Resource not found
@@ -330,7 +321,7 @@ except APIException as e:
330
321
  ### Submit a Machine Learning Training Job
331
322
 
332
323
  ```python
333
- from client import Task
324
+ from mlops import Task
334
325
 
335
326
  task = Task()
336
327
 
@@ -339,16 +330,16 @@ result = task.submit(
339
330
  cluster_id=1,
340
331
  script="""#!/bin/bash
341
332
  #SBATCH --gres=gpu:1
342
- #SBATCH --cpus-per-task=8
343
- #SBATCH --mem=32GB
333
+ #SBATCH --cpus-per-task=2
334
+ #SBATCH --mem=4GB
344
335
 
345
336
  python train.py --config config.yaml
346
337
  """,
347
338
  resources={
348
- "cpus_per_task": 8,
349
- "memory": "32GB",
339
+ "cpus_per_task": 2,
340
+ "memory": "4GB",
350
341
  "gres": "gpu:1",
351
- "time": "4-00:00:00", # 4 days
342
+ "time": "1-00:00:00", # 1 days
352
343
  "partition": "gpu"
353
344
  }
354
345
  )
@@ -359,8 +350,8 @@ print(f"Training job submitted: {result.job_id}")
359
350
  ### Monitor Task Status
360
351
 
361
352
  ```python
362
- from client import Task
363
- from client.api.client.models.task_status import TaskStatus
353
+ from mlops import Task
354
+ from mlops.api.client.models.task_status import TaskStatus
364
355
  import time
365
356
 
366
357
  task = Task()
@@ -380,8 +371,8 @@ while True:
380
371
  ### List and Filter Tasks
381
372
 
382
373
  ```python
383
- from client import Task
384
- from client.api.client.models.task_status import TaskStatus
374
+ from mlops import Task
375
+ from mlops.api.client.models.task_status import TaskStatus
385
376
 
386
377
  task = Task()
387
378
 
@@ -1,6 +1,6 @@
1
1
  # MLOps Python SDK
2
2
 
3
- [MLOps](https://mlops.cloud) Python SDK for XCloud Service API. Manage and execute tasks with confidence.
3
+ [MLOps](https://xcloud-service.com) Python SDK for XCloud Service API. Manage and execute tasks with confidence.
4
4
 
5
5
  ## Installation
6
6
 
@@ -14,9 +14,9 @@ pip install mlops-python-sdk
14
14
 
15
15
  ### 1. Setup Authentication
16
16
 
17
- You can authenticate using either an API Key or an Access Token.
17
+ You can authenticate using either an API Key.
18
18
 
19
- #### Option 1: API Key (Recommended for programmatic access)
19
+ #### API Key (Recommended for programmatic access)
20
20
 
21
21
  1. Sign up at [MLOps](https://xcloud-service.com)
22
22
  2. Create an API key from [API Keys](https://xcloud-service.com/home/api-keys)
@@ -27,18 +27,11 @@ export MLOPS_API_KEY=xck_******
27
27
  export MLOPS_DOMAIN=localhost:8090 # optional, default is localhost:8090
28
28
  ```
29
29
 
30
- #### Option 2: Access Token (For user authentication)
31
-
32
- ```bash
33
- export MLOPS_ACCESS_TOKEN=your_access_token
34
- export MLOPS_DOMAIN=localhost:8090 # optional
35
- ```
36
-
37
30
  ### 2. Basic Usage
38
31
 
39
32
  ```python
40
- from client import Task, ConnectionConfig
41
- from client.api.client.models.task_status import TaskStatus
33
+ from mlops import Task, ConnectionConfig
34
+ from mlops.api.client.models.task_status import TaskStatus
42
35
 
43
36
  # Initialize Task client (uses environment variables by default)
44
37
  task = Task()
@@ -94,7 +87,7 @@ The `Task` class provides a high-level interface for managing tasks.
94
87
  #### Initialization
95
88
 
96
89
  ```python
97
- from client import Task, ConnectionConfig
90
+ from mlops import Task, ConnectionConfig
98
91
 
99
92
  # Using environment variables
100
93
  task = Task()
@@ -102,7 +95,6 @@ task = Task()
102
95
  # With explicit configuration
103
96
  config = ConnectionConfig(
104
97
  api_key="xck_******", # API key for authentication
105
- access_token="token_******", # Access token (alternative to API key)
106
98
  domain="localhost:8090", # API domain
107
99
  debug=False, # Enable debug mode
108
100
  request_timeout=30.0 # Request timeout in seconds
@@ -197,7 +189,7 @@ tasks = task.list(
197
189
  **Example:**
198
190
 
199
191
  ```python
200
- from client.api.client.models.task_status import TaskStatus
192
+ from mlops.api.client.models.task_status import TaskStatus
201
193
 
202
194
  # List all running tasks
203
195
  running_tasks = task.list(status=TaskStatus.RUNNING)
@@ -236,7 +228,7 @@ task.cancel(task_id=12345, cluster_id=1)
236
228
  Task status values for filtering:
237
229
 
238
230
  ```python
239
- from client.api.client.models.task_status import TaskStatus
231
+ from mlops.api.client.models.task_status import TaskStatus
240
232
 
241
233
  TaskStatus.PENDING # Task is pending
242
234
  TaskStatus.QUEUED # Task is queued
@@ -255,7 +247,6 @@ TaskStatus.CREATED # Task was created
255
247
  The SDK reads configuration from environment variables:
256
248
 
257
249
  - `MLOPS_API_KEY`: API key for authentication
258
- - `MLOPS_ACCESS_TOKEN`: Access token for authentication (alternative to API key)
259
250
  - `MLOPS_DOMAIN`: API domain (default: `localhost:8090`)
260
251
  - `MLOPS_DEBUG`: Enable debug mode (`true`/`false`, default: `false`)
261
252
  - `MLOPS_API_PATH`: API path prefix (default: `/api/v1`)
@@ -265,7 +256,7 @@ The SDK reads configuration from environment variables:
265
256
  You can also configure the connection programmatically:
266
257
 
267
258
  ```python
268
- from client import ConnectionConfig
259
+ from mlops import ConnectionConfig
269
260
 
270
261
  config = ConnectionConfig(
271
262
  domain="api.example.com",
@@ -281,7 +272,7 @@ config = ConnectionConfig(
281
272
  The SDK provides specific exception types:
282
273
 
283
274
  ```python
284
- from client.exceptions import (
275
+ from mlops.exceptions import (
285
276
  APIException, # General API errors
286
277
  AuthenticationException, # Authentication failures
287
278
  NotFoundException, # Resource not found
@@ -305,7 +296,7 @@ except APIException as e:
305
296
  ### Submit a Machine Learning Training Job
306
297
 
307
298
  ```python
308
- from client import Task
299
+ from mlops import Task
309
300
 
310
301
  task = Task()
311
302
 
@@ -314,16 +305,16 @@ result = task.submit(
314
305
  cluster_id=1,
315
306
  script="""#!/bin/bash
316
307
  #SBATCH --gres=gpu:1
317
- #SBATCH --cpus-per-task=8
318
- #SBATCH --mem=32GB
308
+ #SBATCH --cpus-per-task=2
309
+ #SBATCH --mem=4GB
319
310
 
320
311
  python train.py --config config.yaml
321
312
  """,
322
313
  resources={
323
- "cpus_per_task": 8,
324
- "memory": "32GB",
314
+ "cpus_per_task": 2,
315
+ "memory": "4GB",
325
316
  "gres": "gpu:1",
326
- "time": "4-00:00:00", # 4 days
317
+ "time": "1-00:00:00", # 1 days
327
318
  "partition": "gpu"
328
319
  }
329
320
  )
@@ -334,8 +325,8 @@ print(f"Training job submitted: {result.job_id}")
334
325
  ### Monitor Task Status
335
326
 
336
327
  ```python
337
- from client import Task
338
- from client.api.client.models.task_status import TaskStatus
328
+ from mlops import Task
329
+ from mlops.api.client.models.task_status import TaskStatus
339
330
  import time
340
331
 
341
332
  task = Task()
@@ -355,8 +346,8 @@ while True:
355
346
  ### List and Filter Tasks
356
347
 
357
348
  ```python
358
- from client import Task
359
- from client.api.client.models.task_status import TaskStatus
349
+ from mlops import Task
350
+ from mlops.api.client.models.task_status import TaskStatus
360
351
 
361
352
  task = Task()
362
353
 
@@ -1,5 +1,5 @@
1
1
  """
2
- XClient Python SDK for accessing XCloud Service API.
2
+ MLOps Python SDK for accessing MLOps API.
3
3
 
4
4
  This package provides a client library for interacting with the XCloud Service API.
5
5
  """
@@ -10,7 +10,7 @@ from .connection_config import (
10
10
  ProxyTypes,
11
11
  )
12
12
  from .exceptions import (
13
- XClientException,
13
+ MLOpsException,
14
14
  TimeoutException,
15
15
  NotFoundException,
16
16
  AuthenticationException,
@@ -29,7 +29,7 @@ __all__ = [
29
29
  "ConnectionConfig",
30
30
  "ProxyTypes",
31
31
  # Exceptions
32
- "XClientException",
32
+ "MLOpsException",
33
33
  "TimeoutException",
34
34
  "NotFoundException",
35
35
  "AuthenticationException",
@@ -0,0 +1,175 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.get_storage_presign_download_response_200 import GetStoragePresignDownloadResponse200
10
+ from ...types import UNSET, Response
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ key: str,
16
+ ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["key"] = key
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
23
+ _kwargs: dict[str, Any] = {
24
+ "method": "get",
25
+ "url": "/storage/presign_download",
26
+ "params": params,
27
+ }
28
+
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
34
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
35
+ if response.status_code == 200:
36
+ response_200 = GetStoragePresignDownloadResponse200.from_dict(response.json())
37
+
38
+ return response_200
39
+ if response.status_code == 400:
40
+ response_400 = ErrorResponse.from_dict(response.json())
41
+
42
+ return response_400
43
+ if response.status_code == 500:
44
+ response_500 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_500
47
+ if client.raise_on_unexpected_status:
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+ else:
50
+ return None
51
+
52
+
53
+ def _build_response(
54
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55
+ ) -> Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
56
+ return Response(
57
+ status_code=HTTPStatus(response.status_code),
58
+ content=response.content,
59
+ headers=response.headers,
60
+ parsed=_parse_response(client=client, response=response),
61
+ )
62
+
63
+
64
+ def sync_detailed(
65
+ *,
66
+ client: AuthenticatedClient,
67
+ key: str,
68
+ ) -> Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
69
+ """Get presigned URL for file download
70
+
71
+ Generates a presigned URL for downloading a file from S3.
72
+
73
+ Args:
74
+ key (str):
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]
82
+ """
83
+
84
+ kwargs = _get_kwargs(
85
+ key=key,
86
+ )
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ def sync(
96
+ *,
97
+ client: AuthenticatedClient,
98
+ key: str,
99
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
100
+ """Get presigned URL for file download
101
+
102
+ Generates a presigned URL for downloading a file from S3.
103
+
104
+ Args:
105
+ key (str):
106
+
107
+ Raises:
108
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
110
+
111
+ Returns:
112
+ Union[ErrorResponse, GetStoragePresignDownloadResponse200]
113
+ """
114
+
115
+ return sync_detailed(
116
+ client=client,
117
+ key=key,
118
+ ).parsed
119
+
120
+
121
+ async def asyncio_detailed(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ key: str,
125
+ ) -> Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
126
+ """Get presigned URL for file download
127
+
128
+ Generates a presigned URL for downloading a file from S3.
129
+
130
+ Args:
131
+ key (str):
132
+
133
+ Raises:
134
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
135
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
136
+
137
+ Returns:
138
+ Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]
139
+ """
140
+
141
+ kwargs = _get_kwargs(
142
+ key=key,
143
+ )
144
+
145
+ response = await client.get_async_httpx_client().request(**kwargs)
146
+
147
+ return _build_response(client=client, response=response)
148
+
149
+
150
+ async def asyncio(
151
+ *,
152
+ client: AuthenticatedClient,
153
+ key: str,
154
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
155
+ """Get presigned URL for file download
156
+
157
+ Generates a presigned URL for downloading a file from S3.
158
+
159
+ Args:
160
+ key (str):
161
+
162
+ Raises:
163
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
165
+
166
+ Returns:
167
+ Union[ErrorResponse, GetStoragePresignDownloadResponse200]
168
+ """
169
+
170
+ return (
171
+ await asyncio_detailed(
172
+ client=client,
173
+ key=key,
174
+ )
175
+ ).parsed
@@ -0,0 +1,175 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.get_storage_presign_upload_response_200 import GetStoragePresignUploadResponse200
10
+ from ...types import UNSET, Response
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ filename: str,
16
+ ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["filename"] = filename
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
23
+ _kwargs: dict[str, Any] = {
24
+ "method": "get",
25
+ "url": "/storage/presign_upload",
26
+ "params": params,
27
+ }
28
+
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
34
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
35
+ if response.status_code == 200:
36
+ response_200 = GetStoragePresignUploadResponse200.from_dict(response.json())
37
+
38
+ return response_200
39
+ if response.status_code == 400:
40
+ response_400 = ErrorResponse.from_dict(response.json())
41
+
42
+ return response_400
43
+ if response.status_code == 500:
44
+ response_500 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_500
47
+ if client.raise_on_unexpected_status:
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+ else:
50
+ return None
51
+
52
+
53
+ def _build_response(
54
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55
+ ) -> Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
56
+ return Response(
57
+ status_code=HTTPStatus(response.status_code),
58
+ content=response.content,
59
+ headers=response.headers,
60
+ parsed=_parse_response(client=client, response=response),
61
+ )
62
+
63
+
64
+ def sync_detailed(
65
+ *,
66
+ client: AuthenticatedClient,
67
+ filename: str,
68
+ ) -> Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
69
+ """Get presigned URL for file upload
70
+
71
+ Generates a presigned URL for uploading a file to S3.
72
+
73
+ Args:
74
+ filename (str):
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]
82
+ """
83
+
84
+ kwargs = _get_kwargs(
85
+ filename=filename,
86
+ )
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ def sync(
96
+ *,
97
+ client: AuthenticatedClient,
98
+ filename: str,
99
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
100
+ """Get presigned URL for file upload
101
+
102
+ Generates a presigned URL for uploading a file to S3.
103
+
104
+ Args:
105
+ filename (str):
106
+
107
+ Raises:
108
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
110
+
111
+ Returns:
112
+ Union[ErrorResponse, GetStoragePresignUploadResponse200]
113
+ """
114
+
115
+ return sync_detailed(
116
+ client=client,
117
+ filename=filename,
118
+ ).parsed
119
+
120
+
121
+ async def asyncio_detailed(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ filename: str,
125
+ ) -> Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
126
+ """Get presigned URL for file upload
127
+
128
+ Generates a presigned URL for uploading a file to S3.
129
+
130
+ Args:
131
+ filename (str):
132
+
133
+ Raises:
134
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
135
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
136
+
137
+ Returns:
138
+ Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]
139
+ """
140
+
141
+ kwargs = _get_kwargs(
142
+ filename=filename,
143
+ )
144
+
145
+ response = await client.get_async_httpx_client().request(**kwargs)
146
+
147
+ return _build_response(client=client, response=response)
148
+
149
+
150
+ async def asyncio(
151
+ *,
152
+ client: AuthenticatedClient,
153
+ filename: str,
154
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
155
+ """Get presigned URL for file upload
156
+
157
+ Generates a presigned URL for uploading a file to S3.
158
+
159
+ Args:
160
+ filename (str):
161
+
162
+ Raises:
163
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
165
+
166
+ Returns:
167
+ Union[ErrorResponse, GetStoragePresignUploadResponse200]
168
+ """
169
+
170
+ return (
171
+ await asyncio_detailed(
172
+ client=client,
173
+ filename=filename,
174
+ )
175
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""