spitch 1.39.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.

Files changed (93) hide show
  1. spitch-1.40.0/.release-please-manifest.json +3 -0
  2. {spitch-1.39.0 → spitch-1.40.0}/CHANGELOG.md +13 -0
  3. {spitch-1.39.0 → spitch-1.40.0}/PKG-INFO +1 -1
  4. {spitch-1.39.0 → spitch-1.40.0}/api.md +13 -0
  5. {spitch-1.39.0 → spitch-1.40.0}/pyproject.toml +5 -1
  6. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_client.py +9 -1
  7. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_version.py +1 -1
  8. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/resources/__init__.py +14 -0
  9. spitch-1.40.0/src/spitch/resources/jobs.py +271 -0
  10. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/__init__.py +3 -0
  11. spitch-1.40.0/src/spitch/types/job.py +19 -0
  12. spitch-1.40.0/src/spitch/types/job_list_params.py +16 -0
  13. spitch-1.40.0/src/spitch/types/jobs.py +14 -0
  14. spitch-1.40.0/tests/api_resources/test_jobs.py +169 -0
  15. spitch-1.39.0/.release-please-manifest.json +0 -3
  16. {spitch-1.39.0 → spitch-1.40.0}/.gitignore +0 -0
  17. {spitch-1.39.0 → spitch-1.40.0}/CONTRIBUTING.md +0 -0
  18. {spitch-1.39.0 → spitch-1.40.0}/LICENSE +0 -0
  19. {spitch-1.39.0 → spitch-1.40.0}/README.md +0 -0
  20. {spitch-1.39.0 → spitch-1.40.0}/SECURITY.md +0 -0
  21. {spitch-1.39.0 → spitch-1.40.0}/bin/check-release-environment +0 -0
  22. {spitch-1.39.0 → spitch-1.40.0}/bin/publish-pypi +0 -0
  23. {spitch-1.39.0 → spitch-1.40.0}/examples/.keep +0 -0
  24. {spitch-1.39.0 → spitch-1.40.0}/examples/example.py +0 -0
  25. {spitch-1.39.0 → spitch-1.40.0}/noxfile.py +0 -0
  26. {spitch-1.39.0 → spitch-1.40.0}/release-please-config.json +0 -0
  27. {spitch-1.39.0 → spitch-1.40.0}/requirements-dev.lock +0 -0
  28. {spitch-1.39.0 → spitch-1.40.0}/requirements.lock +0 -0
  29. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/__init__.py +0 -0
  30. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_base_client.py +0 -0
  31. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_compat.py +0 -0
  32. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_constants.py +0 -0
  33. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_exceptions.py +0 -0
  34. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_files.py +0 -0
  35. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_models.py +0 -0
  36. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_qs.py +0 -0
  37. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_resource.py +0 -0
  38. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_response.py +0 -0
  39. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_streaming.py +0 -0
  40. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_types.py +0 -0
  41. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/__init__.py +0 -0
  42. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_compat.py +0 -0
  43. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_datetime_parse.py +0 -0
  44. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_logs.py +0 -0
  45. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_proxy.py +0 -0
  46. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_reflection.py +0 -0
  47. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_resources_proxy.py +0 -0
  48. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_streams.py +0 -0
  49. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_sync.py +0 -0
  50. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_transform.py +0 -0
  51. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_typing.py +0 -0
  52. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/_utils/_utils.py +0 -0
  53. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/lib/.keep +0 -0
  54. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/pagination.py +0 -0
  55. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/py.typed +0 -0
  56. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/resources/files.py +0 -0
  57. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/resources/speech.py +0 -0
  58. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/resources/text.py +0 -0
  59. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/diacritics.py +0 -0
  60. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/file.py +0 -0
  61. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/file_download_params.py +0 -0
  62. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/file_download_response.py +0 -0
  63. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/file_list_params.py +0 -0
  64. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/file_upload_params.py +0 -0
  65. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/file_usage.py +0 -0
  66. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/files.py +0 -0
  67. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/speech_generate_params.py +0 -0
  68. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/speech_transcribe_params.py +0 -0
  69. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  70. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/text_translate_params.py +0 -0
  71. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/transcription.py +0 -0
  72. {spitch-1.39.0 → spitch-1.40.0}/src/spitch/types/translation.py +0 -0
  73. {spitch-1.39.0 → spitch-1.40.0}/tests/__init__.py +0 -0
  74. {spitch-1.39.0 → spitch-1.40.0}/tests/api_resources/__init__.py +0 -0
  75. {spitch-1.39.0 → spitch-1.40.0}/tests/api_resources/test_files.py +0 -0
  76. {spitch-1.39.0 → spitch-1.40.0}/tests/api_resources/test_speech.py +0 -0
  77. {spitch-1.39.0 → spitch-1.40.0}/tests/api_resources/test_text.py +0 -0
  78. {spitch-1.39.0 → spitch-1.40.0}/tests/conftest.py +0 -0
  79. {spitch-1.39.0 → spitch-1.40.0}/tests/sample_file.txt +0 -0
  80. {spitch-1.39.0 → spitch-1.40.0}/tests/test_client.py +0 -0
  81. {spitch-1.39.0 → spitch-1.40.0}/tests/test_deepcopy.py +0 -0
  82. {spitch-1.39.0 → spitch-1.40.0}/tests/test_extract_files.py +0 -0
  83. {spitch-1.39.0 → spitch-1.40.0}/tests/test_files.py +0 -0
  84. {spitch-1.39.0 → spitch-1.40.0}/tests/test_models.py +0 -0
  85. {spitch-1.39.0 → spitch-1.40.0}/tests/test_qs.py +0 -0
  86. {spitch-1.39.0 → spitch-1.40.0}/tests/test_required_args.py +0 -0
  87. {spitch-1.39.0 → spitch-1.40.0}/tests/test_response.py +0 -0
  88. {spitch-1.39.0 → spitch-1.40.0}/tests/test_streaming.py +0 -0
  89. {spitch-1.39.0 → spitch-1.40.0}/tests/test_transform.py +0 -0
  90. {spitch-1.39.0 → spitch-1.40.0}/tests/test_utils/test_datetime_parse.py +0 -0
  91. {spitch-1.39.0 → spitch-1.40.0}/tests/test_utils/test_proxy.py +0 -0
  92. {spitch-1.39.0 → spitch-1.40.0}/tests/test_utils/test_typing.py +0 -0
  93. {spitch-1.39.0 → spitch-1.40.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.40.0"
3
+ }
@@ -1,5 +1,18 @@
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
+
3
16
  ## 1.39.0 (2025-10-07)
