spitch 1.38.0__py3-none-any.whl → 1.40.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of spitch might be problematic. Click here for more details.

spitch/_client.py CHANGED
@@ -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
spitch/_version.py CHANGED
@@ -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.38.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
  ]
spitch/resources/files.py CHANGED
@@ -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 Files
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
- ) -> FileDeleteResponse:
114
+ ) -> object:
107
115
  """
108
- Delete File
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=FileDeleteResponse,
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
- Download File
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 File
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 File
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
- """Get Usage"""
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 Files
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
- ) -> FileDeleteResponse:
391
+ ) -> object:
335
392
  """
336
- Delete File
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=FileDeleteResponse,
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
- Download File
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 File
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 File
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
- """Get Usage"""
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(
@@ -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
+ )
@@ -33,6 +33,8 @@ __all__ = ["SpeechResource", "AsyncSpeechResource"]
33
33
 
34
34
 
35
35
  class SpeechResource(SyncAPIResource):
36
+ """All speech-focused APIs (TTS and STT)"""
37
+
36
38
  @cached_property
37
39
  def with_raw_response(self) -> SpeechResourceWithRawResponse:
38
40
  """
@@ -102,7 +104,7 @@ class SpeechResource(SyncAPIResource):
102
104
 
103
105
  timeout: Override the client-level default timeout for this request, in seconds
104
106
  """
