spitch 1.22.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.d.mts +6 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +4 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +4 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/files.d.mts +81 -12
  12. package/resources/files.d.mts.map +1 -1
  13. package/resources/files.d.ts +81 -12
  14. package/resources/files.d.ts.map +1 -1
  15. package/resources/files.js +53 -6
  16. package/resources/files.js.map +1 -1
  17. package/resources/files.mjs +53 -6
  18. package/resources/files.mjs.map +1 -1
  19. package/resources/index.d.mts +1 -0
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +1 -0
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js +3 -1
  24. package/resources/index.js.map +1 -1
  25. package/resources/index.mjs +1 -0
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/jobs.d.mts +42 -0
  28. package/resources/jobs.d.mts.map +1 -0
  29. package/resources/jobs.d.ts +42 -0
  30. package/resources/jobs.d.ts.map +1 -0
  31. package/resources/jobs.js +23 -0
  32. package/resources/jobs.js.map +1 -0
  33. package/resources/jobs.mjs +19 -0
  34. package/resources/jobs.mjs.map +1 -0
  35. package/resources/speech.d.mts +3 -0
  36. package/resources/speech.d.mts.map +1 -1
  37. package/resources/speech.d.ts +3 -0
  38. package/resources/speech.d.ts.map +1 -1
  39. package/resources/speech.js +4 -1
  40. package/resources/speech.js.map +1 -1
  41. package/resources/speech.mjs +4 -1
  42. package/resources/speech.mjs.map +1 -1
  43. package/resources/text.d.mts +20 -1
  44. package/resources/text.d.mts.map +1 -1
  45. package/resources/text.d.ts +20 -1
  46. package/resources/text.d.ts.map +1 -1
  47. package/src/client.ts +12 -0
  48. package/src/resources/files.ts +81 -12
  49. package/src/resources/index.ts +1 -0
  50. package/src/resources/jobs.ts +68 -0
  51. package/src/resources/speech.ts +4 -1
  52. package/src/resources/text.ts +24 -1
  53. package/src/version.ts +1 -1
  54. package/version.d.mts +1 -1
  55. package/version.d.ts +1 -1
  56. package/version.js +1 -1
  57. package/version.mjs +1 -1
@@ -2,6 +2,9 @@
2
2
  import { APIResource } from "../core/resource.mjs";
3
3
  import { buildHeaders } from "../internal/headers.mjs";
4
4
  import { multipartFormRequestOptions } from "../internal/uploads.mjs";
5
+ /**
6
+ * All speech-focused APIs (TTS and STT)
7
+ */
5
8
  export class Speech extends APIResource {
6
9
  /**
7
10
  * Synthesize
@@ -10,7 +13,7 @@ export class Speech extends APIResource {
10
13
  return this._client.post('/v1/speech', {
11
14
  body,
12
15
  ...options,
13
- headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
16
+ headers: buildHeaders([{ Accept: 'audio/*' }, options?.headers]),
14
17
  __binaryResponse: true,
15
18
  });
16
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"speech.mjs","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;YACrC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAClE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAA4B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,oBAAoB,EACpB,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"speech.mjs","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;YACrC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAChE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAA4B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,oBAAoB,EACpB,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF"}
@@ -11,13 +11,29 @@ export declare class Text extends APIResource {
11
11
  */
12
12
  translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation>;
13
13
  }
14
+ /**
15
+ * Response model for text diacritization requests.
16
+ *
17
+ * Attributes:
18
+ * request_id: Unique identifier for the diacritization request
19
+ * text: Text with added diacritical marks for proper pronunciation
20
+ * language: Language code for the diacritized text
21
+ */
14
22
  export interface Diacritics {
15
23
  request_id: string;
16
24
  text: string;
17
25
  }
26
+ /**
27
+ * Translation result model.
28
+ *
29
+ * Attributes: request_id (UUID): Unique ID for this request. text: translated
30
+ * text. due_date: used when model is `human`. the date you can expect the
31
+ * translation to be delivered
32
+ */
18
33
  export interface Translation {
19
34
  request_id: string;
20
35
  text: string;
36
+ due_date?: string | null;
21
37
  }
