spitch 1.38.0__tar.gz → 1.40.0__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.
Potentially problematic release.
This version of spitch might be problematic. Click here for more details.
- spitch-1.40.0/.release-please-manifest.json +3 -0
- {spitch-1.38.0 → spitch-1.40.0}/CHANGELOG.md +21 -0
- {spitch-1.38.0 → spitch-1.40.0}/PKG-INFO +1 -1
- {spitch-1.38.0 → spitch-1.40.0}/api.md +15 -2
- {spitch-1.38.0 → spitch-1.40.0}/pyproject.toml +5 -1
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_client.py +9 -1
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_version.py +1 -1
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/resources/__init__.py +14 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/resources/files.py +114 -17
- spitch-1.40.0/src/spitch/resources/jobs.py +271 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/resources/speech.py +6 -2
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/resources/text.py +16 -3
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/__init__.py +3 -1
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/file.py +2 -1
- spitch-1.40.0/src/spitch/types/job.py +19 -0
- spitch-1.40.0/src/spitch/types/job_list_params.py +16 -0
- spitch-1.40.0/src/spitch/types/jobs.py +14 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/text_translate_params.py +8 -1
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/translation.py +5 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/api_resources/test_files.py +6 -7
- spitch-1.40.0/tests/api_resources/test_jobs.py +169 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/api_resources/test_text.py +22 -4
- spitch-1.38.0/.release-please-manifest.json +0 -3
- spitch-1.38.0/src/spitch/types/file_delete_response.py +0 -11
- {spitch-1.38.0 → spitch-1.40.0}/.gitignore +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/CONTRIBUTING.md +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/LICENSE +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/README.md +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/SECURITY.md +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/bin/check-release-environment +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/bin/publish-pypi +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/examples/.keep +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/examples/example.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/noxfile.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/release-please-config.json +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/requirements-dev.lock +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/requirements.lock +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/__init__.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_base_client.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_compat.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_constants.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_exceptions.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_files.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_models.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_qs.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_resource.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_response.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_streaming.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_types.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/__init__.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_compat.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_datetime_parse.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_logs.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_proxy.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_reflection.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_resources_proxy.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_streams.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_sync.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_transform.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_typing.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/_utils/_utils.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/lib/.keep +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/pagination.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/py.typed +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/diacritics.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/file_download_params.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/file_download_response.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/file_list_params.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/file_upload_params.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/file_usage.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/files.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/speech_generate_params.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/speech_transcribe_params.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/text_tone_mark_params.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/src/spitch/types/transcription.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/__init__.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/api_resources/__init__.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/api_resources/test_speech.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/conftest.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/sample_file.txt +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_client.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_deepcopy.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_extract_files.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_files.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_models.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_qs.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_required_args.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_response.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_streaming.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_transform.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_utils/test_proxy.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/test_utils/test_typing.py +0 -0
- {spitch-1.38.0 → spitch-1.40.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.40.0 (2025-10-16)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.39.0...v1.40.0](https://github.com/spi-tch/spitch-python/compare/v1.39.0...v1.40.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([578dbb8](https://github.com/spi-tch/spitch-python/commit/578dbb81d604d24899f6687fe6dd2a32a923ac15))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
|
|
14
|
+
* **internal:** detect missing future annotations with ruff ([36529fc](https://github.com/spi-tch/spitch-python/commit/36529fcafde8b0aa37800296b6b27b4f8fbe7984))
|
|
15
|
+
|
|
16
|
+
## 1.39.0 (2025-10-07)
|
|
17
|
+
|
|
18
|
+
Full Changelog: [v1.38.0...v1.39.0](https://github.com/spi-tch/spitch-python/compare/v1.38.0...v1.39.0)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **api:** manual updates ([c02e088](https://github.com/spi-tch/spitch-python/commit/c02e088c99193debbbea6d29f648dfe5435a6585))
|
|
23
|
+
|
|
3
24
|
## 1.38.0 (2025-10-06)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v1.37.1...v1.38.0](https://github.com/spi-tch/spitch-python/compare/v1.37.1...v1.38.0)
|
|
@@ -29,14 +29,27 @@ Methods:
|
|
|
29
29
|
Types:
|
|
30
30
|
|
|
31
31
|
```python
|
|
32
|
-
from spitch.types import File, FileUsage, Files,
|
|
32
|
+
from spitch.types import File, FileUsage, Files, FileDownloadResponse
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Methods:
|
|
36
36
|
|
|
37
37
|
- <code title="get /v1/files">client.files.<a href="./src/spitch/resources/files.py">list</a>(\*\*<a href="src/spitch/types/file_list_params.py">params</a>) -> <a href="./src/spitch/types/file.py">SyncFilesCursor[File]</a></code>
|
|
38
|
-
- <code title="delete /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">delete</a>(file_id) ->
|
|
38
|
+
- <code title="delete /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">delete</a>(file_id) -> object</code>
|
|
39
39
|
- <code title="get /v1/files/{file_id}/url">client.files.<a href="./src/spitch/resources/files.py">download</a>(file_id, \*\*<a href="src/spitch/types/file_download_params.py">params</a>) -> <a href="./src/spitch/types/file_download_response.py">FileDownloadResponse</a></code>
|
|
40
40
|
- <code title="get /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">get</a>(file_id) -> <a href="./src/spitch/types/file.py">File</a></code>
|
|
41
41
|
- <code title="post /v1/files">client.files.<a href="./src/spitch/resources/files.py">upload</a>(\*\*<a href="src/spitch/types/file_upload_params.py">params</a>) -> <a href="./src/spitch/types/file.py">File</a></code>
|
|
42
42
|
- <code title="get /v1/files:usage">client.files.<a href="./src/spitch/resources/files.py">usage</a>() -> <a href="./src/spitch/types/file_usage.py">FileUsage</a></code>
|
|
43
|
+
|
|
44
|
+
# Jobs
|
|
45
|
+
|
|
46
|
+
Types:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from spitch.types import Job, Jobs
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Methods:
|
|
53
|
+
|
|
54
|
+
- <code title="get /v1/jobs">client.jobs.<a href="./src/spitch/resources/jobs.py">list</a>(\*\*<a href="src/spitch/types/job_list_params.py">params</a>) -> <a href="./src/spitch/types/job.py">SyncFilesCursor[Job]</a></code>
|
|
55
|
+
- <code title="get /v1/jobs/{job_id}">client.jobs.<a href="./src/spitch/resources/jobs.py">get</a>(job_id) -> <a href="./src/spitch/types/job.py">Job</a></code>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "spitch"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.40.0"
|
|
4
4
|
description = "The official Python library for the spitch API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -225,6 +225,8 @@ select = [
|
|
|
225
225
|
"B",
|
|
226
226
|
# remove unused imports
|
|
227
227
|
"F401",
|
|
228
|
+
# check for missing future annotations
|
|
229
|
+
"FA102",
|
|
228
230
|
# bare except statements
|
|
229
231
|
"E722",
|
|
230
232
|
# unused arguments
|
|
@@ -247,6 +249,8 @@ unfixable = [
|
|
|
247
249
|
"T203",
|
|
248
250
|
]
|
|
249
251
|
|
|
252
|
+
extend-safe-fixes = ["FA102"]
|
|
253
|
+
|
|
250
254
|
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
251
255
|
"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"
|
|
252
256
|
|
|
@@ -21,7 +21,7 @@ from ._types import (
|
|
|
21
21
|
)
|
|
22
22
|
from ._utils import is_given, get_async_library
|
|
23
23
|
from ._version import __version__
|
|
24
|
-
from .resources import text, files, speech
|
|
24
|
+
from .resources import jobs, text, files, speech
|
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
26
26
|
from ._exceptions import SpitchError, APIStatusError
|
|
27
27
|
from ._base_client import (
|
|
@@ -47,6 +47,7 @@ class Spitch(SyncAPIClient):
|
|
|
47
47
|
speech: speech.SpeechResource
|
|
48
48
|
text: text.TextResource
|
|
49
49
|
files: files.FilesResource
|
|
50
|
+
jobs: jobs.JobsResource
|
|
50
51
|
with_raw_response: SpitchWithRawResponse
|
|
51
52
|
with_streaming_response: SpitchWithStreamedResponse
|
|
52
53
|
|
|
@@ -107,6 +108,7 @@ class Spitch(SyncAPIClient):
|
|
|
107
108
|
self.speech = speech.SpeechResource(self)
|
|
108
109
|
self.text = text.TextResource(self)
|
|
109
110
|
self.files = files.FilesResource(self)
|
|
111
|
+
self.jobs = jobs.JobsResource(self)
|
|
110
112
|
self.with_raw_response = SpitchWithRawResponse(self)
|
|
111
113
|
self.with_streaming_response = SpitchWithStreamedResponse(self)
|
|
112
114
|
|
|
@@ -219,6 +221,7 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
219
221
|
speech: speech.AsyncSpeechResource
|
|
220
222
|
text: text.AsyncTextResource
|
|
221
223
|
files: files.AsyncFilesResource
|
|
224
|
+
jobs: jobs.AsyncJobsResource
|
|
222
225
|
with_raw_response: AsyncSpitchWithRawResponse
|
|
223
226
|
with_streaming_response: AsyncSpitchWithStreamedResponse
|
|
224
227
|
|
|
@@ -279,6 +282,7 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
279
282
|
self.speech = speech.AsyncSpeechResource(self)
|
|
280
283
|
self.text = text.AsyncTextResource(self)
|
|
281
284
|
self.files = files.AsyncFilesResource(self)
|
|
285
|
+
self.jobs = jobs.AsyncJobsResource(self)
|
|
282
286
|
self.with_raw_response = AsyncSpitchWithRawResponse(self)
|
|
283
287
|
self.with_streaming_response = AsyncSpitchWithStreamedResponse(self)
|
|
284
288
|
|
|
@@ -392,6 +396,7 @@ class SpitchWithRawResponse:
|
|
|
392
396
|
self.speech = speech.SpeechResourceWithRawResponse(client.speech)
|
|
393
397
|
self.text = text.TextResourceWithRawResponse(client.text)
|
|
394
398
|
self.files = files.FilesResourceWithRawResponse(client.files)
|
|
399
|
+
self.jobs = jobs.JobsResourceWithRawResponse(client.jobs)
|
|
395
400
|
|
|
396
401
|
|
|
397
402
|
class AsyncSpitchWithRawResponse:
|
|
@@ -399,6 +404,7 @@ class AsyncSpitchWithRawResponse:
|
|
|
399
404
|
self.speech = speech.AsyncSpeechResourceWithRawResponse(client.speech)
|
|
400
405
|
self.text = text.AsyncTextResourceWithRawResponse(client.text)
|
|
401
406
|
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
|
|
407
|
+
self.jobs = jobs.AsyncJobsResourceWithRawResponse(client.jobs)
|
|
402
408
|
|
|
403
409
|
|
|
404
410
|
class SpitchWithStreamedResponse:
|
|
@@ -406,6 +412,7 @@ class SpitchWithStreamedResponse:
|
|
|
406
412
|
self.speech = speech.SpeechResourceWithStreamingResponse(client.speech)
|
|
407
413
|
self.text = text.TextResourceWithStreamingResponse(client.text)
|
|
408
414
|
self.files = files.FilesResourceWithStreamingResponse(client.files)
|
|
415
|
+
self.jobs = jobs.JobsResourceWithStreamingResponse(client.jobs)
|
|
409
416
|
|
|
410
417
|
|
|
411
418
|
class AsyncSpitchWithStreamedResponse:
|
|
@@ -413,6 +420,7 @@ class AsyncSpitchWithStreamedResponse:
|
|
|
413
420
|
self.speech = speech.AsyncSpeechResourceWithStreamingResponse(client.speech)
|
|
414
421
|
self.text = text.AsyncTextResourceWithStreamingResponse(client.text)
|
|
415
422
|
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
|
|
423
|
+
self.jobs = jobs.AsyncJobsResourceWithStreamingResponse(client.jobs)
|
|
416
424
|
|
|
417
425
|
|
|
418
426
|
Client = Spitch
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .jobs import (
|
|
4
|
+
JobsResource,
|
|
5
|
+
AsyncJobsResource,
|
|
6
|
+
JobsResourceWithRawResponse,
|
|
7
|
+
AsyncJobsResourceWithRawResponse,
|
|
8
|
+
JobsResourceWithStreamingResponse,
|
|
9
|
+
AsyncJobsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .text import (
|
|
4
12
|
TextResource,
|
|
5
13
|
AsyncTextResource,
|
|
@@ -44,4 +52,10 @@ __all__ = [
|
|
|
44
52
|
"AsyncFilesResourceWithRawResponse",
|
|
45
53
|
"FilesResourceWithStreamingResponse",
|
|
46
54
|
"AsyncFilesResourceWithStreamingResponse",
|
|
55
|
+
"JobsResource",
|
|
56
|
+
"AsyncJobsResource",
|
|
57
|
+
"JobsResourceWithRawResponse",
|
|
58
|
+
"AsyncJobsResourceWithRawResponse",
|
|
59
|
+
"JobsResourceWithStreamingResponse",
|
|
60
|
+
"AsyncJobsResourceWithStreamingResponse",
|
|
47
61
|
]
|
|
@@ -22,7 +22,6 @@ from ..pagination import SyncFilesCursor, AsyncFilesCursor
|
|
|
22
22
|
from ..types.file import File
|
|
23
23
|
from .._base_client import AsyncPaginator, make_request_options
|
|
24
24
|
from ..types.file_usage import FileUsage
|
|
25
|
-
from ..types.file_delete_response import FileDeleteResponse
|
|
26
25
|
from ..types.file_download_response import FileDownloadResponse
|
|
27
26
|
|
|
28
27
|
__all__ = ["FilesResource", "AsyncFilesResource"]
|
|
@@ -62,7 +61,16 @@ class FilesResource(SyncAPIResource):
|
|
|
62
61
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
63
62
|
) -> SyncFilesCursor[File]:
|
|
64
63
|
"""
|
|
65
|
-
Get
|
|
64
|
+
Get a paginated list of files for the authenticated organization.
|
|
65
|
+
|
|
66
|
+
Args: identity: Authentication identity containing org_id and user_id limit:
|
|
67
|
+
Maximum number of files to return (max 100) status: Optional filter by file
|
|
68
|
+
status (processing, ready, etc.) cursor: Optional pagination cursor for getting
|
|
69
|
+
next page db: Database session
|
|
70
|
+
|
|
71
|
+
Returns: ListFilesResponse: Paginated list of files with metadata
|
|
72
|
+
|
|
73
|
+
Raises: HTTPException: 400 if cursor is invalid
|
|
66
74
|
|
|
67
75
|
Args:
|
|
68
76
|
extra_headers: Send extra headers
|
|
@@ -103,9 +111,16 @@ class FilesResource(SyncAPIResource):
|
|
|
103
111
|
extra_query: Query | None = None,
|
|
104
112
|
extra_body: Body | None = None,
|
|
105
113
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
106
|
-
) ->
|
|
114
|
+
) -> object:
|
|
107
115
|
"""
|
|
108
|
-
Delete
|
|
116
|
+
Delete a file and its associated S3 object.
|
|
117
|
+
|
|
118
|
+
Args: file_id: UUID of the file to delete identity: Authentication identity
|
|
119
|
+
containing org_id db: Database session s3: S3 session for deleting objects
|
|
120
|
+
|
|
121
|
+
Returns: dict: Success confirmation
|
|
122
|
+
|
|
123
|
+
Raises: HTTPException: 404 if file not found or doesn't belong to org
|
|
109
124
|
|
|
110
125
|
Args:
|
|
111
126
|
extra_headers: Send extra headers
|
|
@@ -123,7 +138,7 @@ class FilesResource(SyncAPIResource):
|
|
|
123
138
|
options=make_request_options(
|
|
124
139
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
125
140
|
),
|
|
126
|
-
cast_to=
|
|
141
|
+
cast_to=object,
|
|
127
142
|
)
|
|
128
143
|
|
|
129
144
|
def download(
|
|
@@ -139,7 +154,17 @@ class FilesResource(SyncAPIResource):
|
|
|
139
154
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
140
155
|
) -> FileDownloadResponse:
|
|
141
156
|
"""
|
|
142
|
-
|
|
157
|
+
Generate a pre-signed download URL for a file.
|
|
158
|
+
|
|
159
|
+
Args: file_id: UUID of the file to download identity: Authentication identity
|
|
160
|
+
containing org_id ttl: Time-to-live for the download URL in seconds (60-3600)
|
|
161
|
+
db: Database session s3: S3 session for generating pre-signed URLs
|
|
162
|
+
|
|
163
|
+
Returns: FileDownloadResponse: Contains file_id, download URL, and expiration
|
|
164
|
+
time
|
|
165
|
+
|
|
166
|
+
Raises: HTTPException: 404 if file not found, doesn't belong to org, or not
|
|
167
|
+
ready
|
|
143
168
|
|
|
144
169
|
Args:
|
|
145
170
|
extra_headers: Send extra headers
|
|
@@ -176,7 +201,15 @@ class FilesResource(SyncAPIResource):
|
|
|
176
201
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
177
202
|
) -> File:
|
|
178
203
|
"""
|
|
179
|
-
Get
|
|
204
|
+
Get metadata for a specific file.
|
|
205
|
+
|
|
206
|
+
Args: file_id: UUID of the file to retrieve identity: Authentication identity
|
|
207
|
+
containing org_id db: Database session
|
|
208
|
+
|
|
209
|
+
Returns: FileMetaResponse: File metadata including upload information
|
|
210
|
+
|
|
211
|
+
Raises: HTTPException: 404 if file not found or doesn't belong to org
|
|
212
|
+
HTTPException: 500 if uploader information is corrupted
|
|
180
213
|
|
|
181
214
|
Args:
|
|
182
215
|
extra_headers: Send extra headers
|
|
@@ -209,7 +242,14 @@ class FilesResource(SyncAPIResource):
|
|
|
209
242
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
210
243
|
) -> File:
|
|
211
244
|
"""
|
|
212
|
-
Upload
|
|
245
|
+
Upload a file to the Spitch server.
|
|
246
|
+
|
|
247
|
+
Args: file: The file to upload from the request identity: Authentication
|
|
248
|
+
identity containing org_id and user_id db: Database session
|
|
249
|
+
|
|
250
|
+
Returns: FileMetaResponse: Metadata for the uploaded file
|
|
251
|
+
|
|
252
|
+
Raises: HTTPException: 500 if upload fails
|
|
213
253
|
|
|
214
254
|
Args:
|
|
215
255
|
extra_headers: Send extra headers
|
|
@@ -246,7 +286,15 @@ class FilesResource(SyncAPIResource):
|
|
|
246
286
|
extra_body: Body | None = None,
|
|
247
287
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
248
288
|
) -> FileUsage:
|
|
249
|
-
"""
|
|
289
|
+
"""
|
|
290
|
+
Get storage usage statistics for the authenticated organization.
|
|
291
|
+
|
|
292
|
+
Args: identity: Authentication identity containing org_id db: Database session
|
|
293
|
+
|
|
294
|
+
Returns: FileUsage: Usage statistics including total/used bytes and file count
|
|
295
|
+
|
|
296
|
+
Raises: HTTPException: 500 if unable to calculate usage
|
|
297
|
+
"""
|
|
250
298
|
return self._get(
|
|
251
299
|
"/v1/files:usage",
|
|
252
300
|
options=make_request_options(
|
|
@@ -290,7 +338,16 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
290
338
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
291
339
|
) -> AsyncPaginator[File, AsyncFilesCursor[File]]:
|
|
292
340
|
"""
|
|
293
|
-
Get
|
|
341
|
+
Get a paginated list of files for the authenticated organization.
|
|
342
|
+
|
|
343
|
+
Args: identity: Authentication identity containing org_id and user_id limit:
|
|
344
|
+
Maximum number of files to return (max 100) status: Optional filter by file
|
|
345
|
+
status (processing, ready, etc.) cursor: Optional pagination cursor for getting
|
|
346
|
+
next page db: Database session
|
|
347
|
+
|
|
348
|
+
Returns: ListFilesResponse: Paginated list of files with metadata
|
|
349
|
+
|
|
350
|
+
Raises: HTTPException: 400 if cursor is invalid
|
|
294
351
|
|
|
295
352
|
Args:
|
|
296
353
|
extra_headers: Send extra headers
|
|
@@ -331,9 +388,16 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
331
388
|
extra_query: Query | None = None,
|
|
332
389
|
extra_body: Body | None = None,
|
|
333
390
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
334
|
-
) ->
|
|
391
|
+
) -> object:
|
|
335
392
|
"""
|
|
336
|
-
Delete
|
|
393
|
+
Delete a file and its associated S3 object.
|
|
394
|
+
|
|
395
|
+
Args: file_id: UUID of the file to delete identity: Authentication identity
|
|
396
|
+
containing org_id db: Database session s3: S3 session for deleting objects
|
|
397
|
+
|
|
398
|
+
Returns: dict: Success confirmation
|
|
399
|
+
|
|
400
|
+
Raises: HTTPException: 404 if file not found or doesn't belong to org
|
|
337
401
|
|
|
338
402
|
Args:
|
|
339
403
|
extra_headers: Send extra headers
|
|
@@ -351,7 +415,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
351
415
|
options=make_request_options(
|
|
352
416
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
353
417
|
),
|
|
354
|
-
cast_to=
|
|
418
|
+
cast_to=object,
|
|
355
419
|
)
|
|
356
420
|
|
|
357
421
|
async def download(
|
|
@@ -367,7 +431,17 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
367
431
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
368
432
|
) -> FileDownloadResponse:
|
|
369
433
|
"""
|
|
370
|
-
|
|
434
|
+
Generate a pre-signed download URL for a file.
|
|
435
|
+
|
|
436
|
+
Args: file_id: UUID of the file to download identity: Authentication identity
|
|
437
|
+
containing org_id ttl: Time-to-live for the download URL in seconds (60-3600)
|
|
438
|
+
db: Database session s3: S3 session for generating pre-signed URLs
|
|
439
|
+
|
|
440
|
+
Returns: FileDownloadResponse: Contains file_id, download URL, and expiration
|
|
441
|
+
time
|
|
442
|
+
|
|
443
|
+
Raises: HTTPException: 404 if file not found, doesn't belong to org, or not
|
|
444
|
+
ready
|
|
371
445
|
|
|
372
446
|
Args:
|
|
373
447
|
extra_headers: Send extra headers
|
|
@@ -404,7 +478,15 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
404
478
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
405
479
|
) -> File:
|
|
406
480
|
"""
|
|
407
|
-
Get
|
|
481
|
+
Get metadata for a specific file.
|
|
482
|
+
|
|
483
|
+
Args: file_id: UUID of the file to retrieve identity: Authentication identity
|
|
484
|
+
containing org_id db: Database session
|
|
485
|
+
|
|
486
|
+
Returns: FileMetaResponse: File metadata including upload information
|
|
487
|
+
|
|
488
|
+
Raises: HTTPException: 404 if file not found or doesn't belong to org
|
|
489
|
+
HTTPException: 500 if uploader information is corrupted
|
|
408
490
|
|
|
409
491
|
Args:
|
|
410
492
|
extra_headers: Send extra headers
|
|
@@ -437,7 +519,14 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
437
519
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
438
520
|
) -> File:
|
|
439
521
|
"""
|
|
440
|
-
Upload
|
|
522
|
+
Upload a file to the Spitch server.
|
|
523
|
+
|
|
524
|
+
Args: file: The file to upload from the request identity: Authentication
|
|
525
|
+
identity containing org_id and user_id db: Database session
|
|
526
|
+
|
|
527
|
+
Returns: FileMetaResponse: Metadata for the uploaded file
|
|
528
|
+
|
|
529
|
+
Raises: HTTPException: 500 if upload fails
|
|
441
530
|
|
|
442
531
|
Args:
|
|
443
532
|
extra_headers: Send extra headers
|
|
@@ -474,7 +563,15 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
474
563
|
extra_body: Body | None = None,
|
|
475
564
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
476
565
|
) -> FileUsage:
|
|
477
|
-
"""
|
|
566
|
+
"""
|
|
567
|
+
Get storage usage statistics for the authenticated organization.
|
|
568
|
+
|
|
569
|
+
Args: identity: Authentication identity containing org_id db: Database session
|
|
570
|
+
|
|
571
|
+
Returns: FileUsage: Usage statistics including total/used bytes and file count
|
|
572
|
+
|
|
573
|
+
Raises: HTTPException: 500 if unable to calculate usage
|
|
574
|
+
"""
|
|
478
575
|
return await self._get(
|
|
479
576
|
"/v1/files:usage",
|
|
480
577
|
options=make_request_options(
|