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,424 @@
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 { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ /**
11
+ * Create and manage AI-generated voice designs using natural language prompts.
12
+ */
13
+ export class VoiceDesigns extends APIResource {
14
+ /**
15
+ * Creates a new voice design (version 1) when `voice_design_id` is omitted. When
16
+ * `voice_design_id` is provided, adds a new version to the existing design
17
+ * instead. A design can have at most 50 versions.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const voiceDesign = await client.voiceDesigns.create({
22
+ * prompt: 'Speak in a warm, friendly tone',
23
+ * text: 'Hello, welcome to our service.',
24
+ * });
25
+ * ```
26
+ */
27
+ create(body: VoiceDesignCreateParams, options?: RequestOptions): APIPromise<VoiceDesignCreateResponse> {
28
+ return this._client.post('/voice_designs', { body, ...options });
29
+ }
30
+
31
+ /**
32
+ * Returns the latest version of a voice design, or a specific version when
33
+ * `?version=N` is provided. The `id` parameter accepts either a UUID or the design
34
+ * name.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const voiceDesign = await client.voiceDesigns.retrieve(
39
+ * 'id',
40
+ * );
41
+ * ```
42
+ */
43
+ retrieve(
44
+ id: string,
45
+ query: VoiceDesignRetrieveParams | null | undefined = {},
46
+ options?: RequestOptions,
47
+ ): APIPromise<VoiceDesignRetrieveResponse> {
48
+ return this._client.get(path`/voice_designs/${id}`, { query, ...options });
49
+ }
50
+
51
+ /**
52
+ * Returns a paginated list of voice designs belonging to the authenticated
53
+ * account.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * // Automatically fetches more pages as needed.
58
+ * for await (const voiceDesignListResponse of client.voiceDesigns.list()) {
59
+ * // ...
60
+ * }
61
+ * ```
62
+ */
63
+ list(
64
+ query: VoiceDesignListParams | null | undefined = {},
65
+ options?: RequestOptions,
66
+ ): PagePromise<VoiceDesignListResponsesDefaultFlatPagination, VoiceDesignListResponse> {
67
+ return this._client.getAPIList('/voice_designs', DefaultFlatPagination<VoiceDesignListResponse>, {
68
+ query,
69
+ ...options,
70
+ });
71
+ }
72
+
73
+ /**
74
+ * Permanently deletes a voice design and all of its versions. This action cannot
75
+ * be undone.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * await client.voiceDesigns.delete('id');
80
+ * ```
81
+ */
82
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
83
+ return this._client.delete(path`/voice_designs/${id}`, {
84
+ ...options,
85
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
86
+ });
87
+ }
88
+
89
+ /**
90
+ * Permanently deletes a specific version of a voice design. The version number
91
+ * must be a positive integer.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * await client.voiceDesigns.deleteVersion(1, { id: 'id' });
96
+ * ```
97
+ */
98
+ deleteVersion(
99
+ version: number,
100
+ params: VoiceDesignDeleteVersionParams,
101
+ options?: RequestOptions,
102
+ ): APIPromise<void> {
103
+ const { id } = params;
104
+ return this._client.delete(path`/voice_designs/${id}/versions/${version}`, {
105
+ ...options,
106
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
107
+ });
108
+ }
109
+
110
+ /**
111
+ * Downloads the WAV audio sample for the voice design. Returns the latest
112
+ * version's sample by default, or a specific version when `?version=N` is
113
+ * provided. The `id` parameter accepts either a UUID or the design name.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * const response = await client.voiceDesigns.downloadSample(
118
+ * 'id',
119
+ * );
120
+ *
121
+ * const content = await response.blob();
122
+ * console.log(content);
123
+ * ```
124
+ */
125
+ downloadSample(
126
+ id: string,
127
+ query: VoiceDesignDownloadSampleParams | null | undefined = {},
128
+ options?: RequestOptions,
129
+ ): APIPromise<Response> {
130
+ return this._client.get(path`/voice_designs/${id}/sample`, {
131
+ query,
132
+ ...options,
133
+ headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
134
+ __binaryResponse: true,
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Updates the name of a voice design. All versions retain their other properties.
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * const response = await client.voiceDesigns.rename('id', {
144
+ * name: 'updated-narrator',
145
+ * });
146
+ * ```
147
+ */
148
+ rename(
149
+ id: string,
150
+ body: VoiceDesignRenameParams,
151
+ options?: RequestOptions,
152
+ ): APIPromise<VoiceDesignRenameResponse> {
153
+ return this._client.patch(path`/voice_designs/${id}`, { body, ...options });
154
+ }
155
+ }
156
+
157
+ export type VoiceDesignListResponsesDefaultFlatPagination = DefaultFlatPagination<VoiceDesignListResponse>;
158
+
159
+ /**
160
+ * A voice design object with full version detail.
161
+ */
162
+ export interface VoiceDesignData {
163
+ /**
164
+ * Unique identifier for the voice design.
165
+ */
166
+ id?: string;
167
+
168
+ /**
169
+ * Timestamp when the voice design was first created.
170
+ */
171
+ created_at?: string;
172
+
173
+ /**
174
+ * Name of the voice design.
175
+ */
176
+ name?: string;
177
+
178
+ /**
179
+ * Natural language prompt used to define the voice style for this version.
180
+ */
181
+ prompt?: string;
182
+
183
+ /**
184
+ * Identifies the resource type.
185
+ */
186
+ record_type?: 'voice_design';
187
+
188
+ /**
189
+ * Sample text used to synthesize this version.
190
+ */
191
+ text?: string;
192
+
193
+ /**
194
+ * Timestamp when the voice design was last updated.
195
+ */
196
+ updated_at?: string;
197
+
198
+ /**
199
+ * Version number of this voice design.
200
+ */
201
+ version?: number;
202
+
203
+ /**
204
+ * Timestamp when this specific version was created.
205
+ */
206
+ version_created_at?: string;
207
+
208
+ /**
209
+ * Size of the voice sample audio in bytes.
210
+ */
211
+ voice_sample_size?: number;
212
+ }
213
+
214
+ /**
215
+ * Response envelope for a single voice design with full version detail.
216
+ */
217
+ export interface VoiceDesignCreateResponse {
218
+ /**
219
+ * A voice design object with full version detail.
220
+ */
221
+ data?: VoiceDesignData;
222
+ }
223
+
224
+ /**
225
+ * Response envelope for a single voice design with full version detail.
226
+ */
227
+ export interface VoiceDesignRetrieveResponse {
228
+ /**
229
+ * A voice design object with full version detail.
230
+ */
231
+ data?: VoiceDesignData;
232
+ }
233
+
234
+ /**
235
+ * A summarized voice design object (without version-specific fields).
236
+ */
237
+ export interface VoiceDesignListResponse {
238
+ /**
239
+ * Unique identifier for the voice design.
240
+ */
241
+ id?: string;
242
+
243
+ /**
244
+ * Timestamp when the voice design was first created.
245
+ */
246
+ created_at?: string;
247
+
248
+ /**
249
+ * Name of the voice design.
250
+ */
251
+ name?: string;
252
+
253
+ /**
254
+ * Identifies the resource type.
255
+ */
256
+ record_type?: 'voice_design';
257
+
258
+ /**
259
+ * Timestamp when the voice design was last updated.
260
+ */
261
+ updated_at?: string;
262
+ }
263
+
264
+ /**
265
+ * Response envelope for a voice design after a rename operation (no
266
+ * version-specific fields).
267
+ */
268
+ export interface VoiceDesignRenameResponse {
269
+ /**
270
+ * A summarized voice design object (without version-specific fields).
271
+ */
272
+ data?: VoiceDesignRenameResponse.Data;
273
+ }
274
+
275
+ export namespace VoiceDesignRenameResponse {
276
+ /**
277
+ * A summarized voice design object (without version-specific fields).
278
+ */
279
+ export interface Data {
280
+ /**
281
+ * Unique identifier for the voice design.
282
+ */
283
+ id?: string;
284
+
285
+ /**
286
+ * Timestamp when the voice design was first created.
287
+ */
288
+ created_at?: string;
289
+
290
+ /**
291
+ * Name of the voice design.
292
+ */
293
+ name?: string;
294
+
295
+ /**
296
+ * Identifies the resource type.
297
+ */
298
+ record_type?: 'voice_design';
299
+
300
+ /**
301
+ * Timestamp when the voice design was last updated.
302
+ */
303
+ updated_at?: string;
304
+ }
305
+ }
306
+
307
+ export interface VoiceDesignCreateParams {
308
+ /**
309
+ * Natural language description of the voice style, e.g. 'Speak in a warm, friendly
310
+ * tone with a slight British accent'.
311
+ */
312
+ prompt: string;
313
+
314
+ /**
315
+ * Sample text to synthesize for this voice design.
316
+ */
317
+ text: string;
318
+
319
+ /**
320
+ * Language for synthesis. Supported values: Auto, Chinese, English, Japanese,
321
+ * Korean, German, French, Russian, Portuguese, Spanish, Italian. Defaults to Auto.
322
+ */
323
+ language?: string;
324
+
325
+ /**
326
+ * Maximum number of tokens to generate. Default: 2048.
327
+ */
328
+ max_new_tokens?: number;
329
+
330
+ /**
331
+ * Name for the voice design. Required when creating a new design
332
+ * (`voice_design_id` is not provided); ignored when adding a version. Cannot be a
333
+ * UUID.
334
+ */
335
+ name?: string;
336
+
337
+ /**
338
+ * Repetition penalty to reduce repeated patterns in generated audio. Default:
339
+ * 1.05.
340
+ */
341
+ repetition_penalty?: number;
342
+
343
+ /**
344
+ * Sampling temperature controlling randomness. Higher values produce more varied
345
+ * output. Default: 0.9.
346
+ */
347
+ temperature?: number;
348
+
349
+ /**
350
+ * Top-k sampling parameter — limits the token vocabulary considered at each step.
351
+ * Default: 50.
352
+ */
353
+ top_k?: number;
354
+
355
+ /**
356
+ * Top-p (nucleus) sampling parameter — cumulative probability cutoff for token
357
+ * selection. Default: 1.0.
358
+ */
359
+ top_p?: number;
360
+
361
+ /**
362
+ * ID of an existing voice design to add a new version to. When provided, a new
363
+ * version is created instead of a new design.
364
+ */
365
+ voice_design_id?: string;
366
+ }
367
+
368
+ export interface VoiceDesignRetrieveParams {
369
+ /**
370
+ * Specific version number to retrieve. Defaults to the latest version.
371
+ */
372
+ version?: number;
373
+ }
374
+
375
+ export interface VoiceDesignListParams extends DefaultFlatPaginationParams {
376
+ /**
377
+ * Case-insensitive substring filter on the name field.
378
+ */
379
+ 'filter[name]'?: string;
380
+
381
+ /**
382
+ * Sort order. Prefix with `-` for descending. Defaults to `-created_at`.
383
+ */
384
+ sort?: 'name' | '-name' | 'created_at' | '-created_at';
385
+ }
386
+
387
+ export interface VoiceDesignDeleteVersionParams {
388
+ /**
389
+ * The voice design UUID or name.
390
+ */
391
+ id: string;
392
+ }
393
+
394
+ export interface VoiceDesignDownloadSampleParams {
395
+ /**
396
+ * Specific version number to download the sample for. Defaults to the latest
397
+ * version.
398
+ */
399
+ version?: number;
400
+ }
401
+
402
+ export interface VoiceDesignRenameParams {
403
+ /**
404
+ * New name for the voice design.
405
+ */
406
+ name: string;
407
+ }
408
+
409
+ export declare namespace VoiceDesigns {
410
+ export {
411
+ type VoiceDesignData as VoiceDesignData,
412
+ type VoiceDesignCreateResponse as VoiceDesignCreateResponse,
413
+ type VoiceDesignRetrieveResponse as VoiceDesignRetrieveResponse,
414
+ type VoiceDesignListResponse as VoiceDesignListResponse,
415
+ type VoiceDesignRenameResponse as VoiceDesignRenameResponse,
416
+ type VoiceDesignListResponsesDefaultFlatPagination as VoiceDesignListResponsesDefaultFlatPagination,
417
+ type VoiceDesignCreateParams as VoiceDesignCreateParams,
418
+ type VoiceDesignRetrieveParams as VoiceDesignRetrieveParams,
419
+ type VoiceDesignListParams as VoiceDesignListParams,
420
+ type VoiceDesignDeleteVersionParams as VoiceDesignDeleteVersionParams,
421
+ type VoiceDesignDownloadSampleParams as VoiceDesignDownloadSampleParams,
422
+ type VoiceDesignRenameParams as VoiceDesignRenameParams,
423
+ };
424
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.8.2'; // x-release-please-version
1
+ export const VERSION = '6.10.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "6.8.2";
1
+ export declare const VERSION = "6.10.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "6.8.2";
1
+ export declare const VERSION = "6.10.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
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 = '6.8.2'; // x-release-please-version
4
+ exports.VERSION = '6.10.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '6.8.2'; // x-release-please-version
1
+ export const VERSION = '6.10.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
package/version.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}