22
38
  export interface TextToneMarkParams {
23
39
  language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
@@ -26,7 +42,10 @@ export interface TextToneMarkParams {
26
42
  export interface TextTranslateParams {
27
43
  source: 'yo' | 'en' | 'ha' | 'ig' | 'am';
28
44
  target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
29
- text: string;
45
+ file_id?: string | null;
46
+ instructions?: string | null;
47
+ model?: 'human' | 'auto';
48
+ text?: string | null;
30
49
  }
31
50
  export declare namespace Text {
32
51
  export { type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.mts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAGxF;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG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AG,IAAI,CAAC;IAE3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
@@ -11,13 +11,29 @@ export declare class Text extends APIResource {
11
11
  */
12
12
  translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation>;
13
13
  }
14
+ /**
15
+ * Response model for text diacritization requests.
16
+ *
17
+ * Attributes:
18
+ * request_id: Unique identifier for the diacritization request
19
+ * text: Text with added diacritical marks for proper pronunciation
20
+ * language: Language code for the diacritized text
21
+ */
14
22
  export interface Diacritics {
15
23
  request_id: string;
16
24
  text: string;
17
25
  }
26
+ /**
27
+ * Translation result model.
28
+ *
29
+ * Attributes: request_id (UUID): Unique ID for this request. text: translated
30
+ * text. due_date: used when model is `human`. the date you can expect the
31
+ * translation to be delivered
32
+ */
18
33
  export interface Translation {
19
34
  request_id: string;
20
35
  text: string;
36
+ due_date?: string | null;
21
37
  }
22
38
  export interface TextToneMarkParams {
23
39
  language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
@@ -26,7 +42,10 @@ export interface TextToneMarkParams {
26
42
  export interface TextTranslateParams {
27
43
  source: 'yo' | 'en' | 'ha' | 'ig' | 'am';
28
44
  target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
29
- text: string;
45
+ file_id?: string | null;
46
+ instructions?: string | null;
47
+ model?: 'human' | 'auto';
48
+ text?: string | null;
30
49
  }
31
50
  export declare namespace Text {
32
51
  export { type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAGxF;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,IAAI,EAAE,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C,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
package/src/client.ts CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  Files,
30
30
  FilesFilesCursor,
31
31
  } from './resources/files';
32
+ import { Job, JobListParams, Jobs, JobsFilesCursor } from './resources/jobs';
32
33
  import { Speech, SpeechGenerateParams, SpeechTranscribeParams, Transcription } from './resources/speech';
33
34
  import { Diacritics, Text, TextToneMarkParams, TextTranslateParams, Translation } from './resources/text';
34
35
  import { type Fetch } from './internal/builtin-types';
@@ -747,9 +748,13 @@ export class Spitch {
747
748
 
748
749
  static toFile = Uploads.toFile;
749
750
 
751
+ /**
752
+ * All speech-focused APIs (TTS and STT)
753
+ */
750
754
  speech: API.Speech = new API.Speech(this);
751
755
  text: API.Text = new API.Text(this);
752
756
  files: API.Files = new API.Files(this);
757
+ jobs: API.Jobs = new API.Jobs(this);
753
758
  }
754
759
 
755
760
  Spitch.Speech = Speech;
@@ -787,4 +792,11 @@ export declare namespace Spitch {
787
792
  type FileDownloadParams as FileDownloadParams,
788
793
  type FileUploadParams as FileUploadParams,
789
794
  };
795
+
796
+ export {
797
+ type Jobs as Jobs,
798
+ type Job as Job,
799
+ type JobsFilesCursor as JobsFilesCursor,
800
+ type JobListParams as JobListParams,
801
+ };
790
802
  }
@@ -10,7 +10,16 @@ import { path } from '../internal/utils/path';
10
10
 
11
11
  export class Files extends APIResource {
12
12
  /**
13
- * Get Files
13
+ * Get a paginated list of files for the authenticated organization.
14
+ *
15
+ * Args: identity: Authentication identity containing org_id and user_id limit:
16
+ * Maximum number of files to return (max 100) status: Optional filter by file
17
+ * status (processing, ready, etc.) cursor: Optional pagination cursor for getting
18
+ * next page db: Database session
19
+ *
20
+ * Returns: ListFilesResponse: Paginated list of files with metadata
21
+ *
22
+ * Raises: HTTPException: 400 if cursor is invalid
14
23
  */
15
24
  list(
16
25
  query: FileListParams | null | undefined = {},
@@ -20,14 +29,31 @@ export class Files extends APIResource {
20
29
  }
21
30
 
22
31
  /**
23
- * Delete File
32
+ * Delete a file and its associated S3 object.
33
+ *
34
+ * Args: file_id: UUID of the file to delete identity: Authentication identity
35
+ * containing org_id db: Database session s3: S3 session for deleting objects
36
+ *
37
+ * Returns: dict: Success confirmation
38
+ *
39
+ * Raises: HTTPException: 404 if file not found or doesn't belong to org
24
40
  */
25
- delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse> {
41
+ delete(fileID: string, options?: RequestOptions): APIPromise<unknown> {
26
42
  return this._client.delete(path`/v1/files/${fileID}`, options);
27
43
  }
28
44
 
29
45
  /**
30
- * Download File
46
+ * Generate a pre-signed download URL for a file.
47
+ *
48
+ * Args: file_id: UUID of the file to download identity: Authentication identity
49
+ * containing org_id ttl: Time-to-live for the download URL in seconds (60-3600)
50
+ * db: Database session s3: S3 session for generating pre-signed URLs
51
+ *
52
+ * Returns: FileDownloadResponse: Contains file_id, download URL, and expiration
53
+ * time
54
+ *
55
+ * Raises: HTTPException: 404 if file not found, doesn't belong to org, or not
56
+ * ready
31
57
  */
32
58
  download(
33
59
  fileID: string,
@@ -38,21 +64,42 @@ export class Files extends APIResource {
38
64
  }
39
65
 
40
66
  /**
41
- * Get File
67
+ * Get metadata for a specific file.
68
+ *
69
+ * Args: file_id: UUID of the file to retrieve identity: Authentication identity
70
+ * containing org_id db: Database session
71
+ *
72
+ * Returns: FileMetaResponse: File metadata including upload information
73
+ *
74
+ * Raises: HTTPException: 404 if file not found or doesn't belong to org
75
+ * HTTPException: 500 if uploader information is corrupted
42
76
  */
43
77
  get(fileID: string, options?: RequestOptions): APIPromise<File> {
44
78
  return this._client.get(path`/v1/files/${fileID}`, options);
45
79
  }
46
80
 
47
81
  /**
48
- * Upload File
82
+ * Upload a file to the Spitch server.
83
+ *
84
+ * Args: file: The file to upload from the request identity: Authentication
85
+ * identity containing org_id and user_id db: Database session
86
+ *
87
+ * Returns: FileMetaResponse: Metadata for the uploaded file
88
+ *
89
+ * Raises: HTTPException: 500 if upload fails
49
90
  */
50
91
  upload(body: FileUploadParams, options?: RequestOptions): APIPromise<File> {
51
92
  return this._client.post('/v1/files', multipartFormRequestOptions({ body, ...options }, this._client));
52
93
  }
53
94
 
54
95
  /**
55
- * Get Usage
96
+ * Get storage usage statistics for the authenticated organization.
97
+ *
98
+ * Args: identity: Authentication identity containing org_id db: Database session
99
+ *
100
+ * Returns: FileUsage: Usage statistics including total/used bytes and file count
101
+ *
102
+ * Raises: HTTPException: 500 if unable to calculate usage
56
103
  */
57
104
  usage(options?: RequestOptions): APIPromise<FileUsage> {
58
105
  return this._client.get('/v1/files:usage', options);
@@ -61,6 +108,11 @@ export class Files extends APIResource {
61
108
 
62
109
  export type FilesFilesCursor = FilesCursor<File>;
63
110
 
111
+ /**
112
+ * description of a file. Attributes: file_id: unique identifier for the file.
113
+ * status: status of the file, `processing` or `ready` original_name: original name
114
+ * of the file. If the file was uploaded via API
115
+ */
64
116
  export interface File {
65
117
  category: string | null;
66
118
 
@@ -74,11 +126,18 @@ export interface File {
74
126
 
75
127
  size_bytes: number | null;
76
128
 
77
- status: string;
129
+ status: 'uploading' | 'ready';
78
130
 
79
- uploaded_by: string | null;
131
+ uploaded_by?: string | null;
80
132
  }
81
133
 
134
+ /**
135
+ * Storage usage information for an organization.
136
+ *
137
+ * Attributes: total: Human-readable total storage limit used: Human-readable used
138
+ * storage amount total_bytes: Total storage limit in bytes used_bytes: Used
139
+ * storage amount in bytes num_files: Number of files stored
140
+ */
82
141
  export interface FileUsage {
83
142
  num_files: number;
84
143
 
@@ -91,16 +150,26 @@ export interface FileUsage {
91
150
  used_bytes: number;
92
151
  }
93
152
 
153
+ /**
154
+ * Response model for listing files.
155
+ *
156
+ * Attributes: items: List of file metadata responses next_cursor: Optional cursor
157
+ * for pagination to get next page of results
158
+ */
94
159
  export interface Files {
95
160
  items: Array<File>;
96
161
 
97
162
  next_cursor?: string | null;
98
163
  }
99
164
 
100
- export interface FileDeleteResponse {
101
- status?: boolean;
102
- }
165
+ export type FileDeleteResponse = unknown;
103
166
 
167
+ /**
168
+ * Response model for file download URLs.
169
+ *
170
+ * Attributes: file_id: Unique identifier for the file url: Pre-signed download URL
171
+ * expires_at: When the download URL expires
172
+ */
104
173
  export interface FileDownloadResponse {
105
174
  expires_at: string;
106
175
 
@@ -11,6 +11,7 @@ export {
11
11
  type FileUploadParams,
12
12
  type FilesFilesCursor,
13
13
  } from './files';
14
+ export { Jobs, type Job, type JobListParams, type JobsFilesCursor } from './jobs';
14
15
  export { Speech, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams } from './speech';
15
16
  export {
16
17
  Text,
@@ -0,0 +1,68 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { FilesCursor, type FilesCursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Jobs extends APIResource {
10
+ /**
11
+ * Get Jobs
12
+ */
13
+ list(
14
+ query: JobListParams | null | undefined = {},
15
+ options?: RequestOptions,
16
+ ): PagePromise<JobsFilesCursor, Job> {
17
+ return this._client.getAPIList('/v1/jobs', FilesCursor<Job>, { query, ...options });
18
+ }
19
+
20
+ /**
21
+ * Get Job
22
+ */
23
+ get(jobID: string, options?: RequestOptions): APIPromise<Job> {
24
+ return this._client.get(path`/v1/jobs/${jobID}`, options);
25
+ }
26
+ }
27
+
28
+ export type JobsFilesCursor = FilesCursor<Job>;
29
+
30
+ /**
31
+ * Metadata model for job metadata.
32
+ */
33
+ export interface Job {
34
+ created_by: string;
35
+
36
+ due_date: string;
37
+
38
+ job_id: string;
39
+
40
+ org_id: string;
41
+
42
+ status: string;
43
+ }
44
+
45
+ /**
46
+ * Response model for listing jobs.
47
+ *
48
+ * Attributes: items: list of job metadata responses next_cursor: Optional cursor
49
+ * for pagination to get next page of results
50
+ */
51
+ export interface Jobs {
52
+ items: Array<Job>;
53
+
54
+ next_cursor?: string | null;
55
+ }
56
+
57
+ export interface JobListParams extends FilesCursorParams {
58
+ status?: 'queued' | 'in_progress' | 'finished' | null;
59
+ }
60
+
61
+ export declare namespace Jobs {
62
+ export {
63
+ type Job as Job,
64
+ type Jobs as Jobs,
65
+ type JobsFilesCursor as JobsFilesCursor,
66
+ type JobListParams as JobListParams,
67
+ };
68
+ }
@@ -7,6 +7,9 @@ import { buildHeaders } from '../internal/headers';
7
7
  import { RequestOptions } from '../internal/request-options';
8
8
  import { multipartFormRequestOptions } from '../internal/uploads';
9
9
 
10
+ /**
11
+ * All speech-focused APIs (TTS and STT)
12
+ */
10
13
  export class Speech extends APIResource {
11
14
  /**
12
15
  * Synthesize
@@ -15,7 +18,7 @@ export class Speech extends APIResource {
15
18
  return this._client.post('/v1/speech', {
16
19
  body,
17
20
  ...options,
18
- headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
21
+ headers: buildHeaders([{ Accept: 'audio/*' }, options?.headers]),
19
22
  __binaryResponse: true,
20
23
  });
21
24
  }
@@ -20,16 +20,33 @@ export class Text extends APIResource {
20
20
  }
21
21
  }
22
22
 
23
+ /**
24
+ * Response model for text diacritization requests.
25
+ *
26
+ * Attributes:
27
+ * request_id: Unique identifier for the diacritization request
28
+ * text: Text with added diacritical marks for proper pronunciation
29
+ * language: Language code for the diacritized text
30
+ */
23
31
  export interface Diacritics {
24
32
  request_id: string;
25
33
 
26
34
  text: string;
27
35
  }
28
36
 
37
+ /**
38
+ * Translation result model.
39
+ *
40
+ * Attributes: request_id (UUID): Unique ID for this request. text: translated
41
+ * text. due_date: used when model is `human`. the date you can expect the
42
+ * translation to be delivered
43
+ */
29
44
  export interface Translation {
30
45
  request_id: string;
31
46
 
32
47
  text: string;
48
+
49
+ due_date?: string | null;
33
50
  }
34
51
 
35
52
  export interface TextToneMarkParams {
@@ -43,7 +60,13 @@ export interface TextTranslateParams {
43
60
 
44
61
  target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
45
62
 
46
- text: string;
63
+ file_id?: string | null;
64
+
65
+ instructions?: string | null;
66
+
67
+ model?: 'human' | 'auto';
68
+
69
+ text?: string | null;
47
70
  }
48
71
 
49
72
  export declare namespace Text {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.22.0'; // x-release-please-version
1
+ export const VERSION = '1.24.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.22.0";
1
+ export declare const VERSION = "1.24.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.22.0";
1
+ export declare const VERSION = "1.24.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.22.0'; // x-release-please-version
4
+ exports.VERSION = '1.24.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.22.0'; // x-release-please-version
1
+ export const VERSION = '1.24.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map