4
17
 
5
18
  Full Changelog: [v1.38.0...v1.39.0](https://github.com/spi-tch/spitch-python/compare/v1.38.0...v1.39.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.39.0
3
+ Version: 1.40.0
4
4
  Summary: The official Python library for the spitch API
5
5
  Project-URL: Homepage, https://github.com/spi-tch/spitch-python
6
6
  Project-URL: Repository, https://github.com/spi-tch/spitch-python
@@ -40,3 +40,16 @@ Methods:
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.39.0"
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,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "spitch"
4
- __version__ = "1.39.0" # x-release-please-version
4
+ __version__ = "1.40.0" # x-release-please-version
@@ -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
  ]
@@ -0,0 +1,271 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..types import job_list_params
11
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
12
+ from .._utils import maybe_transform
13
+ from .._compat import cached_property
14
+ from .._resource import SyncAPIResource, AsyncAPIResource
15
+ from .._response import (
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ async_to_streamed_response_wrapper,
20
+ )
21
+ from ..types.job import Job
22
+ from ..pagination import SyncFilesCursor, AsyncFilesCursor
23
+ from .._base_client import AsyncPaginator, make_request_options
24
+
25
+ __all__ = ["JobsResource", "AsyncJobsResource"]
26
+
27
+
28
+ class JobsResource(SyncAPIResource):
29
+ @cached_property
30
+ def with_raw_response(self) -> JobsResourceWithRawResponse:
31
+ """
32
+ This property can be used as a prefix for any HTTP method call to return
33
+ the raw response object instead of the parsed content.
34
+
35
+ For more information, see https://www.github.com/spi-tch/spitch-python#accessing-raw-response-data-eg-headers
36
+ """
37
+ return JobsResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> JobsResourceWithStreamingResponse:
41
+ """
42
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
+
44
+ For more information, see https://www.github.com/spi-tch/spitch-python#with_streaming_response
45
+ """
46
+ return JobsResourceWithStreamingResponse(self)
47
+
48
+ def list(
49
+ self,
50
+ *,
51
+ cursor: Optional[str] | Omit = omit,
52
+ limit: int | Omit = omit,
53
+ status: Optional[Literal["queued", "in_progress", "finished"]] | Omit = omit,
54
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
+ # The extra values given here take precedence over values defined on the client or passed to this method.
56
+ extra_headers: Headers | None = None,
57
+ extra_query: Query | None = None,
58
+ extra_body: Body | None = None,
59
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
60
+ ) -> SyncFilesCursor[Job]:
61
+ """
62
+ Get Jobs
63
+
64
+ Args:
65
+ extra_headers: Send extra headers
66
+
67
+ extra_query: Add additional query parameters to the request
68
+
69
+ extra_body: Add additional JSON properties to the request
70
+
71
+ timeout: Override the client-level default timeout for this request, in seconds
72
+ """
73
+ return self._get_api_list(
74
+ "/v1/jobs",
75
+ page=SyncFilesCursor[Job],
76
+ options=make_request_options(
77
+ extra_headers=extra_headers,
78
+ extra_query=extra_query,
79
+ extra_body=extra_body,
80
+ timeout=timeout,
81
+ query=maybe_transform(
82
+ {
83
+ "cursor": cursor,
84
+ "limit": limit,
85
+ "status": status,
86
+ },
87
+ job_list_params.JobListParams,
88
+ ),
89
+ ),
90
+ model=Job,
91
+ )
92
+
93
+ def get(
94
+ self,
95
+ job_id: str,
96
+ *,
97
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
98
+ # The extra values given here take precedence over values defined on the client or passed to this method.
99
+ extra_headers: Headers | None = None,
100
+ extra_query: Query | None = None,
101
+ extra_body: Body | None = None,
102
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
103
+ ) -> Job:
104
+ """
105
+ Get Job
106
+
107
+ Args:
108
+ extra_headers: Send extra headers
109
+
110
+ extra_query: Add additional query parameters to the request
111
+
112
+ extra_body: Add additional JSON properties to the request
113
+
114
+ timeout: Override the client-level default timeout for this request, in seconds
115
+ """
116
+ if not job_id:
117
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
118
+ return self._get(
119
+ f"/v1/jobs/{job_id}",
120
+ options=make_request_options(
121
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
122
+ ),
123
+ cast_to=Job,
124
+ )
125
+
126
+
127
+ class AsyncJobsResource(AsyncAPIResource):
128
+ @cached_property
129
+ def with_raw_response(self) -> AsyncJobsResourceWithRawResponse:
130
+ """
131
+ This property can be used as a prefix for any HTTP method call to return
132
+ the raw response object instead of the parsed content.
133
+
134
+ For more information, see https://www.github.com/spi-tch/spitch-python#accessing-raw-response-data-eg-headers
135
+ """
136
+ return AsyncJobsResourceWithRawResponse(self)
137
+
138
+ @cached_property
139
+ def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse:
140
+ """
141
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
142
+
143
+ For more information, see https://www.github.com/spi-tch/spitch-python#with_streaming_response
144
+ """
145
+ return AsyncJobsResourceWithStreamingResponse(self)
146
+
147
+ def list(
148
+ self,
149
+ *,
150
+ cursor: Optional[str] | Omit = omit,
151
+ limit: int | Omit = omit,
152
+ status: Optional[Literal["queued", "in_progress", "finished"]] | Omit = omit,
153
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
154
+ # The extra values given here take precedence over values defined on the client or passed to this method.
155
+ extra_headers: Headers | None = None,
156
+ extra_query: Query | None = None,
157
+ extra_body: Body | None = None,
158
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
159
+ ) -> AsyncPaginator[Job, AsyncFilesCursor[Job]]:
160
+ """
161
+ Get Jobs
162
+
163
+ Args:
164
+ extra_headers: Send extra headers
165
+
166
+ extra_query: Add additional query parameters to the request
167
+
168
+ extra_body: Add additional JSON properties to the request
169
+
170
+ timeout: Override the client-level default timeout for this request, in seconds
171
+ """
172
+ return self._get_api_list(
173
+ "/v1/jobs",
174
+ page=AsyncFilesCursor[Job],
175
+ options=make_request_options(
176
+ extra_headers=extra_headers,
177
+ extra_query=extra_query,
178
+ extra_body=extra_body,
179
+ timeout=timeout,
180
+ query=maybe_transform(
181
+ {
182
+ "cursor": cursor,
183
+ "limit": limit,
184
+ "status": status,
185
+ },
186
+ job_list_params.JobListParams,
187
+ ),
188
+ ),
189
+ model=Job,
190
+ )
191
+
192
+ async def get(
193
+ self,
194
+ job_id: str,
195
+ *,
196
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
197
+ # The extra values given here take precedence over values defined on the client or passed to this method.
198
+ extra_headers: Headers | None = None,
199
+ extra_query: Query | None = None,
200
+ extra_body: Body | None = None,
201
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
202
+ ) -> Job:
203
+ """
204
+ Get Job
205
+
206
+ Args:
207
+ extra_headers: Send extra headers
208
+
209
+ extra_query: Add additional query parameters to the request
210
+
211
+ extra_body: Add additional JSON properties to the request
212
+
213
+ timeout: Override the client-level default timeout for this request, in seconds
214
+ """
215
+ if not job_id:
216
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
217
+ return await self._get(
218
+ f"/v1/jobs/{job_id}",
219
+ options=make_request_options(
220
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
221
+ ),
222
+ cast_to=Job,
223
+ )
224
+
225
+
226
+ class JobsResourceWithRawResponse:
227
+ def __init__(self, jobs: JobsResource) -> None:
228
+ self._jobs = jobs
229
+
230
+ self.list = to_raw_response_wrapper(
231
+ jobs.list,
232
+ )
233
+ self.get = to_raw_response_wrapper(
234
+ jobs.get,
235
+ )
236
+
237
+
238
+ class AsyncJobsResourceWithRawResponse:
239
+ def __init__(self, jobs: AsyncJobsResource) -> None:
240
+ self._jobs = jobs
241
+
242
+ self.list = async_to_raw_response_wrapper(
243
+ jobs.list,
244
+ )
245
+ self.get = async_to_raw_response_wrapper(
246
+ jobs.get,
247
+ )
248
+
249
+
250
+ class JobsResourceWithStreamingResponse:
251
+ def __init__(self, jobs: JobsResource) -> None:
252
+ self._jobs = jobs
253
+
254
+ self.list = to_streamed_response_wrapper(
255
+ jobs.list,
256
+ )
257
+ self.get = to_streamed_response_wrapper(
258
+ jobs.get,
259
+ )
260
+
261
+
262
+ class AsyncJobsResourceWithStreamingResponse:
263
+ def __init__(self, jobs: AsyncJobsResource) -> None:
264
+ self._jobs = jobs
265
+
266
+ self.list = async_to_streamed_response_wrapper(
267
+ jobs.list,
268
+ )
269
+ self.get = async_to_streamed_response_wrapper(
270
+ jobs.get,
271
+ )
@@ -2,12 +2,15 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from .job import Job as Job
5
6
  from .file import File as File
