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,312 @@
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 { RequestOptions } from "../internal/request-options.js";
5
+ /**
6
+ * Create and manage AI-generated voice designs using natural language prompts.
7
+ */
8
+ export declare class VoiceDesigns extends APIResource {
9
+ /**
10
+ * Creates a new voice design (version 1) when `voice_design_id` is omitted. When
11
+ * `voice_design_id` is provided, adds a new version to the existing design
12
+ * instead. A design can have at most 50 versions.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const voiceDesign = await client.voiceDesigns.create({
17
+ * prompt: 'Speak in a warm, friendly tone',
18
+ * text: 'Hello, welcome to our service.',
19
+ * });
20
+ * ```
21
+ */
22
+ create(body: VoiceDesignCreateParams, options?: RequestOptions): APIPromise<VoiceDesignCreateResponse>;
23
+ /**
24
+ * Returns the latest version of a voice design, or a specific version when
25
+ * `?version=N` is provided. The `id` parameter accepts either a UUID or the design
26
+ * name.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const voiceDesign = await client.voiceDesigns.retrieve(
31
+ * 'id',
32
+ * );
33
+ * ```
34
+ */
35
+ retrieve(id: string, query?: VoiceDesignRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<VoiceDesignRetrieveResponse>;
36
+ /**
37
+ * Returns a paginated list of voice designs belonging to the authenticated
38
+ * account.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * // Automatically fetches more pages as needed.
43
+ * for await (const voiceDesignListResponse of client.voiceDesigns.list()) {
44
+ * // ...
45
+ * }
46
+ * ```
47
+ */
48
+ list(query?: VoiceDesignListParams | null | undefined, options?: RequestOptions): PagePromise<VoiceDesignListResponsesDefaultFlatPagination, VoiceDesignListResponse>;
49
+ /**
50
+ * Permanently deletes a voice design and all of its versions. This action cannot
51
+ * be undone.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * await client.voiceDesigns.delete('id');
56
+ * ```
57
+ */
58
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
59
+ /**
60
+ * Permanently deletes a specific version of a voice design. The version number
61
+ * must be a positive integer.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * await client.voiceDesigns.deleteVersion(1, { id: 'id' });
66
+ * ```
67
+ */
68
+ deleteVersion(version: number, params: VoiceDesignDeleteVersionParams, options?: RequestOptions): APIPromise<void>;
69
+ /**
70
+ * Downloads the WAV audio sample for the voice design. Returns the latest
71
+ * version's sample by default, or a specific version when `?version=N` is
72
+ * provided. The `id` parameter accepts either a UUID or the design name.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const response = await client.voiceDesigns.downloadSample(
77
+ * 'id',
78
+ * );
79
+ *
80
+ * const content = await response.blob();
81
+ * console.log(content);
82
+ * ```
83
+ */
84
+ downloadSample(id: string, query?: VoiceDesignDownloadSampleParams | null | undefined, options?: RequestOptions): APIPromise<Response>;
85
+ /**
86
+ * Updates the name of a voice design. All versions retain their other properties.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const response = await client.voiceDesigns.rename('id', {
91
+ * name: 'updated-narrator',
92
+ * });
93
+ * ```
94
+ */
95
+ rename(id: string, body: VoiceDesignRenameParams, options?: RequestOptions): APIPromise<VoiceDesignRenameResponse>;
96
+ }
97
+ export type VoiceDesignListResponsesDefaultFlatPagination = DefaultFlatPagination<VoiceDesignListResponse>;
98
+ /**
99
+ * A voice design object with full version detail.
100
+ */
101
+ export interface VoiceDesignData {
102
+ /**
103
+ * Unique identifier for the voice design.
104
+ */
105
+ id?: string;
106
+ /**
107
+ * Timestamp when the voice design was first created.
108
+ */
109
+ created_at?: string;
110
+ /**
111
+ * Name of the voice design.
112
+ */
113
+ name?: string;
114
+ /**
115
+ * Natural language prompt used to define the voice style for this version.
116
+ */
117
+ prompt?: string;
118
+ /**
119
+ * Identifies the resource type.
120
+ */
121
+ record_type?: 'voice_design';
122
+ /**
123
+ * Sample text used to synthesize this version.
124
+ */
125
+ text?: string;
126
+ /**
127
+ * Timestamp when the voice design was last updated.
128
+ */
129
+ updated_at?: string;
130
+ /**
131
+ * Version number of this voice design.
132
+ */
133
+ version?: number;
134
+ /**
135
+ * Timestamp when this specific version was created.
136
+ */
137
+ version_created_at?: string;
138
+ /**
139
+ * Size of the voice sample audio in bytes.
140
+ */
141
+ voice_sample_size?: number;
142
+ }
143
+ /**
144
+ * Response envelope for a single voice design with full version detail.
145
+ */
146
+ export interface VoiceDesignCreateResponse {
147
+ /**
148
+ * A voice design object with full version detail.
149
+ */
150
+ data?: VoiceDesignData;
151
+ }
152
+ /**
153
+ * Response envelope for a single voice design with full version detail.
154
+ */
155
+ export interface VoiceDesignRetrieveResponse {
156
+ /**
157
+ * A voice design object with full version detail.
158
+ */
159
+ data?: VoiceDesignData;
160
+ }
161
+ /**
162
+ * A summarized voice design object (without version-specific fields).
163
+ */
164
+ export interface VoiceDesignListResponse {
165
+ /**
166
+ * Unique identifier for the voice design.
167
+ */
168
+ id?: string;
169
+ /**
170
+ * Timestamp when the voice design was first created.
171
+ */
172
+ created_at?: string;
173
+ /**
174
+ * Name of the voice design.
175
+ */
176
+ name?: string;
177
+ /**
178
+ * Identifies the resource type.
179
+ */
180
+ record_type?: 'voice_design';
181
+ /**
182
+ * Timestamp when the voice design was last updated.
183
+ */
184
+ updated_at?: string;
185
+ }
186
+ /**
187
+ * Response envelope for a voice design after a rename operation (no
188
+ * version-specific fields).
189
+ */
190
+ export interface VoiceDesignRenameResponse {
191
+ /**
192
+ * A summarized voice design object (without version-specific fields).
193
+ */
194
+ data?: VoiceDesignRenameResponse.Data;
195
+ }
196
+ export declare namespace VoiceDesignRenameResponse {
197
+ /**
198
+ * A summarized voice design object (without version-specific fields).
199
+ */
200
+ interface Data {
201
+ /**
202
+ * Unique identifier for the voice design.
203
+ */
204
+ id?: string;
205
+ /**
206
+ * Timestamp when the voice design was first created.
207
+ */
208
+ created_at?: string;
209
+ /**
210
+ * Name of the voice design.
211
+ */
212
+ name?: string;
213
+ /**
214
+ * Identifies the resource type.
215
+ */
216
+ record_type?: 'voice_design';
217
+ /**
218
+ * Timestamp when the voice design was last updated.
219
+ */
220
+ updated_at?: string;
221
+ }
222
+ }
223
+ export interface VoiceDesignCreateParams {
224
+ /**
225
+ * Natural language description of the voice style, e.g. 'Speak in a warm, friendly
226
+ * tone with a slight British accent'.
227
+ */
228
+ prompt: string;
229
+ /**
230
+ * Sample text to synthesize for this voice design.
231
+ */
232
+ text: string;
233
+ /**
234
+ * Language for synthesis. Supported values: Auto, Chinese, English, Japanese,
235
+ * Korean, German, French, Russian, Portuguese, Spanish, Italian. Defaults to Auto.
236
+ */
237
+ language?: string;
238
+ /**
239
+ * Maximum number of tokens to generate. Default: 2048.
240
+ */
241
+ max_new_tokens?: number;
242
+ /**
243
+ * Name for the voice design. Required when creating a new design
244
+ * (`voice_design_id` is not provided); ignored when adding a version. Cannot be a
245
+ * UUID.
246
+ */
247
+ name?: string;
248
+ /**
249
+ * Repetition penalty to reduce repeated patterns in generated audio. Default:
250
+ * 1.05.
251
+ */
252
+ repetition_penalty?: number;
253
+ /**
254
+ * Sampling temperature controlling randomness. Higher values produce more varied
255
+ * output. Default: 0.9.
256
+ */
257
+ temperature?: number;
258
+ /**
259
+ * Top-k sampling parameter — limits the token vocabulary considered at each step.
260
+ * Default: 50.
261
+ */
262
+ top_k?: number;
263
+ /**
264
+ * Top-p (nucleus) sampling parameter — cumulative probability cutoff for token
265
+ * selection. Default: 1.0.
266
+ */
267
+ top_p?: number;
268
+ /**
269
+ * ID of an existing voice design to add a new version to. When provided, a new
270
+ * version is created instead of a new design.
271
+ */
272
+ voice_design_id?: string;
273
+ }
274
+ export interface VoiceDesignRetrieveParams {
275
+ /**
276
+ * Specific version number to retrieve. Defaults to the latest version.
277
+ */
278
+ version?: number;
279
+ }
280
+ export interface VoiceDesignListParams extends DefaultFlatPaginationParams {
281
+ /**
282
+ * Case-insensitive substring filter on the name field.
283
+ */
284
+ 'filter[name]'?: string;
285
+ /**
286
+ * Sort order. Prefix with `-` for descending. Defaults to `-created_at`.
287
+ */
288
+ sort?: 'name' | '-name' | 'created_at' | '-created_at';
289
+ }
290
+ export interface VoiceDesignDeleteVersionParams {
291
+ /**
292
+ * The voice design UUID or name.
293
+ */
294
+ id: string;
295
+ }
296
+ export interface VoiceDesignDownloadSampleParams {
297
+ /**
298
+ * Specific version number to download the sample for. Defaults to the latest
299
+ * version.
300
+ */
301
+ version?: number;
302
+ }
303
+ export interface VoiceDesignRenameParams {
304
+ /**
305
+ * New name for the voice design.
306
+ */
307
+ name: string;
308
+ }
309
+ export declare namespace VoiceDesigns {
310
+ export { type VoiceDesignData as VoiceDesignData, type VoiceDesignCreateResponse as VoiceDesignCreateResponse, type VoiceDesignRetrieveResponse as VoiceDesignRetrieveResponse, type VoiceDesignListResponse as VoiceDesignListResponse, type VoiceDesignRenameResponse as VoiceDesignRenameResponse, type VoiceDesignListResponsesDefaultFlatPagination as VoiceDesignListResponsesDefaultFlatPagination, type VoiceDesignCreateParams as VoiceDesignCreateParams, type VoiceDesignRetrieveParams as VoiceDesignRetrieveParams, type VoiceDesignListParams as VoiceDesignListParams, type VoiceDesignDeleteVersionParams as VoiceDesignDeleteVersionParams, type VoiceDesignDownloadSampleParams as VoiceDesignDownloadSampleParams, type VoiceDesignRenameParams as VoiceDesignRenameParams, };
311
+ }
312
+ //# sourceMappingURL=voice-designs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-designs.d.ts","sourceRoot":"","sources":["../src/resources/voice-designs.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,WAAW,EAAE;OAExE,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAAI,EAAE,uBA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B,IAAI,yBAAyB,EAC3D,KAAK,6CAA6C,IAAI,6CAA6C,EACnG,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -0,0 +1,131 @@
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.VoiceDesigns = 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 path_1 = require("../internal/utils/path.js");
9
+ /**
10
+ * Create and manage AI-generated voice designs using natural language prompts.
11
+ */
12
+ class VoiceDesigns extends resource_1.APIResource {
13
+ /**
14
+ * Creates a new voice design (version 1) when `voice_design_id` is omitted. When
15
+ * `voice_design_id` is provided, adds a new version to the existing design
16
+ * instead. A design can have at most 50 versions.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const voiceDesign = await client.voiceDesigns.create({
21
+ * prompt: 'Speak in a warm, friendly tone',
22
+ * text: 'Hello, welcome to our service.',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body, options) {
27
+ return this._client.post('/voice_designs', { body, ...options });
28
+ }
29
+ /**
30
+ * Returns the latest version of a voice design, or a specific version when
31
+ * `?version=N` is provided. The `id` parameter accepts either a UUID or the design
32
+ * name.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const voiceDesign = await client.voiceDesigns.retrieve(
37
+ * 'id',
38
+ * );
39
+ * ```
40
+ */
41
+ retrieve(id, query = {}, options) {
42
+ return this._client.get((0, path_1.path) `/voice_designs/${id}`, { query, ...options });
43
+ }
44
+ /**
45
+ * Returns a paginated list of voice designs belonging to the authenticated
46
+ * account.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * // Automatically fetches more pages as needed.
51
+ * for await (const voiceDesignListResponse of client.voiceDesigns.list()) {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ list(query = {}, options) {
57
+ return this._client.getAPIList('/voice_designs', (pagination_1.DefaultFlatPagination), {
58
+ query,
59
+ ...options,
60
+ });
61
+ }
62
+ /**
63
+ * Permanently deletes a voice design and all of its versions. This action cannot
64
+ * be undone.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * await client.voiceDesigns.delete('id');
69
+ * ```
70
+ */
71
+ delete(id, options) {
72
+ return this._client.delete((0, path_1.path) `/voice_designs/${id}`, {
73
+ ...options,
74
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
75
+ });
76
+ }
77
+ /**
78
+ * Permanently deletes a specific version of a voice design. The version number
79
+ * must be a positive integer.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await client.voiceDesigns.deleteVersion(1, { id: 'id' });
84
+ * ```
85
+ */
86
+ deleteVersion(version, params, options) {
87
+ const { id } = params;
88
+ return this._client.delete((0, path_1.path) `/voice_designs/${id}/versions/${version}`, {
89
+ ...options,
90
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
91
+ });
92
+ }
93
+ /**
94
+ * Downloads the WAV audio sample for the voice design. Returns the latest
95
+ * version's sample by default, or a specific version when `?version=N` is
96
+ * provided. The `id` parameter accepts either a UUID or the design name.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const response = await client.voiceDesigns.downloadSample(
101
+ * 'id',
102
+ * );
103
+ *
104
+ * const content = await response.blob();
105
+ * console.log(content);
106
+ * ```
107
+ */
108
+ downloadSample(id, query = {}, options) {
109
+ return this._client.get((0, path_1.path) `/voice_designs/${id}/sample`, {
110
+ query,
111
+ ...options,
112
+ headers: (0, headers_1.buildHeaders)([{ Accept: 'audio/wav' }, options?.headers]),
113
+ __binaryResponse: true,
114
+ });
115
+ }
116
+ /**
117
+ * Updates the name of a voice design. All versions retain their other properties.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const response = await client.voiceDesigns.rename('id', {
122
+ * name: 'updated-narrator',
123
+ * });
124
+ * ```
125
+ */
126
+ rename(id, body, options) {
127
+ return this._client.patch((0, path_1.path) `/voice_designs/${id}`, { body, ...options });
128
+ }
129
+ }
130
+ exports.VoiceDesigns = VoiceDesigns;
131
+ //# sourceMappingURL=voice-designs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-designs.js","sourceRoot":"","sources":["../src/resources/voice-designs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA0G;AAC1G,oDAAmD;AAEnD,oDAA8C;AAE9C;;GAEG;AACH,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,EAAU,EACV,QAAsD,EAAE,EACxD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,kBAAkB,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAA,kCAA8C,CAAA,EAAE;YAC/F,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO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// 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 { path } from "../internal/utils/path.mjs";
6
+ /**
7
+ * Create and manage AI-generated voice designs using natural language prompts.
8
+ */
9
+ export class VoiceDesigns extends APIResource {
10
+ /**
11
+ * Creates a new voice design (version 1) when `voice_design_id` is omitted. When
12
+ * `voice_design_id` is provided, adds a new version to the existing design
13
+ * instead. A design can have at most 50 versions.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const voiceDesign = await client.voiceDesigns.create({
18
+ * prompt: 'Speak in a warm, friendly tone',
19
+ * text: 'Hello, welcome to our service.',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body, options) {
24
+ return this._client.post('/voice_designs', { body, ...options });
25
+ }
26
+ /**
27
+ * Returns the latest version of a voice design, or a specific version when
28
+ * `?version=N` is provided. The `id` parameter accepts either a UUID or the design
29
+ * name.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const voiceDesign = await client.voiceDesigns.retrieve(
34
+ * 'id',
35
+ * );
36
+ * ```
37
+ */
38
+ retrieve(id, query = {}, options) {
39
+ return this._client.get(path `/voice_designs/${id}`, { query, ...options });
40
+ }
41
+ /**
42
+ * Returns a paginated list of voice designs belonging to the authenticated
43
+ * account.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Automatically fetches more pages as needed.
48
+ * for await (const voiceDesignListResponse of client.voiceDesigns.list()) {
49
+ * // ...
50
+ * }
51
+ * ```
52
+ */
53
+ list(query = {}, options) {
54
+ return this._client.getAPIList('/voice_designs', (DefaultFlatPagination), {
55
+ query,
56
+ ...options,
57
+ });
58
+ }
59
+ /**
60
+ * Permanently deletes a voice design and all of its versions. This action cannot
61
+ * be undone.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * await client.voiceDesigns.delete('id');
66
+ * ```
67
+ */
68
+ delete(id, options) {
69
+ return this._client.delete(path `/voice_designs/${id}`, {
70
+ ...options,
71
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
72
+ });
73
+ }
74
+ /**
75
+ * Permanently deletes a specific version of a voice design. The version number
76
+ * must be a positive integer.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * await client.voiceDesigns.deleteVersion(1, { id: 'id' });
81
+ * ```
82
+ */
83
+ deleteVersion(version, params, options) {
84
+ const { id } = params;
85
+ return this._client.delete(path `/voice_designs/${id}/versions/${version}`, {
86
+ ...options,
87
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
88
+ });
89
+ }
90
+ /**
91
+ * Downloads the WAV audio sample for the voice design. Returns the latest
92
+ * version's sample by default, or a specific version when `?version=N` is
93
+ * provided. The `id` parameter accepts either a UUID or the design name.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const response = await client.voiceDesigns.downloadSample(
98
+ * 'id',
99
+ * );
100
+ *
101
+ * const content = await response.blob();
102
+ * console.log(content);
103
+ * ```
104
+ */
105
+ downloadSample(id, query = {}, options) {
106
+ return this._client.get(path `/voice_designs/${id}/sample`, {
107
+ query,
108
+ ...options,
109
+ headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
110
+ __binaryResponse: true,
111
+ });
112
+ }
113
+ /**
114
+ * Updates the name of a voice design. All versions retain their other properties.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const response = await client.voiceDesigns.rename('id', {
119
+ * name: 'updated-narrator',
120
+ * });
121
+ * ```
122
+ */
123
+ rename(id, body, options) {
124
+ return this._client.patch(path `/voice_designs/${id}`, { body, ...options });
125
+ }
126
+ }
127
+ //# sourceMappingURL=voice-designs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-designs.mjs","sourceRoot":"","sources":["../src/resources/voice-designs.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,qBAAqB,EAAiD;OACxE,EAAE,YAA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V,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,cAAc,CACZ,EAAU,EACV,QAA4D,EAAE,EAC9D,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,kBAAkB,EAAE,SAAS,EAAE;YACzD,KAAK;YACL,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;;;;;;;;;OASG;IACH,MAAM,CACJ,EAAU,EACV,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,kBAAkB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -902,6 +902,33 @@ import {
902
902
  VirtualCrossConnectsCoverageListResponse,
903
903
  VirtualCrossConnectsCoverageListResponsesDefaultFlatPagination,
904
904
  } from './resources/virtual-cross-connects-coverage';
