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
@@ -1267,6 +1267,33 @@ export {
1267
1267
  type VirtualCrossConnectsCoverageListParams,
1268
1268
  type VirtualCrossConnectsCoverageListResponsesDefaultFlatPagination,
1269
1269
  } from './virtual-cross-connects-coverage';
1270
+ export {
1271
+ VoiceClones,
1272
+ type VoiceCloneData,
1273
+ type VoiceCloneCreateResponse,
1274
+ type VoiceCloneUpdateResponse,
1275
+ type VoiceCloneCreateFromUploadResponse,
1276
+ type VoiceCloneCreateParams,
1277
+ type VoiceCloneUpdateParams,
1278
+ type VoiceCloneListParams,
1279
+ type VoiceCloneCreateFromUploadParams,
1280
+ type VoiceCloneDataDefaultFlatPagination,
1281
+ } from './voice-clones';
1282
+ export {
1283
+ VoiceDesigns,
1284
+ type VoiceDesignData,
1285
+ type VoiceDesignCreateResponse,
1286
+ type VoiceDesignRetrieveResponse,
1287
+ type VoiceDesignListResponse,
1288
+ type VoiceDesignRenameResponse,
1289
+ type VoiceDesignCreateParams,
1290
+ type VoiceDesignRetrieveParams,
1291
+ type VoiceDesignListParams,
1292
+ type VoiceDesignDeleteVersionParams,
1293
+ type VoiceDesignDownloadSampleParams,
1294
+ type VoiceDesignRenameParams,
1295
+ type VoiceDesignListResponsesDefaultFlatPagination,
1296
+ } from './voice-designs';
1270
1297
  export {
1271
1298
  WebhookDeliveries,
1272
1299
  type Attempt,
@@ -0,0 +1,323 @@
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 { DefaultFlatPagination, type DefaultFlatPaginationParams, PagePromise } from '../core/pagination';
6
+ import { type Uploadable } from '../core/uploads';
7
+ import { buildHeaders } from '../internal/headers';
8
+ import { RequestOptions } from '../internal/request-options';
9
+ import { multipartFormRequestOptions } from '../internal/uploads';
10
+ import { path } from '../internal/utils/path';
11
+
12
+ /**
13
+ * Capture and manage voice identities as clones for use in text-to-speech synthesis.
14
+ */
15
+ export class VoiceClones extends APIResource {
16
+ /**
17
+ * Creates a new voice clone by capturing the voice identity of an existing voice
18
+ * design. The clone can then be used for text-to-speech synthesis.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const voiceClone = await client.voiceClones.create({
23
+ * gender: 'male',
24
+ * language: 'en',
25
+ * name: 'clone-narrator',
26
+ * voice_design_id: '550e8400-e29b-41d4-a716-446655440000',
27
+ * });
28
+ * ```
29
+ */
30
+ create(body: VoiceCloneCreateParams, options?: RequestOptions): APIPromise<VoiceCloneCreateResponse> {
31
+ return this._client.post('/voice_clones', { body, ...options });
32
+ }
33
+
34
+ /**
35
+ * Updates the name, language, or gender of a voice clone.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const voiceClone = await client.voiceClones.update(
40
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
41
+ * { name: 'updated-clone' },
42
+ * );
43
+ * ```
44
+ */
45
+ update(
46
+ id: string,
47
+ body: VoiceCloneUpdateParams,
48
+ options?: RequestOptions,
49
+ ): APIPromise<VoiceCloneUpdateResponse> {
50
+ return this._client.patch(path`/voice_clones/${id}`, { body, ...options });
51
+ }
52
+
53
+ /**
54
+ * Returns a paginated list of voice clones belonging to the authenticated account.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * // Automatically fetches more pages as needed.
59
+ * for await (const voiceCloneData of client.voiceClones.list()) {
60
+ * // ...
61
+ * }
62
+ * ```
63
+ */
64
+ list(
65
+ query: VoiceCloneListParams | null | undefined = {},
66
+ options?: RequestOptions,
67
+ ): PagePromise<VoiceCloneDataDefaultFlatPagination, VoiceCloneData> {
68
+ return this._client.getAPIList('/voice_clones', DefaultFlatPagination<VoiceCloneData>, {
69
+ query,
70
+ ...options,
71
+ });
72
+ }
73
+
74
+ /**
75
+ * Permanently deletes a voice clone. This action cannot be undone.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * await client.voiceClones.delete(
80
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
81
+ * );
82
+ * ```
83
+ */
84
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
85
+ return this._client.delete(path`/voice_clones/${id}`, {
86
+ ...options,
87
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Creates a new voice clone by uploading an audio file directly. Supported
93
+ * formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10 seconds of
94
+ * clear speech. Maximum file size: 2MB.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const response = await client.voiceClones.createFromUpload({
99
+ * audio_file: fs.createReadStream('path/to/file'),
100
+ * language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
101
+ * name: 'name',
102
+ * });
103
+ * ```
104
+ */
105
+ createFromUpload(
106
+ body: VoiceCloneCreateFromUploadParams,
107
+ options?: RequestOptions,
108
+ ): APIPromise<VoiceCloneCreateFromUploadResponse> {
109
+ return this._client.post(
110
+ '/voice_clones/from_upload',
111
+ multipartFormRequestOptions({ body, ...options }, this._client),
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Downloads the WAV audio sample that was used to create the voice clone.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const response = await client.voiceClones.downloadSample(
121
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
122
+ * );
123
+ *
124
+ * const content = await response.blob();
125
+ * console.log(content);
126
+ * ```
127
+ */
128
+ downloadSample(id: string, options?: RequestOptions): APIPromise<Response> {
129
+ return this._client.get(path`/voice_clones/${id}/sample`, {
130
+ ...options,
131
+ headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
132
+ __binaryResponse: true,
133
+ });
134
+ }
135
+ }
136
+
137
+ export type VoiceCloneDataDefaultFlatPagination = DefaultFlatPagination<VoiceCloneData>;
138
+
139
+ /**
140
+ * A voice clone object.
141
+ */
142
+ export interface VoiceCloneData {
143
+ /**
144
+ * Unique identifier for the voice clone.
145
+ */
146
+ id?: string;
147
+
148
+ /**
149
+ * Timestamp when the voice clone was created.
150
+ */
151
+ created_at?: string;
152
+
153
+ /**
154
+ * Gender of the voice clone.
155
+ */
156
+ gender?: 'male' | 'female' | 'neutral' | null;
157
+
158
+ /**
159
+ * Voice style description. If not explicitly set on upload, falls back to the
160
+ * source design's prompt text.
161
+ */
162
+ label?: string | null;
163
+
164
+ /**
165
+ * ISO 639-1 language code of the voice clone.
166
+ */
167
+ language?: string | null;
168
+
169
+ /**
170
+ * Name of the voice clone.
171
+ */
172
+ name?: string;
173
+
174
+ /**
175
+ * Identifies the resource type.
176
+ */
177
+ record_type?: 'voice_clone';
178
+
179
+ /**
180
+ * UUID of the source voice design. `null` for upload-based clones.
181
+ */
182
+ source_voice_design_id?: string | null;
183
+
184
+ /**
185
+ * Version of the source voice design used. `null` for upload-based clones.
186
+ */
187
+ source_voice_design_version?: number | null;
188
+
189
+ /**
190
+ * Timestamp when the voice clone was last updated.
191
+ */
192
+ updated_at?: string;
193
+ }
194
+
195
+ /**
196
+ * Response envelope for a single voice clone.
197
+ */
198
+ export interface VoiceCloneCreateResponse {
199
+ /**
200
+ * A voice clone object.
201
+ */
202
+ data?: VoiceCloneData;
203
+ }
204
+
205
+ /**
206
+ * Response envelope for a single voice clone.
207
+ */
208
+ export interface VoiceCloneUpdateResponse {
209
+ /**
210
+ * A voice clone object.
211
+ */
212
+ data?: VoiceCloneData;
213
+ }
214
+
215
+ /**
216
+ * Response envelope for a single voice clone.
217
+ */
218
+ export interface VoiceCloneCreateFromUploadResponse {
219
+ /**
220
+ * A voice clone object.
221
+ */
222
+ data?: VoiceCloneData;
223
+ }
224
+
225
+ export interface VoiceCloneCreateParams {
226
+ /**
227
+ * Gender of the voice clone.
228
+ */
229
+ gender: 'male' | 'female' | 'neutral';
230
+
231
+ /**
232
+ * ISO 639-1 language code for the clone (e.g. `en`, `fr`, `de`).
233
+ */
234
+ language: string;
235
+
236
+ /**
237
+ * Name for the voice clone.
238
+ */
239
+ name: string;
240
+
241
+ /**
242
+ * UUID of the source voice design to clone.
243
+ */
244
+ voice_design_id: string;
245
+ }
246
+
247
+ export interface VoiceCloneUpdateParams {
248
+ /**
249
+ * New name for the voice clone.
250
+ */
251
+ name: string;
252
+
253
+ /**
254
+ * Updated gender for the voice clone.
255
+ */
256
+ gender?: 'male' | 'female' | 'neutral';
257
+
258
+ /**
259
+ * Updated ISO 639-1 language code or `auto`.
260
+ */
261
+ language?: string;
262
+ }
263
+
264
+ export interface VoiceCloneListParams extends DefaultFlatPaginationParams {
265
+ /**
266
+ * Case-insensitive substring filter on the name field.
267
+ */
268
+ 'filter[name]'?: string;
269
+
270
+ /**
271
+ * Sort order. Prefix with `-` for descending. Defaults to `-created_at`.
272
+ */
273
+ sort?: 'name' | '-name' | 'created_at' | '-created_at';
274
+ }
275
+
276
+ export interface VoiceCloneCreateFromUploadParams {
277
+ /**
278
+ * Audio file to clone the voice from. Supported formats: WAV, MP3, FLAC, OGG, M4A.
279
+ * For best quality, provide 5–10 seconds of clear, uninterrupted speech. Maximum
280
+ * size: 2MB.
281
+ */
282
+ audio_file: Uploadable;
283
+
284
+ /**
285
+ * ISO 639-1 language code (e.g. `en`, `fr`) or `auto` for automatic detection.
286
+ */
287
+ language: string;
288
+
289
+ /**
290
+ * Name for the voice clone.
291
+ */
292
+ name: string;
293
+
294
+ /**
295
+ * Gender of the voice clone.
296
+ */
297
+ gender?: 'male' | 'female' | 'neutral';
298
+
299
+ /**
300
+ * Optional custom label describing the voice style. If omitted, falls back to the
301
+ * source design's prompt text.
302
+ */
303
+ label?: string;
304
+
305
+ /**
306
+ * Optional transcript of the audio file. Providing this improves clone quality.
307
+ */
308
+ ref_text?: string;
309
+ }
310
+
311
+ export declare namespace VoiceClones {
312
+ export {
313
+ type VoiceCloneData as VoiceCloneData,
314
+ type VoiceCloneCreateResponse as VoiceCloneCreateResponse,
315
+ type VoiceCloneUpdateResponse as VoiceCloneUpdateResponse,
316
+ type VoiceCloneCreateFromUploadResponse as VoiceCloneCreateFromUploadResponse,
317
+ type VoiceCloneDataDefaultFlatPagination as VoiceCloneDataDefaultFlatPagination,
318
+ type VoiceCloneCreateParams as VoiceCloneCreateParams,
319
+ type VoiceCloneUpdateParams as VoiceCloneUpdateParams,
320
+ type VoiceCloneListParams as VoiceCloneListParams,
321
+ type VoiceCloneCreateFromUploadParams as VoiceCloneCreateFromUploadParams,
322
+ };
323
+ }