7
+ from .jobs import Jobs as Jobs
6
8
  from .files import Files as Files
7
9
  from .diacritics import Diacritics as Diacritics
8
10
  from .file_usage import FileUsage as FileUsage
9
11
  from .translation import Translation as Translation
10
12
  from .transcription import Transcription as Transcription
13
+ from .job_list_params import JobListParams as JobListParams
11
14
  from .file_list_params import FileListParams as FileListParams
12
15
  from .file_upload_params import FileUploadParams as FileUploadParams
13
16
  from .file_download_params import FileDownloadParams as FileDownloadParams
@@ -0,0 +1,19 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from datetime import datetime
4
+
5
+ from .._models import BaseModel
6
+
7
+ __all__ = ["Job"]
8
+
9
+
10
+ class Job(BaseModel):
11
+ created_by: str
12
+
13
+ due_date: datetime
14
+
15
+ job_id: str
16
+
17
+ org_id: str
18
+
19
+ status: str
@@ -0,0 +1,16 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, TypedDict
7
+
8
+ __all__ = ["JobListParams"]
9
+
10
+
11
+ class JobListParams(TypedDict, total=False):
12
+ cursor: Optional[str]
13
+
14
+ limit: int
15
+
16
+ status: Optional[Literal["queued", "in_progress", "finished"]]
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+
5
+ from .job import Job
6
+ from .._models import BaseModel
7
+
8
+ __all__ = ["Jobs"]
9
+
10
+
11
+ class Jobs(BaseModel):
12
+ items: List[Job]
13
+
14
+ next_cursor: Optional[str] = None
@@ -0,0 +1,169 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from typing import Any, cast
7
+
8
+ import pytest
9
+
10
+ from spitch import Spitch, AsyncSpitch
11
+ from tests.utils import assert_matches_type
12
+ from spitch.types import Job
13
+ from spitch.pagination import SyncFilesCursor, AsyncFilesCursor
14
+
15
+ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
16
+
17
+
18
+ class TestJobs:
19
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
20
+
21
+ @parametrize
22
+ def test_method_list(self, client: Spitch) -> None:
23
+ job = client.jobs.list()
24
+ assert_matches_type(SyncFilesCursor[Job], job, path=["response"])
25
+
26
+ @parametrize
27
+ def test_method_list_with_all_params(self, client: Spitch) -> None:
28
+ job = client.jobs.list(
29
+ cursor="cursor",
30
+ limit=99,
31
+ status="queued",
32
+ )
33
+ assert_matches_type(SyncFilesCursor[Job], job, path=["response"])
34
+
35
+ @parametrize
36
+ def test_raw_response_list(self, client: Spitch) -> None:
37
+ response = client.jobs.with_raw_response.list()
38
+
39
+ assert response.is_closed is True
40
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
41
+ job = response.parse()
42
+ assert_matches_type(SyncFilesCursor[Job], job, path=["response"])
43
+
44
+ @parametrize
45
+ def test_streaming_response_list(self, client: Spitch) -> None:
46
+ with client.jobs.with_streaming_response.list() as response:
47
+ assert not response.is_closed
48
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
49
+
50
+ job = response.parse()
51
+ assert_matches_type(SyncFilesCursor[Job], job, path=["response"])
52
+
53
+ assert cast(Any, response.is_closed) is True
54
+
55
+ @parametrize
56
+ def test_method_get(self, client: Spitch) -> None:
57
+ job = client.jobs.get(
58
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
59
+ )
60
+ assert_matches_type(Job, job, path=["response"])
61
+
62
+ @parametrize
63
+ def test_raw_response_get(self, client: Spitch) -> None:
64
+ response = client.jobs.with_raw_response.get(
65
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
66
+ )
67
+
68
+ assert response.is_closed is True
69
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
70
+ job = response.parse()
71
+ assert_matches_type(Job, job, path=["response"])
72
+
73
+ @parametrize
74
+ def test_streaming_response_get(self, client: Spitch) -> None:
75
+ with client.jobs.with_streaming_response.get(
76
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
77
+ ) as response:
78
+ assert not response.is_closed
79
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
80
+
81
+ job = response.parse()
82
+ assert_matches_type(Job, job, path=["response"])
83
+
84
+ assert cast(Any, response.is_closed) is True
85
+
86
+ @parametrize
87
+ def test_path_params_get(self, client: Spitch) -> None:
88
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"):
89
+ client.jobs.with_raw_response.get(
90
+ "",
91
+ )
92
+
93
+
94
+ class TestAsyncJobs:
95
+ parametrize = pytest.mark.parametrize(
96
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
97
+ )
98
+
99
+ @parametrize
100
+ async def test_method_list(self, async_client: AsyncSpitch) -> None:
101
+ job = await async_client.jobs.list()
102
+ assert_matches_type(AsyncFilesCursor[Job], job, path=["response"])
103
+
104
+ @parametrize
105
+ async def test_method_list_with_all_params(self, async_client: AsyncSpitch) -> None:
106
+ job = await async_client.jobs.list(
107
+ cursor="cursor",
108
+ limit=99,
109
+ status="queued",
110
+ )
111
+ assert_matches_type(AsyncFilesCursor[Job], job, path=["response"])
112
+
113
+ @parametrize
114
+ async def test_raw_response_list(self, async_client: AsyncSpitch) -> None:
115
+ response = await async_client.jobs.with_raw_response.list()
116
+
117
+ assert response.is_closed is True
118
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
119
+ job = await response.parse()
120
+ assert_matches_type(AsyncFilesCursor[Job], job, path=["response"])
121
+
122
+ @parametrize
123
+ async def test_streaming_response_list(self, async_client: AsyncSpitch) -> None:
124
+ async with async_client.jobs.with_streaming_response.list() as response:
125
+ assert not response.is_closed
126
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
127
+
128
+ job = await response.parse()
129
+ assert_matches_type(AsyncFilesCursor[Job], job, path=["response"])
130
+
131
+ assert cast(Any, response.is_closed) is True
132
+
133
+ @parametrize
134
+ async def test_method_get(self, async_client: AsyncSpitch) -> None:
135
+ job = await async_client.jobs.get(
136
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
137
+ )
138
+ assert_matches_type(Job, job, path=["response"])
139
+
140
+ @parametrize
141
+ async def test_raw_response_get(self, async_client: AsyncSpitch) -> None:
142
+ response = await async_client.jobs.with_raw_response.get(
143
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
144
+ )
145
+
146
+ assert response.is_closed is True
147
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
148
+ job = await response.parse()
149
+ assert_matches_type(Job, job, path=["response"])
150
+
151
+ @parametrize
152
+ async def test_streaming_response_get(self, async_client: AsyncSpitch) -> None:
153
+ async with async_client.jobs.with_streaming_response.get(
154
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
155
+ ) as response:
156
+ assert not response.is_closed
157
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
158
+
159
+ job = await response.parse()
160
+ assert_matches_type(Job, job, path=["response"])
161
+
162
+ assert cast(Any, response.is_closed) is True
163
+
164
+ @parametrize
165
+ async def test_path_params_get(self, async_client: AsyncSpitch) -> None:
166
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"):
167
+ await async_client.jobs.with_raw_response.get(
168
+ "",
169
+ )
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.39.0"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes