telnyx 6.8.2 → 6.10.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 (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/client.d.mts +12 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +12 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +12 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +12 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +2 -0
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +2 -0
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +6 -2
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +2 -0
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/voice-clones.d.mts +238 -0
  20. package/resources/voice-clones.d.mts.map +1 -0
  21. package/resources/voice-clones.d.ts +238 -0
  22. package/resources/voice-clones.d.ts.map +1 -0
  23. package/resources/voice-clones.js +117 -0
  24. package/resources/voice-clones.js.map +1 -0
  25. package/resources/voice-clones.mjs +113 -0
  26. package/resources/voice-clones.mjs.map +1 -0
  27. package/resources/voice-designs.d.mts +312 -0
  28. package/resources/voice-designs.d.mts.map +1 -0
  29. package/resources/voice-designs.d.ts +312 -0
  30. package/resources/voice-designs.d.ts.map +1 -0
  31. package/resources/voice-designs.js +131 -0
  32. package/resources/voice-designs.js.map +1 -0
  33. package/resources/voice-designs.mjs +127 -0
  34. package/resources/voice-designs.mjs.map +1 -0
  35. package/src/client.ts +66 -0
  36. package/src/resources/index.ts +27 -0
  37. package/src/resources/voice-clones.ts +323 -0
  38. package/src/resources/voice-designs.ts +424 -0
  39. package/src/version.ts +1 -1
  40. package/version.d.mts +1 -1
  41. package/version.d.mts.map +1 -1
  42. package/version.d.ts +1 -1
  43. package/version.d.ts.map +1 -1
  44. package/version.js +1 -1
  45. package/version.js.map +1 -1
  46. package/version.mjs +1 -1
  47. package/version.mjs.map +1 -1
@@ -0,0 +1,238 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { DefaultFlatPagination, type DefaultFlatPaginationParams, PagePromise } from "../core/pagination.mjs";
4
+ import { type Uploadable } from "../core/uploads.mjs";
5
+ import { RequestOptions } from "../internal/request-options.mjs";
6
+ /**
7
+ * Capture and manage voice identities as clones for use in text-to-speech synthesis.
8
+ */
9
+ export declare class VoiceClones extends APIResource {
10
+ /**
11
+ * Creates a new voice clone by capturing the voice identity of an existing voice
12
+ * design. The clone can then be used for text-to-speech synthesis.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const voiceClone = await client.voiceClones.create({
17
+ * gender: 'male',
18
+ * language: 'en',
19
+ * name: 'clone-narrator',
20
+ * voice_design_id: '550e8400-e29b-41d4-a716-446655440000',
21
+ * });
22
+ * ```
23
+ */
24
+ create(body: VoiceCloneCreateParams, options?: RequestOptions): APIPromise<VoiceCloneCreateResponse>;
25
+ /**
26
+ * Updates the name, language, or gender of a voice clone.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const voiceClone = await client.voiceClones.update(
31
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
32
+ * { name: 'updated-clone' },
33
+ * );
34
+ * ```
35
+ */
36
+ update(id: string, body: VoiceCloneUpdateParams, options?: RequestOptions): APIPromise<VoiceCloneUpdateResponse>;
37
+ /**
38
+ * Returns a paginated list of voice clones belonging to the authenticated account.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * // Automatically fetches more pages as needed.
43
+ * for await (const voiceCloneData of client.voiceClones.list()) {
44
+ * // ...
45
+ * }
46
+ * ```
47
+ */
48
+ list(query?: VoiceCloneListParams | null | undefined, options?: RequestOptions): PagePromise<VoiceCloneDataDefaultFlatPagination, VoiceCloneData>;
49
+ /**
50
+ * Permanently deletes a voice clone. This action cannot be undone.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * await client.voiceClones.delete(
55
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
56
+ * );
57
+ * ```
58
+ */
59
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
60
+ /**
61
+ * Creates a new voice clone by uploading an audio file directly. Supported
62
+ * formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10 seconds of
63
+ * clear speech. Maximum file size: 2MB.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const response = await client.voiceClones.createFromUpload({
68
+ * audio_file: fs.createReadStream('path/to/file'),
69
+ * language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
70
+ * name: 'name',
71
+ * });
72
+ * ```
73
+ */
74
+ createFromUpload(body: VoiceCloneCreateFromUploadParams, options?: RequestOptions): APIPromise<VoiceCloneCreateFromUploadResponse>;
75
+ /**
76
+ * Downloads the WAV audio sample that was used to create the voice clone.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const response = await client.voiceClones.downloadSample(
81
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
82
+ * );
83
+ *
84
+ * const content = await response.blob();
85
+ * console.log(content);
86
+ * ```
87
+ */
88
+ downloadSample(id: string, options?: RequestOptions): APIPromise<Response>;
89
+ }
90
+ export type VoiceCloneDataDefaultFlatPagination = DefaultFlatPagination<VoiceCloneData>;
91
+ /**
92
+ * A voice clone object.
93
+ */
94
+ export interface VoiceCloneData {
95
+ /**
96
+ * Unique identifier for the voice clone.
97
+ */
98
+ id?: string;
99
+ /**
100
+ * Timestamp when the voice clone was created.
101
+ */
102
+ created_at?: string;
103
+ /**
104
+ * Gender of the voice clone.
105
+ */
106
+ gender?: 'male' | 'female' | 'neutral' | null;
107
+ /**
108
+ * Voice style description. If not explicitly set on upload, falls back to the
109
+ * source design's prompt text.
110
+ */
111
+ label?: string | null;
112
+ /**
113
+ * ISO 639-1 language code of the voice clone.
114
+ */
115
+ language?: string | null;
116
+ /**
117
+ * Name of the voice clone.
118
+ */
119
+ name?: string;
120
+ /**
121
+ * Identifies the resource type.
122
+ */
123
+ record_type?: 'voice_clone';
124
+ /**
125
+ * UUID of the source voice design. `null` for upload-based clones.
126
+ */
127
+ source_voice_design_id?: string | null;
128
+ /**
129
+ * Version of the source voice design used. `null` for upload-based clones.
130
+ */
131
+ source_voice_design_version?: number | null;
132
+ /**
133
+ * Timestamp when the voice clone was last updated.
134
+ */
135
+ updated_at?: string;
136
+ }
137
+ /**
138
+ * Response envelope for a single voice clone.
139
+ */
140
+ export interface VoiceCloneCreateResponse {
141
+ /**
142
+ * A voice clone object.
143
+ */
144
+ data?: VoiceCloneData;
145
+ }
146
+ /**
147
+ * Response envelope for a single voice clone.
148
+ */
149
+ export interface VoiceCloneUpdateResponse {
150
+ /**
151
+ * A voice clone object.
152
+ */
153
+ data?: VoiceCloneData;
154
+ }
155
+ /**
156
+ * Response envelope for a single voice clone.
157
+ */
158
+ export interface VoiceCloneCreateFromUploadResponse {
159
+ /**
160
+ * A voice clone object.
161
+ */
162
+ data?: VoiceCloneData;
163
+ }
164
+ export interface VoiceCloneCreateParams {
165
+ /**
166
+ * Gender of the voice clone.
167
+ */
168
+ gender: 'male' | 'female' | 'neutral';
169
+ /**
170
+ * ISO 639-1 language code for the clone (e.g. `en`, `fr`, `de`).
171
+ */
172
+ language: string;
173
+ /**
174
+ * Name for the voice clone.
175
+ */
176
+ name: string;
177
+ /**
178
+ * UUID of the source voice design to clone.
179
+ */
180
+ voice_design_id: string;
181
+ }
182
+ export interface VoiceCloneUpdateParams {
183
+ /**
184
+ * New name for the voice clone.
185
+ */
186
+ name: string;
187
+ /**
188
+ * Updated gender for the voice clone.
189
+ */
190
+ gender?: 'male' | 'female' | 'neutral';
191
+ /**
192
+ * Updated ISO 639-1 language code or `auto`.
193
+ */
194
+ language?: string;
195
+ }
196
+ export interface VoiceCloneListParams extends DefaultFlatPaginationParams {
197
+ /**
198
+ * Case-insensitive substring filter on the name field.
199
+ */
200
+ 'filter[name]'?: string;
201
+ /**
202
+ * Sort order. Prefix with `-` for descending. Defaults to `-created_at`.
203
+ */
204
+ sort?: 'name' | '-name' | 'created_at' | '-created_at';
205
+ }
206
+ export interface VoiceCloneCreateFromUploadParams {
207
+ /**
208
+ * Audio file to clone the voice from. Supported formats: WAV, MP3, FLAC, OGG, M4A.
209
+ * For best quality, provide 5–10 seconds of clear, uninterrupted speech. Maximum
210
+ * size: 2MB.
211
+ */
212
+ audio_file: Uploadable;
213
+ /**
214
+ * ISO 639-1 language code (e.g. `en`, `fr`) or `auto` for automatic detection.
215
+ */
216
+ language: string;
217
+ /**
218
+ * Name for the voice clone.
219
+ */
220
+ name: string;
221
+ /**
222
+ * Gender of the voice clone.
223
+ */
224
+ gender?: 'male' | 'female' | 'neutral';
225
+ /**
226
+ * Optional custom label describing the voice style. If omitted, falls back to the
227
+ * source design's prompt text.
228
+ */
229
+ label?: string;
230
+ /**
231
+ * Optional transcript of the audio file. Providing this improves clone quality.
232
+ */
233
+ ref_text?: string;
234
+ }
235
+ export declare namespace VoiceClones {
236
+ export { type VoiceCloneData as VoiceCloneData, type VoiceCloneCreateResponse as VoiceCloneCreateResponse, type VoiceCloneUpdateResponse as VoiceCloneUpdateResponse, type VoiceCloneCreateFromUploadResponse as VoiceCloneCreateFromUploadResponse, type VoiceCloneDataDefaultFlatPagination as VoiceCloneDataDefaultFlatPagination, type VoiceCloneCreateParams as VoiceCloneCreateParams, type VoiceCloneUpdateParams as VoiceCloneUpdateParams, type VoiceCloneListParams as VoiceCloneListParams, type VoiceCloneCreateFromUploadParams as VoiceCloneCreateFromUploadParams, };
237
+ }
238
+ //# sourceMappingURL=voice-clones.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-clones.d.mts","sourceRoot":"","sources":["../src/resources/voice-clones.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,WAAW,EAAE;OACxE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CAAC;CACxD;AAED,MAAM,WAAW,gCAAgC;IAC/C;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,mCAAmC,IAAI,mCAAmC,EAC/E,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
@@ -0,0 +1,238 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { DefaultFlatPagination, type DefaultFlatPaginationParams, PagePromise } from "../core/pagination.js";
4
+ import { type Uploadable } from "../core/uploads.js";
5
+ import { RequestOptions } from "../internal/request-options.js";
6
+ /**
7
+ * Capture and manage voice identities as clones for use in text-to-speech synthesis.
8
+ */
9
+ export declare class VoiceClones extends APIResource {
10
+ /**
11
+ * Creates a new voice clone by capturing the voice identity of an existing voice
12
+ * design. The clone can then be used for text-to-speech synthesis.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const voiceClone = await client.voiceClones.create({
17
+ * gender: 'male',
18
+ * language: 'en',
19
+ * name: 'clone-narrator',
20
+ * voice_design_id: '550e8400-e29b-41d4-a716-446655440000',
21
+ * });
22
+ * ```
23
+ */
24
+ create(body: VoiceCloneCreateParams, options?: RequestOptions): APIPromise<VoiceCloneCreateResponse>;
25
+ /**
26
+ * Updates the name, language, or gender of a voice clone.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const voiceClone = await client.voiceClones.update(
31
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
32
+ * { name: 'updated-clone' },
33
+ * );
34
+ * ```
35
+ */
36
+ update(id: string, body: VoiceCloneUpdateParams, options?: RequestOptions): APIPromise<VoiceCloneUpdateResponse>;
37
+ /**
38
+ * Returns a paginated list of voice clones belonging to the authenticated account.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * // Automatically fetches more pages as needed.
43
+ * for await (const voiceCloneData of client.voiceClones.list()) {
44
+ * // ...
45
+ * }
46
+ * ```
47
+ */
48
+ list(query?: VoiceCloneListParams | null | undefined, options?: RequestOptions): PagePromise<VoiceCloneDataDefaultFlatPagination, VoiceCloneData>;
49
+ /**
50
+ * Permanently deletes a voice clone. This action cannot be undone.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * await client.voiceClones.delete(
55
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
56
+ * );
57
+ * ```
58
+ */
59
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
60
+ /**
61
+ * Creates a new voice clone by uploading an audio file directly. Supported
62
+ * formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10 seconds of
63
+ * clear speech. Maximum file size: 2MB.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const response = await client.voiceClones.createFromUpload({
68
+ * audio_file: fs.createReadStream('path/to/file'),
69
+ * language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
70
+ * name: 'name',
71
+ * });
72
+ * ```
73
+ */
74
+ createFromUpload(body: VoiceCloneCreateFromUploadParams, options?: RequestOptions): APIPromise<VoiceCloneCreateFromUploadResponse>;
75
+ /**
76
+ * Downloads the WAV audio sample that was used to create the voice clone.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const response = await client.voiceClones.downloadSample(
81
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
82
+ * );
83
+ *
84
+ * const content = await response.blob();
85
+ * console.log(content);
86
+ * ```
87
+ */
88
+ downloadSample(id: string, options?: RequestOptions): APIPromise<Response>;
89
+ }
90
+ export type VoiceCloneDataDefaultFlatPagination = DefaultFlatPagination<VoiceCloneData>;
91
+ /**
92
+ * A voice clone object.
93
+ */
94
+ export interface VoiceCloneData {
95
+ /**
96
+ * Unique identifier for the voice clone.
97
+ */
98
+ id?: string;
99
+ /**
100
+ * Timestamp when the voice clone was created.
101
+ */
102
+ created_at?: string;
103
+ /**
104
+ * Gender of the voice clone.
105
+ */
106
+ gender?: 'male' | 'female' | 'neutral' | null;
107
+ /**
108
+ * Voice style description. If not explicitly set on upload, falls back to the
109
+ * source design's prompt text.
110
+ */
111
+ label?: string | null;
112
+ /**
113
+ * ISO 639-1 language code of the voice clone.
114
+ */
115
+ language?: string | null;
116
+ /**
117
+ * Name of the voice clone.
118
+ */
119
+ name?: string;
120
+ /**
121
+ * Identifies the resource type.
122
+ */
123
+ record_type?: 'voice_clone';
124
+ /**
125
+ * UUID of the source voice design. `null` for upload-based clones.
126
+ */
127
+ source_voice_design_id?: string | null;
128
+ /**
129
+ * Version of the source voice design used. `null` for upload-based clones.
130
+ */
131
+ source_voice_design_version?: number | null;
132
+ /**
133
+ * Timestamp when the voice clone was last updated.
134
+ */
135
+ updated_at?: string;
136
+ }
137
+ /**
138
+ * Response envelope for a single voice clone.
139
+ */
140
+ export interface VoiceCloneCreateResponse {
141
+ /**
142
+ * A voice clone object.
143
+ */
144
+ data?: VoiceCloneData;
145
+ }
146
+ /**
147
+ * Response envelope for a single voice clone.
148
+ */
149
+ export interface VoiceCloneUpdateResponse {
150
+ /**
151
+ * A voice clone object.
152
+ */
153
+ data?: VoiceCloneData;
154
+ }
155
+ /**
156
+ * Response envelope for a single voice clone.
157
+ */
158
+ export interface VoiceCloneCreateFromUploadResponse {
159
+ /**
160
+ * A voice clone object.
161
+ */
162
+ data?: VoiceCloneData;
163
+ }
164
+ export interface VoiceCloneCreateParams {
165
+ /**
166
+ * Gender of the voice clone.
167
+ */
168
+ gender: 'male' | 'female' | 'neutral';
169
+ /**
170
+ * ISO 639-1 language code for the clone (e.g. `en`, `fr`, `de`).
171
+ */
172
+ language: string;
173
+ /**
174
+ * Name for the voice clone.
175
+ */
176
+ name: string;
177
+ /**
178
+ * UUID of the source voice design to clone.
179
+ */
180
+ voice_design_id: string;
181
+ }
182
+ export interface VoiceCloneUpdateParams {
183
+ /**
184
+ * New name for the voice clone.
185
+ */
186
+ name: string;
187
+ /**
188
+ * Updated gender for the voice clone.
189
+ */
190
+ gender?: 'male' | 'female' | 'neutral';
191
+ /**
192
+ * Updated ISO 639-1 language code or `auto`.
193
+ */
194
+ language?: string;
195
+ }
196
+ export interface VoiceCloneListParams extends DefaultFlatPaginationParams {
197
+ /**
198
+ * Case-insensitive substring filter on the name field.
199
+ */
200
+ 'filter[name]'?: string;
201
+ /**
202
+ * Sort order. Prefix with `-` for descending. Defaults to `-created_at`.
203
+ */
204
+ sort?: 'name' | '-name' | 'created_at' | '-created_at';
205
+ }
206
+ export interface VoiceCloneCreateFromUploadParams {
207
+ /**
208
+ * Audio file to clone the voice from. Supported formats: WAV, MP3, FLAC, OGG, M4A.
209
+ * For best quality, provide 5–10 seconds of clear, uninterrupted speech. Maximum
210
+ * size: 2MB.
211
+ */
212
+ audio_file: Uploadable;
213
+ /**
214
+ * ISO 639-1 language code (e.g. `en`, `fr`) or `auto` for automatic detection.
215
+ */
216
+ language: string;
217
+ /**
218
+ * Name for the voice clone.
219
+ */
220
+ name: string;
221
+ /**
222
+ * Gender of the voice clone.
223
+ */
224
+ gender?: 'male' | 'female' | 'neutral';
225
+ /**
226
+ * Optional custom label describing the voice style. If omitted, falls back to the
227
+ * source design's prompt text.
228
+ */
229
+ label?: string;
230
+ /**
231
+ * Optional transcript of the audio file. Providing this improves clone quality.
232
+ */
233
+ ref_text?: string;
234
+ }
235
+ export declare namespace VoiceClones {
236
+ export { type VoiceCloneData as VoiceCloneData, type VoiceCloneCreateResponse as VoiceCloneCreateResponse, type VoiceCloneUpdateResponse as VoiceCloneUpdateResponse, type VoiceCloneCreateFromUploadResponse as VoiceCloneCreateFromUploadResponse, type VoiceCloneDataDefaultFlatPagination as VoiceCloneDataDefaultFlatPagination, type VoiceCloneCreateParams as VoiceCloneCreateParams, type VoiceCloneUpdateParams as VoiceCloneUpdateParams, type VoiceCloneListParams as VoiceCloneListParams, type VoiceCloneCreateFromUploadParams as VoiceCloneCreateFromUploadParams, };
237
+ }
238
+ //# sourceMappingURL=voice-clones.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-clones.d.ts","sourceRoot":"","sources":["../src/resources/voice-clones.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,WAAW,EAAE;OACxE,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAIzB;;GAEG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAIpG;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,GAAE,oBAAoB,GAAG,IAAI,GAAG,SAAc,EACnD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,mCAAmC,EAAE,cAAc,CAAC;IAOnE;;;;;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,KAAK,mCAAmC,IAAI,mCAAmC,EAC/E,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.VoiceClones = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const pagination_1 = require("../core/pagination.js");
7
+ const headers_1 = require("../internal/headers.js");
8
+ const uploads_1 = require("../internal/uploads.js");
9
+ const path_1 = require("../internal/utils/path.js");
10
+ /**
11
+ * Capture and manage voice identities as clones for use in text-to-speech synthesis.
12
+ */
13
+ class VoiceClones extends resource_1.APIResource {
14
+ /**
15
+ * Creates a new voice clone by capturing the voice identity of an existing voice
16
+ * design. The clone can then be used for text-to-speech synthesis.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const voiceClone = await client.voiceClones.create({
21
+ * gender: 'male',
22
+ * language: 'en',
23
+ * name: 'clone-narrator',
24
+ * voice_design_id: '550e8400-e29b-41d4-a716-446655440000',
25
+ * });
26
+ * ```
27
+ */
28
+ create(body, options) {
29
+ return this._client.post('/voice_clones', { body, ...options });
30
+ }
31
+ /**
32
+ * Updates the name, language, or gender of a voice clone.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const voiceClone = await client.voiceClones.update(
37
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
38
+ * { name: 'updated-clone' },
39
+ * );
40
+ * ```
41
+ */
42
+ update(id, body, options) {
43
+ return this._client.patch((0, path_1.path) `/voice_clones/${id}`, { body, ...options });
44
+ }
45
+ /**
46
+ * Returns a paginated list of voice clones belonging to the authenticated account.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * // Automatically fetches more pages as needed.
51
+ * for await (const voiceCloneData of client.voiceClones.list()) {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ list(query = {}, options) {
57
+ return this._client.getAPIList('/voice_clones', (pagination_1.DefaultFlatPagination), {
58
+ query,
59
+ ...options,
60
+ });
61
+ }
62
+ /**
63
+ * Permanently deletes a voice clone. This action cannot be undone.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * await client.voiceClones.delete(
68
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
69
+ * );
70
+ * ```
71
+ */
72
+ delete(id, options) {
73
+ return this._client.delete((0, path_1.path) `/voice_clones/${id}`, {
74
+ ...options,
75
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
76
+ });
77
+ }
78
+ /**
79
+ * Creates a new voice clone by uploading an audio file directly. Supported
80
+ * formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10 seconds of
81
+ * clear speech. Maximum file size: 2MB.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const response = await client.voiceClones.createFromUpload({
86
+ * audio_file: fs.createReadStream('path/to/file'),
87
+ * language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
88
+ * name: 'name',
89
+ * });
90
+ * ```
91
+ */
92
+ createFromUpload(body, options) {
93
+ return this._client.post('/voice_clones/from_upload', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
94
+ }
95
+ /**
96
+ * Downloads the WAV audio sample that was used to create the voice clone.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const response = await client.voiceClones.downloadSample(
101
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
102
+ * );
103
+ *
104
+ * const content = await response.blob();
105
+ * console.log(content);
106
+ * ```
107
+ */
108
+ downloadSample(id, options) {
109
+ return this._client.get((0, path_1.path) `/voice_clones/${id}/sample`, {
110
+ ...options,
111
+ headers: (0, headers_1.buildHeaders)([{ Accept: 'audio/wav' }, options?.headers]),
112
+ __binaryResponse: true,
113
+ });
114
+ }
115
+ }
116
+ exports.VoiceClones = VoiceClones;
117
+ //# sourceMappingURL=voice-clones.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-clones.js","sourceRoot":"","sources":["../src/resources/voice-clones.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA0G;AAE1G,oDAAmD;AAEnD,oDAAkE;AAClE,oDAA8C;AAE9C;;GAEG;AACH,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAA4B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAU,EACV,IAA4B,EAC5B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,iBAAiB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAiD,EAAE,EACnD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA,kCAAqC,CAAA,EAAE;YACrF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,iBAAiB,EAAE,EAAE,EAAE;YACpD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;I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