905
+ import {
906
+ VoiceCloneCreateFromUploadParams,
907
+ VoiceCloneCreateFromUploadResponse,
908
+ VoiceCloneCreateParams,
909
+ VoiceCloneCreateResponse,
910
+ VoiceCloneData,
911
+ VoiceCloneDataDefaultFlatPagination,
912
+ VoiceCloneListParams,
913
+ VoiceCloneUpdateParams,
914
+ VoiceCloneUpdateResponse,
915
+ VoiceClones,
916
+ } from './resources/voice-clones';
917
+ import {
918
+ VoiceDesignCreateParams,
919
+ VoiceDesignCreateResponse,
920
+ VoiceDesignData,
921
+ VoiceDesignDeleteVersionParams,
922
+ VoiceDesignDownloadSampleParams,
923
+ VoiceDesignListParams,
924
+ VoiceDesignListResponse,
925
+ VoiceDesignListResponsesDefaultFlatPagination,
926
+ VoiceDesignRenameParams,
927
+ VoiceDesignRenameResponse,
928
+ VoiceDesignRetrieveParams,
929
+ VoiceDesignRetrieveResponse,
930
+ VoiceDesigns,
931
+ } from './resources/voice-designs';
905
932
  import {
906
933
  Attempt,
907
934
  HTTP,
@@ -2818,6 +2845,14 @@ export class Telnyx {
2818
2845
  * Manage Whatsapp message templates
2819
2846
  */
2820
2847
  whatsappMessageTemplates: API.WhatsappMessageTemplates = new API.WhatsappMessageTemplates(this);
2848
+ /**
2849
+ * Capture and manage voice identities as clones for use in text-to-speech synthesis.
2850
+ */
2851
+ voiceClones: API.VoiceClones = new API.VoiceClones(this);
2852
+ /**
2853
+ * Create and manage AI-generated voice designs using natural language prompts.
2854
+ */
2855
+ voiceDesigns: API.VoiceDesigns = new API.VoiceDesigns(this);
2821
2856
  }
2822
2857
 
2823
2858
  Telnyx.Legacy = Legacy;
@@ -2975,6 +3010,8 @@ Telnyx.MessagingProfileMetrics = MessagingProfileMetrics;
2975
3010
  Telnyx.SessionAnalysis = SessionAnalysis;
2976
3011
  Telnyx.Whatsapp = Whatsapp;
2977
3012
  Telnyx.WhatsappMessageTemplates = WhatsappMessageTemplates;
3013
+ Telnyx.VoiceClones = VoiceClones;
3014
+ Telnyx.VoiceDesigns = VoiceDesigns;
2978
3015
 
2979
3016
  export declare namespace Telnyx {
2980
3017
  export type RequestOptions = Opts.RequestOptions;
@@ -4643,6 +4680,35 @@ export declare namespace Telnyx {
4643
4680
  type WhatsappMessageTemplateUpdateParams as WhatsappMessageTemplateUpdateParams,
4644
4681
  };
4645
4682
 
4683
+ export {
4684
+ VoiceClones as VoiceClones,
4685
+ type VoiceCloneData as VoiceCloneData,
4686
+ type VoiceCloneCreateResponse as VoiceCloneCreateResponse,
4687
+ type VoiceCloneUpdateResponse as VoiceCloneUpdateResponse,
4688
+ type VoiceCloneCreateFromUploadResponse as VoiceCloneCreateFromUploadResponse,
4689
+ type VoiceCloneDataDefaultFlatPagination as VoiceCloneDataDefaultFlatPagination,
4690
+ type VoiceCloneCreateParams as VoiceCloneCreateParams,
4691
+ type VoiceCloneUpdateParams as VoiceCloneUpdateParams,
4692
+ type VoiceCloneListParams as VoiceCloneListParams,
4693
+ type VoiceCloneCreateFromUploadParams as VoiceCloneCreateFromUploadParams,
4694
+ };
4695
+
4696
+ export {
4697
+ VoiceDesigns as VoiceDesigns,
4698
+ type VoiceDesignData as VoiceDesignData,
4699
+ type VoiceDesignCreateResponse as VoiceDesignCreateResponse,
4700
+ type VoiceDesignRetrieveResponse as VoiceDesignRetrieveResponse,
4701
+ type VoiceDesignListResponse as VoiceDesignListResponse,
4702
+ type VoiceDesignRenameResponse as VoiceDesignRenameResponse,
4703
+ type VoiceDesignListResponsesDefaultFlatPagination as VoiceDesignListResponsesDefaultFlatPagination,
4704
+ type VoiceDesignCreateParams as VoiceDesignCreateParams,
4705
+ type VoiceDesignRetrieveParams as VoiceDesignRetrieveParams,
4706
+ type VoiceDesignListParams as VoiceDesignListParams,
4707
+ type VoiceDesignDeleteVersionParams as VoiceDesignDeleteVersionParams,
4708
+ type VoiceDesignDownloadSampleParams as VoiceDesignDownloadSampleParams,
4709
+ type VoiceDesignRenameParams as VoiceDesignRenameParams,
4710
+ };
4711
+
4646
4712
  export type APIError = API.APIError;
4647
4713
  export type AvailablePhoneNumbersMetadata = API.AvailablePhoneNumbersMetadata;
4648
4714
  export type AzureVoiceSettings = API.AzureVoiceSettings;