telnyx 6.8.2 → 6.9.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 (43) hide show
  1. package/CHANGELOG.md +8 -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 +382 -0
  20. package/resources/voice-clones.d.mts.map +1 -0
  21. package/resources/voice-clones.d.ts +382 -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 +361 -0
  28. package/resources/voice-designs.d.mts.map +1 -0
  29. package/resources/voice-designs.d.ts +361 -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 +64 -0
  36. package/src/resources/index.ts +26 -0
  37. package/src/resources/voice-clones.ts +497 -0
  38. package/src/resources/voice-designs.ts +482 -0
  39. package/src/version.ts +1 -1
  40. package/version.d.mts +1 -1
  41. package/version.d.ts +1 -1
  42. package/version.js +1 -1
  43. package/version.mjs +1 -1
@@ -0,0 +1,382 @@
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 voiceCloneListResponse of client.voiceClones.list()) {
44
+ * // ...
45
+ * }
46
+ * ```
47
+ */
48
+ list(query?: VoiceCloneListParams | null | undefined, options?: RequestOptions): PagePromise<VoiceCloneListResponsesDefaultFlatPagination, VoiceCloneListResponse>;
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 VoiceCloneListResponsesDefaultFlatPagination = DefaultFlatPagination<VoiceCloneListResponse>;
91
+ /**
92
+ * Response envelope for a single voice clone.
93
+ */
94
+ export interface VoiceCloneCreateResponse {
95
+ /**
96
+ * A voice clone object.
97
+ */
98
+ data?: VoiceCloneCreateResponse.Data;
99
+ }
100
+ export declare namespace VoiceCloneCreateResponse {
101
+ /**
102
+ * A voice clone object.
103
+ */
104
+ interface Data {
105
+ /**
106
+ * Unique identifier for the voice clone.
107
+ */
108
+ id?: string;
109
+ /**
110
+ * Timestamp when the voice clone was created.
111
+ */
112
+ created_at?: string;
113
+ /**
114
+ * Gender of the voice clone.
115
+ */
116
+ gender?: 'male' | 'female' | 'neutral' | null;
117
+ /**
118
+ * Voice style description. If not explicitly set on upload, falls back to the
119
+ * source design's prompt text.
120
+ */
121
+ label?: string | null;
122
+ /**
123
+ * ISO 639-1 language code of the voice clone.
124
+ */
125
+ language?: string | null;
126
+ /**
127
+ * Name of the voice clone.
128
+ */
129
+ name?: string;
130
+ /**
131
+ * Identifies the resource type.
132
+ */
133
+ record_type?: 'voice_clone';
134
+ /**
135
+ * UUID of the source voice design. `null` for upload-based clones.
136
+ */
137
+ source_voice_design_id?: string | null;
138
+ /**
139
+ * Version of the source voice design used. `null` for upload-based clones.
140
+ */
141
+ source_voice_design_version?: number | null;
142
+ /**
143
+ * Timestamp when the voice clone was last updated.
144
+ */
145
+ updated_at?: string;
146
+ }
147
+ }
148
+ /**
149
+ * Response envelope for a single voice clone.
150
+ */
151
+ export interface VoiceCloneUpdateResponse {
152
+ /**
153
+ * A voice clone object.
154
+ */
155
+ data?: VoiceCloneUpdateResponse.Data;
156
+ }
157
+ export declare namespace VoiceCloneUpdateResponse {
158
+ /**
159
+ * A voice clone object.
160
+ */
161
+ interface Data {
162
+ /**
163
+ * Unique identifier for the voice clone.
164
+ */
165
+ id?: string;
166
+ /**
167
+ * Timestamp when the voice clone was created.
168
+ */
169
+ created_at?: string;
170
+ /**
171
+ * Gender of the voice clone.
172
+ */
173
+ gender?: 'male' | 'female' | 'neutral' | null;
174
+ /**
175
+ * Voice style description. If not explicitly set on upload, falls back to the
176
+ * source design's prompt text.
177
+ */
178
+ label?: string | null;
179
+ /**
180
+ * ISO 639-1 language code of the voice clone.
181
+ */
182
+ language?: string | null;
183
+ /**
184
+ * Name of the voice clone.
185
+ */
186
+ name?: string;
187
+ /**
188
+ * Identifies the resource type.
189
+ */
190
+ record_type?: 'voice_clone';
191
+ /**
192
+ * UUID of the source voice design. `null` for upload-based clones.
193
+ */
194
+ source_voice_design_id?: string | null;
195
+ /**
196
+ * Version of the source voice design used. `null` for upload-based clones.
197
+ */
198
+ source_voice_design_version?: number | null;
199
+ /**
200
+ * Timestamp when the voice clone was last updated.
201
+ */
202
+ updated_at?: string;
203
+ }
204
+ }
205
+ /**
206
+ * A voice clone object.
207
+ */
208
+ export interface VoiceCloneListResponse {
209
+ /**
210
+ * Unique identifier for the voice clone.
211
+ */
212
+ id?: string;
213
+ /**
214
+ * Timestamp when the voice clone was created.
215
+ */
216
+ created_at?: string;
217
+ /**
218
+ * Gender of the voice clone.
219
+ */
220
+ gender?: 'male' | 'female' | 'neutral' | null;
221
+ /**
222
+ * Voice style description. If not explicitly set on upload, falls back to the
223
+ * source design's prompt text.
224
+ */
225
+ label?: string | null;
226
+ /**
227
+ * ISO 639-1 language code of the voice clone.
228
+ */
229
+ language?: string | null;
230
+ /**
231
+ * Name of the voice clone.
232
+ */
233
+ name?: string;
234
+ /**
235
+ * Identifies the resource type.
236
+ */
237
+ record_type?: 'voice_clone';
238
+ /**
239
+ * UUID of the source voice design. `null` for upload-based clones.
240
+ */
241
+ source_voice_design_id?: string | null;
242
+ /**
243
+ * Version of the source voice design used. `null` for upload-based clones.
244
+ */
245
+ source_voice_design_version?: number | null;
246
+ /**
247
+ * Timestamp when the voice clone was last updated.
248
+ */
249
+ updated_at?: string;
250
+ }
251
+ /**
252
+ * Response envelope for a single voice clone.
253
+ */
254
+ export interface VoiceCloneCreateFromUploadResponse {
255
+ /**
256
+ * A voice clone object.
257
+ */
258
+ data?: VoiceCloneCreateFromUploadResponse.Data;
259
+ }
260
+ export declare namespace VoiceCloneCreateFromUploadResponse {
261
+ /**
262
+ * A voice clone object.
263
+ */
264
+ interface Data {
265
+ /**
266
+ * Unique identifier for the voice clone.
267
+ */
268
+ id?: string;
269
+ /**
270
+ * Timestamp when the voice clone was created.
271
+ */
272
+ created_at?: string;
273
+ /**
274
+ * Gender of the voice clone.
275
+ */
276
+ gender?: 'male' | 'female' | 'neutral' | null;
277
+ /**
278
+ * Voice style description. If not explicitly set on upload, falls back to the
279
+ * source design's prompt text.
280
+ */
281
+ label?: string | null;
282
+ /**
283
+ * ISO 639-1 language code of the voice clone.
284
+ */
285
+ language?: string | null;
286
+ /**
287
+ * Name of the voice clone.
288
+ */
289
+ name?: string;
290
+ /**
291
+ * Identifies the resource type.
292
+ */
293
+ record_type?: 'voice_clone';
294
+ /**
295
+ * UUID of the source voice design. `null` for upload-based clones.
296
+ */
297
+ source_voice_design_id?: string | null;
298
+ /**
299
+ * Version of the source voice design used. `null` for upload-based clones.
300
+ */
301
+ source_voice_design_version?: number | null;
302
+ /**
303
+ * Timestamp when the voice clone was last updated.
304
+ */
305
+ updated_at?: string;
306
+ }
307
+ }
308
+ export interface VoiceCloneCreateParams {
309
+ /**
310
+ * Gender of the voice clone.
311
+ */
312
+ gender: 'male' | 'female' | 'neutral';
313
+ /**
314
+ * ISO 639-1 language code for the clone (e.g. `en`, `fr`, `de`).
315
+ */
316
+ language: string;
317
+ /**
318
+ * Name for the voice clone.
319
+ */
320
+ name: string;
321
+ /**
322
+ * UUID of the source voice design to clone.
323
+ */
324
+ voice_design_id: string;
325
+ }
326
+ export interface VoiceCloneUpdateParams {
327
+ /**
328
+ * New name for the voice clone.
329
+ */
330
+ name: string;
331
+ /**
332
+ * Updated gender for the voice clone.
333
+ */
334
+ gender?: 'male' | 'female' | 'neutral';
335
+ /**
336
+ * Updated ISO 639-1 language code or `auto`.
337
+ */
338
+ language?: string;
339
+ }
340
+ export interface VoiceCloneListParams extends DefaultFlatPaginationParams {
341
+ /**
342
+ * Case-insensitive substring filter on the name field.
343
+ */
344
+ 'filter[name]'?: string;
345
+ /**
346
+ * Sort order. Prefix with `-` for descending. Defaults to `-created_at`.
347
+ */
348
+ sort?: 'name' | '-name' | 'created_at' | '-created_at';
349
+ }
350
+ export interface VoiceCloneCreateFromUploadParams {
351
+ /**
352
+ * Audio file to clone the voice from. Supported formats: WAV, MP3, FLAC, OGG, M4A.
353
+ * For best quality, provide 5–10 seconds of clear, uninterrupted speech. Maximum
354
+ * size: 2MB.
355
+ */
356
+ audio_file: Uploadable;
357
+ /**
358
+ * ISO 639-1 language code (e.g. `en`, `fr`) or `auto` for automatic detection.
359
+ */
360
+ language: string;
361
+ /**
362
+ * Name for the voice clone.
363
+ */
364
+ name: string;
365
+ /**
366
+ * Gender of the voice clone.
367
+ */
368
+ gender?: 'male' | 'female' | 'neutral';
369
+ /**
370
+ * Optional custom label describing the voice style. If omitted, falls back to the
371
+ * source design's prompt text.
372
+ */
373
+ label?: string;
374
+ /**
375
+ * Optional transcript of the audio file. Providing this improves clone quality.
376
+ */
377
+ ref_text?: string;
378
+ }
379
+ export declare namespace VoiceClones {
380
+ export { type VoiceCloneCreateResponse as VoiceCloneCreateResponse, type VoiceCloneUpdateResponse as VoiceCloneUpdateResponse, type VoiceCloneListResponse as VoiceCloneListResponse, type VoiceCloneCreateFromUploadResponse as VoiceCloneCreateFromUploadResponse, type VoiceCloneListResponsesDefaultFlatPagination as VoiceCloneListResponsesDefaultFlatPagination, type VoiceCloneCreateParams as VoiceCloneCreateParams, type VoiceCloneUpdateParams as VoiceCloneUpdateParams, type VoiceCloneListParams as VoiceCloneListParams, type VoiceCloneCreateFromUploadParams as VoiceCloneCreateFromUploadParams, };
381
+ }
382
+ //# 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;;;;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,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAqB,SAAQ,2BAA2B;IACvE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,aAAa,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,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,4CAA4C,IAAI,4CAA4C,EACjG,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 voiceCloneListResponse 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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AAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,EAAE,SAAS,EAAE;YACxD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAClE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AAxHD,kCAwHC"}
@@ -0,0 +1,113 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { DefaultFlatPagination } from "../core/pagination.mjs";
4
+ import { buildHeaders } from "../internal/headers.mjs";
5
+ import { multipartFormRequestOptions } from "../internal/uploads.mjs";
6
+ import { path } from "../internal/utils/path.mjs";
7
+ /**
8
+ * Capture and manage voice identities as clones for use in text-to-speech synthesis.
9
+ */
10
+ export class VoiceClones extends APIResource {
11
+ /**
12
+ * Creates a new voice clone by capturing the voice identity of an existing voice
13
+ * design. The clone can then be used for text-to-speech synthesis.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const voiceClone = await client.voiceClones.create({
18
+ * gender: 'male',
19
+ * language: 'en',
20
+ * name: 'clone-narrator',
21
+ * voice_design_id: '550e8400-e29b-41d4-a716-446655440000',
22
+ * });
23
+ * ```
24
+ */
25
+ create(body, options) {
26
+ return this._client.post('/voice_clones', { body, ...options });
27
+ }
28
+ /**
29
+ * Updates the name, language, or gender of a voice clone.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const voiceClone = await client.voiceClones.update(
34
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
35
+ * { name: 'updated-clone' },
36
+ * );
37
+ * ```
38
+ */
39
+ update(id, body, options) {
40
+ return this._client.patch(path `/voice_clones/${id}`, { body, ...options });
41
+ }
42
+ /**
43
+ * Returns a paginated list of voice clones belonging to the authenticated account.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Automatically fetches more pages as needed.
48
+ * for await (const voiceCloneListResponse of client.voiceClones.list()) {
49
+ * // ...
50
+ * }
51
+ * ```
52
+ */
53
+ list(query = {}, options) {
54
+ return this._client.getAPIList('/voice_clones', (DefaultFlatPagination), {
55
+ query,
56
+ ...options,
57
+ });
58
+ }
59
+ /**
60
+ * Permanently deletes a voice clone. This action cannot be undone.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * await client.voiceClones.delete(
65
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
66
+ * );
67
+ * ```
68
+ */
69
+ delete(id, options) {
70
+ return this._client.delete(path `/voice_clones/${id}`, {
71
+ ...options,
72
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
73
+ });
74
+ }
75
+ /**
76
+ * Creates a new voice clone by uploading an audio file directly. Supported
77
+ * formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10 seconds of
78
+ * clear speech. Maximum file size: 2MB.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const response = await client.voiceClones.createFromUpload({
83
+ * audio_file: fs.createReadStream('path/to/file'),
84
+ * language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
85
+ * name: 'name',
86
+ * });
87
+ * ```
88
+ */
89
+ createFromUpload(body, options) {
90
+ return this._client.post('/voice_clones/from_upload', multipartFormRequestOptions({ body, ...options }, this._client));
91
+ }
92
+ /**
93
+ * Downloads the WAV audio sample that was used to create the voice clone.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const response = await client.voiceClones.downloadSample(
98
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
99
+ * );
100
+ *
101
+ * const content = await response.blob();
102
+ * console.log(content);
103
+ * ```
104
+ */
105
+ downloadSample(id, options) {
106
+ return this._client.get(path `/voice_clones/${id}/sample`, {
107
+ ...options,
108
+ headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
109
+ __binaryResponse: true,
110
+ });
111
+ }
112
+ }
113
+ //# sourceMappingURL=voice-clones.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-clones.mjs","sourceRoot":"","sources":["../src/resources/voice-clones.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,qBAAqB,EAAiD;OAExE,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;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,IAAI,CAAA,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,qBAA6C,CAAA,EAAE;YAC7F,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,IAAI,CAAA,iBAAiB,EAAE,EAAE,EAAE;YACpD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CA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