105
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
107
+ extra_headers = {"Accept": "audio/*", **(extra_headers or {})}
106
108
  return self._post(
107
109
  "/v1/speech",
108
110
  body=maybe_transform(
@@ -176,6 +178,8 @@ class SpeechResource(SyncAPIResource):
176
178
 
177
179
 
178
180
  class AsyncSpeechResource(AsyncAPIResource):
181
+ """All speech-focused APIs (TTS and STT)"""
182
+
179
183
  @cached_property
180
184
  def with_raw_response(self) -> AsyncSpeechResourceWithRawResponse:
181
185
  """
@@ -245,7 +249,7 @@ class AsyncSpeechResource(AsyncAPIResource):
245
249
 
246
250
  timeout: Override the client-level default timeout for this request, in seconds
247
251
  """
248
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
252
+ extra_headers = {"Accept": "audio/*", **(extra_headers or {})}
249
253
  return await self._post(
250
254
  "/v1/speech",
251
255
  body=await async_maybe_transform(
spitch/resources/text.py CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from typing import Optional
5
6
  from typing_extensions import Literal
6
7
 
7
8
  import httpx
8
9
 
9
10
  from ..types import text_tone_mark_params, text_translate_params
10
- from .._types import Body, Query, Headers, NotGiven, not_given
11
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
12
  from .._utils import maybe_transform, async_maybe_transform
12
13
  from .._compat import cached_property
13
14
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -88,7 +89,10 @@ class TextResource(SyncAPIResource):
88
89
  *,
89
90
  source: Literal["yo", "en", "ha", "ig", "am"],
90
91
  target: Literal["yo", "en", "ha", "ig", "am"],
91
- text: str,
92
+ file_id: Optional[str] | Omit = omit,
93
+ instructions: Optional[str] | Omit = omit,
94
+ model: Literal["human", "auto"] | Omit = omit,
95
+ text: Optional[str] | Omit = omit,
92
96
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
93
97
  # The extra values given here take precedence over values defined on the client or passed to this method.
94
98
  extra_headers: Headers | None = None,
@@ -114,6 +118,9 @@ class TextResource(SyncAPIResource):
114
118
  {
115
119
  "source": source,
116
120
  "target": target,
121
+ "file_id": file_id,
122
+ "instructions": instructions,
123
+ "model": model,
117
124
  "text": text,
118
125
  },
119
126
  text_translate_params.TextTranslateParams,
@@ -189,7 +196,10 @@ class AsyncTextResource(AsyncAPIResource):
189
196
  *,
190
197
  source: Literal["yo", "en", "ha", "ig", "am"],
191
198
  target: Literal["yo", "en", "ha", "ig", "am"],
192
- text: str,
199
+ file_id: Optional[str] | Omit = omit,
200
+ instructions: Optional[str] | Omit = omit,
201
+ model: Literal["human", "auto"] | Omit = omit,
202
+ text: Optional[str] | Omit = omit,
193
203
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
194
204
  # The extra values given here take precedence over values defined on the client or passed to this method.
195
205
  extra_headers: Headers | None = None,
@@ -215,6 +225,9 @@ class AsyncTextResource(AsyncAPIResource):
215
225
  {
216
226
  "source": source,
217
227
  "target": target,
228
+ "file_id": file_id,
229
+ "instructions": instructions,
230
+ "model": model,
218
231
  "text": text,
219
232
  },
220
233
  text_translate_params.TextTranslateParams,
spitch/types/__init__.py CHANGED
@@ -2,15 +2,17 @@
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
- from .file_delete_response import FileDeleteResponse as FileDeleteResponse
14
16
  from .file_download_params import FileDownloadParams as FileDownloadParams
15
17
  from .text_tone_mark_params import TextToneMarkParams as TextToneMarkParams
16
18
  from .text_translate_params import TextTranslateParams as TextTranslateParams
spitch/types/file.py CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import Optional
4
4
  from datetime import datetime
5
+ from typing_extensions import Literal
5
6
 
6
7
  from .._models import BaseModel
7
8
 
@@ -21,6 +22,6 @@ class File(BaseModel):
21
22
 
22
23
  size_bytes: Optional[int] = None
23
24
 
24
- status: str
25
+ status: Literal["uploading", "ready"]
25
26
 
26
27
  uploaded_by: Optional[str] = None
spitch/types/job.py ADDED
@@ -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"]]
spitch/types/jobs.py ADDED
@@ -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
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from typing import Optional
5
6
  from typing_extensions import Literal, Required, TypedDict
6
7
 
7
8
  __all__ = ["TextTranslateParams"]
@@ -12,4 +13,10 @@ class TextTranslateParams(TypedDict, total=False):
12
13
 
13
14
  target: Required[Literal["yo", "en", "ha", "ig", "am"]]
14
15
 
15
- text: Required[str]
16
+ file_id: Optional[str]
17
+
18
+ instructions: Optional[str]
19
+
20
+ model: Literal["human", "auto"]
21
+
22
+ text: Optional[str]
@@ -1,5 +1,8 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from typing import Optional
4
+ from datetime import datetime
5
+
3
6
  from .._models import BaseModel
4
7
 
5
8
  __all__ = ["Translation"]
@@ -9,3 +12,5 @@ class Translation(BaseModel):
9
12
  request_id: str
10
13
 
11
14
  text: str
15
+
16
+ due_date: Optional[datetime] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.38.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
@@ -1,6 +1,6 @@
1
1
  spitch/__init__.py,sha256=JS1xuX1VDVdq2-EkwlKH3h19hltmtZQZDCMig55YgDw,2606
2
2
  spitch/_base_client.py,sha256=zj7tZVDyWwN3QLO30HljeRZzptVtxvJ01-vPTzDlPVQ,67176
3
- spitch/_client.py,sha256=Ptl5A9zAoBWtAK7CrIFZkSPD3NvYASfZteHOZlqLKeg,15870
3
+ spitch/_client.py,sha256=MMD6qfP6gsgF2gh1c-KQS7TTjl1luwOv1HltJ_V7uNo,16316
4
4
  spitch/_compat.py,sha256=LPDXpBxBq8haInbzeO9ldLv_0wZotEcrEtXCAJaZjLg,6589
5
5
  spitch/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  spitch/_exceptions.py,sha256=xsQtKJTiIdz2X1bQDQFZcSW7WBofLazdQm9nMCyPEVM,3220
@@ -11,7 +11,7 @@ spitch/_resource.py,sha256=TLFPcOOmtxZOQLh3XCNPB_BdrQpp0MIYoKoH52aRAu8,1100
11
11
  spitch/_response.py,sha256=-1LLK1wjPW3Hcro9NXjf_SnPRArU1ozdctNIStvxbWo,28690
12
12
  spitch/_streaming.py,sha256=5SpId2EIfF8Ee8UUYmJxqgHUGP1ZdHCUHhHCdNJREFA,10100
13
13
  spitch/_types.py,sha256=oa5CdZaglGw0wrxxpdWxeoliiTfNpce300esw52GnGk,7260
14
- spitch/_version.py,sha256=0N9Hhk8Ou5F_nU7MD3SYh_68q3OT8_gsDWao5-oz858,159
14
+ spitch/_version.py,sha256=MWEFFlAcGSwlaZGOIM5v8nSehK3D3rRTZNkPjg8oXtU,159
15
15
  spitch/pagination.py,sha256=XQaAXcd1OtYzc7zqwCJLQVqFMkC0W-1-0njeSyxT88A,1312
16
16
  spitch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  spitch/_utils/__init__.py,sha256=WhaZJLzT8oCtvdIvbs8gyd6emLYa4usodcqgcpFiciU,2259
@@ -27,27 +27,30 @@ spitch/_utils/_transform.py,sha256=NjCzmnfqYrsAikUHQig6N9QfuTVbKipuP3ur9mcNF-E,1
27
27
  spitch/_utils/_typing.py,sha256=AmI-ZWKfmGpa8sE_wXUPqJm-aqfO8JapbGAk7bX-Sy0,4156
28
28
  spitch/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
29
29
  spitch/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
30
- spitch/resources/__init__.py,sha256=oUfkZqMUtVuaZj1l1YuWwDDcfCTFMs89K1-DNgM89VY,1413
31
- spitch/resources/files.py,sha256=wslju1bXne3gIRBBLQs49BQwAQhARvF1JGTemGtkcNI,21492
32
- spitch/resources/speech.py,sha256=OiwFiY3shX0vi1NwvAresjfbAQC9CR9w355cuaDpz0U,13432
33
- spitch/resources/text.py,sha256=jPOwxYWoqDUWvbmYlYsMJiZLDy4-C_gIzhnvsbY3p94,9555
34
- spitch/types/__init__.py,sha256=716oGh0nu8qXtnA8yGH5Hj8VDYSnVKm93pYAFwdO0E0,1079
30
+ spitch/resources/__init__.py,sha256=H63Q9LVhkR_MkiF0XBQWq1c8f-3aApLOp1gTTXWT8vE,1837
31
+ spitch/resources/files.py,sha256=Tac8zPK6unJEzeB57ZlBuPVC1EasIiImNrs-qERZCkg,25938
32
+ spitch/resources/jobs.py,sha256=fHANB7cLyrwZOVNwYx5OxSDm_likpEV0Xz4xo4CB5YQ,9397
33
+ spitch/resources/speech.py,sha256=8hPIV_Xw-bFMn0Oo96bx6OorRKvy4xi_e3VZkKsBCEg,13526
34
+ spitch/resources/text.py,sha256=O6jJCtoM5ajVOn1s6q48Pz3OvZhL6HwYJg0ukpkHDJw,10199
35
+ spitch/types/__init__.py,sha256=pRKBE0ZW-nyiTRGVLDN8Sbzwd1LkwYZ6w-SVzOjaDj0,1123
35
36
  spitch/types/diacritics.py,sha256=btOCAZTQ5qLjN78nCb7kyfJeBeBKW4nXlA9T8hsVquE,211
36
- spitch/types/file.py,sha256=xRfk8t2q7YhQFzhjL8S1EHImdFWwXGIBiUhDDw1Tytk,477
37
- spitch/types/file_delete_response.py,sha256=r4OwDVrG4BGSEdqYyr7iPpaPzon5pm5Wx61KIRZk1zY,255
37
+ spitch/types/file.py,sha256=JqaBmIenjSwk4Z3-Idyg7CQF4Xvu5m7m4JsqeiSJUsY,541
38
38
  spitch/types/file_download_params.py,sha256=tCiwTeSSbPuniZXdiOQll7Bdc2enBp9yJD-D9SpeEqg,262
39
39
  spitch/types/file_download_response.py,sha256=OeO6JIFo97dLZcL8iTtazGU1PVZy1rp5VVa5w6d8DHg,284
40
40
  spitch/types/file_list_params.py,sha256=FrWZhMUC38sGkBtdQKateTyStVuMOz90x5AHtkoZnzk,373
41
41
  spitch/types/file_upload_params.py,sha256=5LSsvz7ptuELm5MosWotXpgsBf-Tz_ox1ys9HLx-Sts,317
42
42
  spitch/types/file_usage.py,sha256=dXrqkDjvq-VECYaMVUL1wL3xS4Nkej7y7AVm5_DU4IE,267
43
43
  spitch/types/files.py,sha256=FkNfexYBP3Ug4klnbGbGQTtXj6DC9y4Akbhd78ijb-c,285
44
+ spitch/types/job.py,sha256=_IbtZ9qczkRVJvDfhpcGisb2SOefaK6DoOj_YI5X4pI,288
45
+ spitch/types/job_list_params.py,sha256=rBkbmTOD436opWPb-4MKg9NE7vbQXDpeBN3BKc8GHss,386
46
+ spitch/types/jobs.py,sha256=EG6fIEO1ePtJZKpgV_vNWbTtrHID7z0MhRl7AZsYpSI,280
44
47
  spitch/types/speech_generate_params.py,sha256=9kjye1XOMJPNZginEDMTS6Gt05bkB1s1r5H7oEj1Chk,1037
45
48
  spitch/types/speech_transcribe_params.py,sha256=fAVwTfPRR4aLzcu4Y8qrmKXESemnWJIdnyhyVcR3W20,613
46
49
  spitch/types/text_tone_mark_params.py,sha256=MEnWzcSjPT_Z_8Mio96LgwYbx2BngG5By-MoeSt0Sms,355
47
- spitch/types/text_translate_params.py,sha256=skEeG7oTZUSl_gugnqL4Mb7HE_pEFhKNygZPTvci2hA,416
50
+ spitch/types/text_translate_params.py,sha256=3rHSFo3ITqvUEGkm2iL-cy1HDZnYeojqHdgc3W2oWfc,542
48
51
  spitch/types/transcription.py,sha256=SrbWIwItrt-FdPUPV8PofYTxzLCiwxg7Ya4QsKE1PoY,393
49
- spitch/types/translation.py,sha256=ICtp42meKFR_CvfW5mSmy3Y0az8SuIhdDi3BAfnWs8k,213
50
- spitch-1.38.0.dist-info/METADATA,sha256=rQ54GbRfWe6zKwGeyuolLkjXuOdpWIN8YoaySvY5Jzg,15962
51
- spitch-1.38.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
52
- spitch-1.38.0.dist-info/licenses/LICENSE,sha256=C0lDWY-no8IxmnqzQA9BA7Z8jeh_bogVPfeWSgeDDcc,11336
53
- spitch-1.38.0.dist-info/RECORD,,
52
+ spitch/types/translation.py,sha256=GbqjtTZTuULha75cMEUVizfz8ZenvdFHQ2jr7_1wxNY,313
53
+ spitch-1.40.0.dist-info/METADATA,sha256=GUPZdT9Q7K2v2Fgt22FY3AaqvkFp5QTsIbB6t3Vm6TM,15962
54
+ spitch-1.40.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
55
+ spitch-1.40.0.dist-info/licenses/LICENSE,sha256=C0lDWY-no8IxmnqzQA9BA7Z8jeh_bogVPfeWSgeDDcc,11336
56
+ spitch-1.40.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from typing import Optional
4
-
5
- from .._models import BaseModel
6
-
7
- __all__ = ["FileDeleteResponse"]
8
-
9
-
10
- class FileDeleteResponse(BaseModel):
11
- status: Optional[bool] = None