@cartesia/cartesia-js 3.0.0-b10 → 3.0.0-b12

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 (102) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/backcompat/errors.d.mts +1 -1
  3. package/backcompat/errors.d.mts.map +1 -1
  4. package/backcompat/errors.d.ts +1 -1
  5. package/backcompat/errors.d.ts.map +1 -1
  6. package/backcompat/errors.js +1 -1
  7. package/backcompat/errors.js.map +1 -1
  8. package/backcompat/errors.mjs +1 -1
  9. package/backcompat/errors.mjs.map +1 -1
  10. package/backcompat/index.d.mts.map +1 -1
  11. package/backcompat/index.d.ts.map +1 -1
  12. package/backcompat/index.js +5 -5
  13. package/backcompat/index.js.map +1 -1
  14. package/backcompat/index.mjs +5 -5
  15. package/backcompat/index.mjs.map +1 -1
  16. package/backcompat/tts-wrapper.d.mts +33 -10
  17. package/backcompat/tts-wrapper.d.mts.map +1 -1
  18. package/backcompat/tts-wrapper.d.ts +33 -10
  19. package/backcompat/tts-wrapper.d.ts.map +1 -1
  20. package/backcompat/tts-wrapper.js +83 -26
  21. package/backcompat/tts-wrapper.js.map +1 -1
  22. package/backcompat/tts-wrapper.mjs +85 -28
  23. package/backcompat/tts-wrapper.mjs.map +1 -1
  24. package/backcompat/types.d.mts +1 -1
  25. package/backcompat/types.d.mts.map +1 -1
  26. package/backcompat/types.d.ts +1 -1
  27. package/backcompat/types.d.ts.map +1 -1
  28. package/backcompat/voice-changer-wrapper.d.mts +4 -4
  29. package/backcompat/voice-changer-wrapper.d.mts.map +1 -1
  30. package/backcompat/voice-changer-wrapper.d.ts +4 -4
  31. package/backcompat/voice-changer-wrapper.d.ts.map +1 -1
  32. package/backcompat/voice-changer-wrapper.js +6 -6
  33. package/backcompat/voice-changer-wrapper.js.map +1 -1
  34. package/backcompat/voice-changer-wrapper.mjs +7 -7
  35. package/backcompat/voice-changer-wrapper.mjs.map +1 -1
  36. package/backcompat/voices-wrapper.d.mts +18 -5
  37. package/backcompat/voices-wrapper.d.mts.map +1 -1
  38. package/backcompat/voices-wrapper.d.ts +18 -5
  39. package/backcompat/voices-wrapper.d.ts.map +1 -1
  40. package/backcompat/voices-wrapper.js +63 -0
  41. package/backcompat/voices-wrapper.js.map +1 -1
  42. package/backcompat/voices-wrapper.mjs +63 -0
  43. package/backcompat/voices-wrapper.mjs.map +1 -1
  44. package/package.json +1 -1
  45. package/resources/agents/agents.d.mts +4 -4
  46. package/resources/agents/agents.d.mts.map +1 -1
  47. package/resources/agents/agents.d.ts +4 -4
  48. package/resources/agents/agents.d.ts.map +1 -1
  49. package/resources/agents/agents.js +9 -9
  50. package/resources/agents/agents.js.map +1 -1
  51. package/resources/agents/agents.mjs +9 -9
  52. package/resources/agents/agents.mjs.map +1 -1
  53. package/resources/datasets/datasets.d.mts +3 -3
  54. package/resources/datasets/datasets.d.mts.map +1 -1
  55. package/resources/datasets/datasets.d.ts +3 -3
  56. package/resources/datasets/datasets.d.ts.map +1 -1
  57. package/resources/datasets/datasets.js +1 -1
  58. package/resources/datasets/datasets.mjs +1 -1
  59. package/resources/datasets/files.d.mts +3 -3
  60. package/resources/datasets/files.d.ts +3 -3
  61. package/resources/datasets/files.js +1 -1
  62. package/resources/datasets/files.mjs +1 -1
  63. package/resources/datasets/index.d.mts +1 -1
  64. package/resources/datasets/index.d.ts +1 -1
  65. package/resources/pronunciation-dicts.d.mts +1 -1
  66. package/resources/pronunciation-dicts.d.ts +1 -1
  67. package/resources/pronunciation-dicts.js +1 -1
  68. package/resources/pronunciation-dicts.mjs +1 -1
  69. package/resources/voice-changer.d.mts +1 -1
  70. package/resources/voice-changer.d.mts.map +1 -1
  71. package/resources/voice-changer.d.ts +1 -1
  72. package/resources/voice-changer.d.ts.map +1 -1
  73. package/resources/voice-changer.js +1 -6
  74. package/resources/voice-changer.js.map +1 -1
  75. package/resources/voice-changer.mjs +1 -6
  76. package/resources/voice-changer.mjs.map +1 -1
  77. package/resources/voices.d.mts +9 -9
  78. package/resources/voices.d.mts.map +1 -1
  79. package/resources/voices.d.ts +9 -9
  80. package/resources/voices.d.ts.map +1 -1
  81. package/resources/voices.js +14 -14
  82. package/resources/voices.js.map +1 -1
  83. package/resources/voices.mjs +14 -14
  84. package/resources/voices.mjs.map +1 -1
  85. package/src/backcompat/errors.ts +32 -40
  86. package/src/backcompat/index.ts +64 -67
  87. package/src/backcompat/tts-wrapper.ts +405 -322
  88. package/src/backcompat/types.ts +13 -13
  89. package/src/backcompat/voice-changer-wrapper.ts +58 -56
  90. package/src/backcompat/voices-wrapper.ts +217 -150
  91. package/src/resources/agents/agents.ts +10 -10
  92. package/src/resources/datasets/datasets.ts +3 -3
  93. package/src/resources/datasets/files.ts +3 -3
  94. package/src/resources/datasets/index.ts +1 -1
  95. package/src/resources/pronunciation-dicts.ts +1 -1
  96. package/src/resources/voice-changer.ts +2 -7
  97. package/src/resources/voices.ts +15 -15
  98. package/src/version.ts +1 -1
  99. package/version.d.mts +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. package/version.mjs +1 -1
@@ -1,19 +1,19 @@
1
1
  export type Supplier<T> = T | Promise<T> | (() => T | Promise<T>);
2
2
 
3
3
  export interface CartesiaClientOptions {
4
- environment?: Supplier<"https://api.cartesia.ai" | string>;
5
- /** Specify a custom URL to connect the client to. */
6
- baseUrl?: Supplier<string>;
7
- apiKey?: Supplier<string | undefined>;
8
- /** Override the Cartesia-Version header */
9
- cartesiaVersion?: string;
10
- fetcher?: any;
4
+ environment?: Supplier<'https://api.cartesia.ai' | string>;
5
+ /** Specify a custom URL to connect the client to. */
6
+ baseUrl?: Supplier<string>;
7
+ apiKey?: Supplier<string | undefined>;
8
+ /** Override the Cartesia-Version header */
9
+ cartesiaVersion?: string;
10
+ fetcher?: any;
11
11
  }
12
12
 
13
13
  export interface BackCompatRequestOptions {
14
- timeoutInSeconds?: number;
15
- maxRetries?: number;
16
- abortSignal?: AbortSignal;
17
- cartesiaVersion?: string;
18
- headers?: Record<string, string>;
19
- }
14
+ timeoutInSeconds?: number;
15
+ maxRetries?: number;
16
+ abortSignal?: AbortSignal;
17
+ cartesiaVersion?: string;
18
+ headers?: Record<string, string>;
19
+ }
@@ -1,71 +1,73 @@
1
- import * as fs from "fs";
2
- import { Cartesia } from "../client";
3
- import { type Uploadable } from "../core/uploads";
4
- import { type RequestOptions as InternalRequestOptions } from "../internal/request-options";
5
- import { Readable } from "stream";
6
- import { BackCompatRequestOptions } from "./types";
7
- import { wrap } from "./errors";
1
+ import * as fs from 'fs';
2
+ import { Cartesia } from '../client';
3
+ import { type Uploadable } from '../core/uploads';
4
+ import { type RequestOptions as InternalRequestOptions } from '../internal/request-options';
5
+ import { Readable } from 'stream';
6
+ import { BackCompatRequestOptions } from './types';
7
+ import { wrap } from './errors';
8
8
 
9
9
  export interface BackCompatVoiceChangerBytesRequest {
10
- voiceId: string;
11
- outputFormatContainer: "raw" | "wav" | "mp3";
12
- outputFormatSampleRate: 8000 | 16000 | 22050 | 24000 | 44100 | 48000;
13
- outputFormatEncoding?: "pcm_f32le" | "pcm_s16le" | "mulaw" | "alaw";
14
- outputFormatBitRate?: 32000 | 64000 | 96000 | 128000 | 192000;
10
+ voiceId: string;
11
+ outputFormatContainer: 'raw' | 'wav' | 'mp3';
12
+ outputFormatSampleRate: 8000 | 16000 | 22050 | 24000 | 44100 | 48000;
13
+ outputFormatEncoding?: 'pcm_f32le' | 'pcm_s16le' | 'mulaw' | 'alaw';
14
+ outputFormatBitRate?: 32000 | 64000 | 96000 | 128000 | 192000;
15
15
  }
16
16
 
17
17
  /** @deprecated Use the new SDK's voice changer methods on the {@link Cartesia} instance instead. */
18
18
  export class VoiceChangerWrapper {
19
- private client: Cartesia;
19
+ private client: Cartesia;
20
20
 
21
- constructor(client: Cartesia) {
22
- this.client = client;
23
- }
21
+ constructor(client: Cartesia) {
22
+ this.client = client;
23
+ }
24
24
 
25
- /** @deprecated Use {@link Cartesia.voiceChanger.changeVoiceBytes} instead. */
26
- async bytes(
27
- clip: File | fs.ReadStream | Blob,
28
- request: BackCompatVoiceChangerBytesRequest,
29
- requestOptions?: BackCompatRequestOptions
30
- ): Promise<Readable> {
31
- const params: any = {
32
- clip: clip as Uploadable,
33
- "voice[id]": request.voiceId,
34
- "output_format[container]": request.outputFormatContainer,
35
- "output_format[sample_rate]": request.outputFormatSampleRate,
36
- };
25
+ /** @deprecated Use {@link Cartesia.voiceChanger.changeVoiceBytes} instead. */
26
+ async bytes(
27
+ clip: File | fs.ReadStream | Blob,
28
+ request: BackCompatVoiceChangerBytesRequest,
29
+ requestOptions?: BackCompatRequestOptions,
30
+ ): Promise<Readable> {
31
+ const params: any = {
32
+ clip: clip as Uploadable,
33
+ 'voice[id]': request.voiceId,
34
+ 'output_format[container]': request.outputFormatContainer,
35
+ 'output_format[sample_rate]': request.outputFormatSampleRate,
36
+ };
37
37
 
38
- if (request.outputFormatEncoding) {
39
- params["output_format[encoding]"] = request.outputFormatEncoding;
40
- }
41
- if (request.outputFormatBitRate) {
42
- params["output_format[bit_rate]"] = request.outputFormatBitRate;
43
- }
38
+ if (request.outputFormatEncoding) {
39
+ params['output_format[encoding]'] = request.outputFormatEncoding;
40
+ }
41
+ if (request.outputFormatBitRate) {
42
+ params['output_format[bit_rate]'] = request.outputFormatBitRate;
43
+ }
44
44
 
45
- const options: InternalRequestOptions = {};
46
- if (requestOptions) {
47
- if (requestOptions.timeoutInSeconds) {
48
- options.timeout = requestOptions.timeoutInSeconds * 1000;
49
- }
50
- if (requestOptions.maxRetries !== undefined) {
51
- options.maxRetries = requestOptions.maxRetries;
52
- }
53
- options.headers = requestOptions.headers;
54
- options.signal = requestOptions.abortSignal;
55
- }
45
+ const options: InternalRequestOptions = {};
46
+ if (requestOptions) {
47
+ if (requestOptions.timeoutInSeconds) {
48
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
49
+ }
50
+ if (requestOptions.maxRetries !== undefined) {
51
+ options.maxRetries = requestOptions.maxRetries;
52
+ }
53
+ options.headers = requestOptions.headers;
54
+ options.signal = requestOptions.abortSignal;
55
+ }
56
56
 
57
- const response = await wrap(this.client.voiceChanger.changeVoiceBytes(params, {
58
- ...options,
59
- __binaryResponse: true,
60
- } as any));
57
+ const response = await wrap(
58
+ this.client.voiceChanger.changeVoiceBytes(params, {
59
+ ...options,
60
+ __binaryResponse: true,
61
+ } as any),
62
+ );
61
63
 
62
- const responseAny = response as any;
64
+ const responseAny = response as any;
63
65
 
64
- if (!responseAny.body) {
65
- throw new Error("Response body is null");
66
- }
66
+ if (!responseAny.body) {
67
+ throw new Error('Response body is null');
68
+ }
67
69
 
68
- // @ts-ignore
69
- return Readable.fromWeb(responseAny.body);
70
- }
70
+ // @ts-ignore
71
+ return Readable.fromWeb(responseAny.body);
72
+ }
71
73
  }
@@ -1,163 +1,230 @@
1
- import * as fs from "fs";
2
- import { Cartesia } from "../client";
3
- import { type Uploadable } from "../core/uploads";
1
+ import * as fs from 'fs';
2
+ import { Cartesia } from '../client';
3
+ import { type Uploadable } from '../core/uploads';
4
4
  import {
5
- type VoiceCloneParams,
6
- type VoiceMetadata,
7
- type SupportedLanguage,
8
- type VoiceUpdateParams,
9
- type Voice,
10
- type VoiceLocalizeParams,
11
- } from "../resources/voices";
12
- import { type RequestOptions as InternalRequestOptions } from "../internal/request-options";
13
- import { BackCompatRequestOptions } from "./types";
14
- import { wrap } from "./errors";
5
+ type VoiceCloneParams,
6
+ type VoiceMetadata,
7
+ type SupportedLanguage,
8
+ type VoiceUpdateParams,
9
+ type Voice,
10
+ type VoiceLocalizeParams,
11
+ type VoiceListParams,
12
+ } from '../resources/voices';
13
+ import { type RequestOptions as InternalRequestOptions } from '../internal/request-options';
14
+ import { BackCompatRequestOptions } from './types';
15
+ import { wrap } from './errors';
16
+
17
+ export interface BackCompatVoiceListOptions {
18
+ gender?: 'masculine' | 'feminine' | 'gender_neutral' | null;
19
+ isOwner?: boolean | null;
20
+ limit?: number | null;
21
+ q?: string | null;
22
+ expand?: Array<'preview_file_url'> | null;
23
+ }
15
24
 
16
25
  export interface BackCompatCloneVoiceRequest {
17
- name: string;
18
- description?: string;
19
- language: string;
20
- mode: "similarity" | "stability";
21
- enhance?: boolean;
22
- baseVoiceId?: string;
26
+ name: string;
27
+ description?: string;
28
+ language: string;
29
+ mode: 'similarity' | 'stability';
30
+ enhance?: boolean;
31
+ baseVoiceId?: string;
23
32
  }
24
33
 
25
34
  export interface BackCompatUpdateVoiceRequest {
26
- name: string;
27
- description: string;
35
+ name: string;
36
+ description: string;
28
37
  }
29
38
 
30
39
  export interface BackCompatLocalizeVoiceRequest {
31
- voiceId: string;
32
- name: string;
33
- description: string;
34
- language:
35
- | "en"
36
- | "de"
37
- | "es"
38
- | "fr"
39
- | "ja"
40
- | "pt"
41
- | "zh"
42
- | "hi"
43
- | "it"
44
- | "ko"
45
- | "nl"
46
- | "pl"
47
- | "ru"
48
- | "sv"
49
- | "tr";
50
- originalSpeakerGender: "male" | "female";
51
- dialect?:
52
- | "au"
53
- | "in"
54
- | "so"
55
- | "uk"
56
- | "us"
57
- | "mx"
58
- | "pe"
59
- | "br"
60
- | "eu"
61
- | "ca";
40
+ voiceId: string;
41
+ name: string;
42
+ description: string;
43
+ language:
44
+ | 'en'
45
+ | 'de'
46
+ | 'es'
47
+ | 'fr'
48
+ | 'ja'
49
+ | 'pt'
50
+ | 'zh'
51
+ | 'hi'
52
+ | 'it'
53
+ | 'ko'
54
+ | 'nl'
55
+ | 'pl'
56
+ | 'ru'
57
+ | 'sv'
58
+ | 'tr';
59
+ originalSpeakerGender: 'male' | 'female';
60
+ dialect?: 'au' | 'in' | 'so' | 'uk' | 'us' | 'mx' | 'pe' | 'br' | 'eu' | 'ca';
62
61
  }
63
62
 
64
63
  /** @deprecated Use the new SDK's voices methods on the {@link Cartesia} instance instead. */
65
64
  export class VoicesWrapper {
66
- private client: Cartesia;
67
-
68
- constructor(client: Cartesia) {
69
- this.client = client;
70
- }
71
-
72
- /** @deprecated Use {@link Cartesia.voices.clone} instead. */
73
- async clone(
74
- clip: File | fs.ReadStream | Blob,
75
- request: BackCompatCloneVoiceRequest,
76
- requestOptions?: BackCompatRequestOptions
77
- ): Promise<VoiceMetadata> {
78
- const params: VoiceCloneParams = {
79
- clip: clip as Uploadable,
80
- name: request.name,
81
- language: request.language as SupportedLanguage,
82
- };
83
-
84
- if (request.description !== undefined) {
85
- params.description = request.description;
86
- }
87
- if (request.baseVoiceId !== undefined) {
88
- params.base_voice_id = request.baseVoiceId;
89
- }
90
-
91
- const options: InternalRequestOptions = {};
92
- if (requestOptions) {
93
- if (requestOptions.timeoutInSeconds) {
94
- options.timeout = requestOptions.timeoutInSeconds * 1000;
95
- }
96
- if (requestOptions.maxRetries !== undefined) {
97
- options.maxRetries = requestOptions.maxRetries;
98
- }
99
- options.headers = requestOptions.headers;
100
- options.signal = requestOptions.abortSignal;
101
- }
102
-
103
- return wrap(this.client.voices.clone(params, options));
104
- }
105
-
106
- /** @deprecated Use {@link Cartesia.voices.update} instead. */
107
- async update(
108
- id: string,
109
- request: BackCompatUpdateVoiceRequest,
110
- requestOptions?: BackCompatRequestOptions
111
- ): Promise<Voice> {
112
- const params: VoiceUpdateParams = {
113
- name: request.name,
114
- description: request.description,
115
- };
116
-
117
- const options: InternalRequestOptions = {};
118
- if (requestOptions) {
119
- if (requestOptions.timeoutInSeconds) {
120
- options.timeout = requestOptions.timeoutInSeconds * 1000;
121
- }
122
- if (requestOptions.maxRetries !== undefined) {
123
- options.maxRetries = requestOptions.maxRetries;
124
- }
125
- options.headers = requestOptions.headers;
126
- options.signal = requestOptions.abortSignal;
127
- }
128
-
129
- return wrap(this.client.voices.update(id, params, options));
130
- }
131
-
132
- /** @deprecated Use {@link Cartesia.voices.localize} instead. */
133
- async localize(
134
- request: BackCompatLocalizeVoiceRequest,
135
- requestOptions?: BackCompatRequestOptions
136
- ): Promise<VoiceMetadata> {
137
- const params: VoiceLocalizeParams = {
138
- voice_id: request.voiceId,
139
- name: request.name,
140
- description: request.description,
141
- language: request.language as any,
142
- original_speaker_gender: request.originalSpeakerGender,
143
- };
144
-
145
- if (request.dialect) {
146
- params.dialect = request.dialect as any; // Cast dialect as list might vary slightly or be strict
147
- }
148
-
149
- const options: InternalRequestOptions = {};
150
- if (requestOptions) {
151
- if (requestOptions.timeoutInSeconds) {
152
- options.timeout = requestOptions.timeoutInSeconds * 1000;
153
- }
154
- if (requestOptions.maxRetries !== undefined) {
155
- options.maxRetries = requestOptions.maxRetries;
156
- }
157
- options.headers = requestOptions.headers;
158
- options.signal = requestOptions.abortSignal;
159
- }
160
-
161
- return wrap(this.client.voices.localize(params, options));
162
- }
163
- }
65
+ private client: Cartesia;
66
+
67
+ constructor(client: Cartesia) {
68
+ this.client = client;
69
+ }
70
+
71
+ /** @deprecated Use {@link Cartesia.voices.clone} instead. */
72
+ async clone(
73
+ clip: File | fs.ReadStream | Blob,
74
+ request: BackCompatCloneVoiceRequest,
75
+ requestOptions?: BackCompatRequestOptions,
76
+ ): Promise<VoiceMetadata> {
77
+ const params: VoiceCloneParams = {
78
+ clip: clip as Uploadable,
79
+ name: request.name,
80
+ language: request.language as SupportedLanguage,
81
+ };
82
+
83
+ if (request.description !== undefined) {
84
+ params.description = request.description;
85
+ }
86
+ if (request.baseVoiceId !== undefined) {
87
+ params.base_voice_id = request.baseVoiceId;
88
+ }
89
+
90
+ const options: InternalRequestOptions = {};
91
+ if (requestOptions) {
92
+ if (requestOptions.timeoutInSeconds) {
93
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
94
+ }
95
+ if (requestOptions.maxRetries !== undefined) {
96
+ options.maxRetries = requestOptions.maxRetries;
97
+ }
98
+ options.headers = requestOptions.headers;
99
+ options.signal = requestOptions.abortSignal;
100
+ }
101
+
102
+ return wrap(this.client.voices.clone(params, options));
103
+ }
104
+
105
+ /** @deprecated Use {@link Cartesia.voices.update} instead. */
106
+ async update(
107
+ id: string,
108
+ request: BackCompatUpdateVoiceRequest,
109
+ requestOptions?: BackCompatRequestOptions,
110
+ ): Promise<Voice> {
111
+ const params: VoiceUpdateParams = {
112
+ name: request.name,
113
+ description: request.description,
114
+ };
115
+
116
+ const options: InternalRequestOptions = {};
117
+ if (requestOptions) {
118
+ if (requestOptions.timeoutInSeconds) {
119
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
120
+ }
121
+ if (requestOptions.maxRetries !== undefined) {
122
+ options.maxRetries = requestOptions.maxRetries;
123
+ }
124
+ options.headers = requestOptions.headers;
125
+ options.signal = requestOptions.abortSignal;
126
+ }
127
+
128
+ return wrap(this.client.voices.update(id, params, options));
129
+ }
130
+
131
+ /** @deprecated Use {@link Cartesia.voices.localize} instead. */
132
+ async localize(
133
+ request: BackCompatLocalizeVoiceRequest,
134
+ requestOptions?: BackCompatRequestOptions,
135
+ ): Promise<VoiceMetadata> {
136
+ const params: VoiceLocalizeParams = {
137
+ voice_id: request.voiceId,
138
+ name: request.name,
139
+ description: request.description,
140
+ language: request.language as any,
141
+ original_speaker_gender: request.originalSpeakerGender,
142
+ };
143
+
144
+ if (request.dialect) {
145
+ params.dialect = request.dialect as any; // Cast dialect as list might vary slightly or be strict
146
+ }
147
+
148
+ const options: InternalRequestOptions = {};
149
+ if (requestOptions) {
150
+ if (requestOptions.timeoutInSeconds) {
151
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
152
+ }
153
+ if (requestOptions.maxRetries !== undefined) {
154
+ options.maxRetries = requestOptions.maxRetries;
155
+ }
156
+ options.headers = requestOptions.headers;
157
+ options.signal = requestOptions.abortSignal;
158
+ }
159
+
160
+ return wrap(this.client.voices.localize(params, options));
161
+ }
162
+
163
+ /** @deprecated Use {@link Cartesia.voices.get} instead. */
164
+ async get(id: string, requestOptions?: BackCompatRequestOptions): Promise<Voice> {
165
+ const options: InternalRequestOptions = {};
166
+ if (requestOptions) {
167
+ if (requestOptions.timeoutInSeconds) {
168
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
169
+ }
170
+ if (requestOptions.maxRetries !== undefined) {
171
+ options.maxRetries = requestOptions.maxRetries;
172
+ }
173
+ options.headers = requestOptions.headers;
174
+ options.signal = requestOptions.abortSignal;
175
+ }
176
+
177
+ return wrap(this.client.voices.get(id, {}, options));
178
+ }
179
+
180
+ /** @deprecated Use {@link Cartesia.voices.list} instead. */
181
+ async list(
182
+ listOptions?: BackCompatVoiceListOptions,
183
+ requestOptions?: BackCompatRequestOptions,
184
+ ): Promise<Voice[]> {
185
+ const params: VoiceListParams = {};
186
+ if (listOptions) {
187
+ if (listOptions.gender !== undefined) params.gender = listOptions.gender;
188
+ if (listOptions.isOwner !== undefined) params.is_owner = listOptions.isOwner;
189
+ if (listOptions.limit !== undefined) params.limit = listOptions.limit;
190
+ if (listOptions.q !== undefined) params.q = listOptions.q;
191
+ if (listOptions.expand !== undefined) params.expand = listOptions.expand;
192
+ }
193
+
194
+ const options: InternalRequestOptions = {};
195
+ if (requestOptions) {
196
+ if (requestOptions.timeoutInSeconds) {
197
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
198
+ }
199
+ if (requestOptions.maxRetries !== undefined) {
200
+ options.maxRetries = requestOptions.maxRetries;
201
+ }
202
+ options.headers = requestOptions.headers;
203
+ options.signal = requestOptions.abortSignal;
204
+ }
205
+
206
+ // The new SDK returns a paginated result, we collect all pages
207
+ const voices: Voice[] = [];
208
+ for await (const voice of this.client.voices.list(params, options)) {
209
+ voices.push(voice);
210
+ }
211
+ return voices;
212
+ }
213
+
214
+ /** @deprecated Use {@link Cartesia.voices.remove} instead. */
215
+ async remove(id: string, requestOptions?: BackCompatRequestOptions): Promise<void> {
216
+ const options: InternalRequestOptions = {};
217
+ if (requestOptions) {
218
+ if (requestOptions.timeoutInSeconds) {
219
+ options.timeout = requestOptions.timeoutInSeconds * 1000;
220
+ }
221
+ if (requestOptions.maxRetries !== undefined) {
222
+ options.maxRetries = requestOptions.maxRetries;
223
+ }
224
+ options.headers = requestOptions.headers;
225
+ options.signal = requestOptions.abortSignal;
226
+ }
227
+
228
+ return wrap(this.client.voices.remove(id, options));
229
+ }
230
+ }
@@ -47,16 +47,6 @@ export class Agents extends APIResource {
47
47
  return this._client.get('/agents', options);
48
48
  }
49
49
 
50
- /**
51
- * Delete Agent
52
- */
53
- delete(agentID: string, options?: RequestOptions): APIPromise<void> {
54
- return this._client.delete(path`/agents/${agentID}`, {
55
- ...options,
56
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
57
- });
58
- }
59
-
60
50
  /**
61
51
  * List the phone numbers associated with an agent. Currently, you can only have
62
52
  * one phone number per agent and these are provisioned by Cartesia.
@@ -71,6 +61,16 @@ export class Agents extends APIResource {
71
61
  listTemplates(options?: RequestOptions): APIPromise<AgentListTemplatesResponse> {
72
62
  return this._client.get('/agents/templates', options);
73
63
  }
64
+
65
+ /**
66
+ * Delete Agent
67
+ */
68
+ remove(agentID: string, options?: RequestOptions): APIPromise<void> {
69
+ return this._client.delete(path`/agents/${agentID}`, {
70
+ ...options,
71
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
72
+ });
73
+ }
74
74
  }
75
75
 
76
76
  /**
@@ -3,10 +3,10 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as FilesAPI from './files';
5
5
  import {
6
- FileDeleteParams,
7
6
  FileListParams,
8
7
  FileListResponse,
9
8
  FileListResponsesCursorIDPage,
9
+ FileRemoveParams,
10
10
  FileUploadParams,
11
11
  Files,
12
12
  } from './files';
@@ -57,7 +57,7 @@ export class Datasets extends APIResource {
57
57
  /**
58
58
  * Delete a dataset
59
59
  */
60
- delete(id: string, options?: RequestOptions): APIPromise<void> {
60
+ remove(id: string, options?: RequestOptions): APIPromise<void> {
61
61
  return this._client.delete(path`/datasets/${id}`, {
62
62
  ...options,
63
63
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
@@ -139,7 +139,7 @@ export declare namespace Datasets {
139
139
  type FileListResponse as FileListResponse,
140
140
  type FileListResponsesCursorIDPage as FileListResponsesCursorIDPage,
141
141
  type FileListParams as FileListParams,
142
- type FileDeleteParams as FileDeleteParams,
142
+ type FileRemoveParams as FileRemoveParams,
143
143
  type FileUploadParams as FileUploadParams,
144
144
  };
145
145
  }
@@ -27,7 +27,7 @@ export class Files extends APIResource {
27
27
  /**
28
28
  * Remove a file from a dataset
29
29
  */
30
- delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<void> {
30
+ remove(fileID: string, params: FileRemoveParams, options?: RequestOptions): APIPromise<void> {
31
31
  const { id } = params;
32
32
  return this._client.delete(path`/datasets/${id}/files/${fileID}`, {
33
33
  ...options,
@@ -83,7 +83,7 @@ export interface FileListParams extends CursorIDPageParams {
83
83
  limit?: number | null;
84
84
  }
85
85
 
86
- export interface FileDeleteParams {
86
+ export interface FileRemoveParams {
87
87
  /**
88
88
  * ID of the dataset containing the file
89
89
  */
@@ -104,7 +104,7 @@ export declare namespace Files {
104
104
  type FileListResponse as FileListResponse,
105
105
  type FileListResponsesCursorIDPage as FileListResponsesCursorIDPage,
106
106
  type FileListParams as FileListParams,
107
- type FileDeleteParams as FileDeleteParams,
107
+ type FileRemoveParams as FileRemoveParams,
108
108
  type FileUploadParams as FileUploadParams,
109
109
  };
110
110
  }
@@ -12,7 +12,7 @@ export {
12
12
  Files,
13
13
  type FileListResponse,
14
14
  type FileListParams,
15
- type FileDeleteParams,
15
+ type FileRemoveParams,
16
16
  type FileUploadParams,
17
17
  type FileListResponsesCursorIDPage,
18
18
  } from './files';
@@ -49,7 +49,7 @@ export class PronunciationDicts extends APIResource {
49
49
  /**
50
50
  * Delete a pronunciation dictionary
51
51
  */
52
- delete(id: string, options?: RequestOptions): APIPromise<void> {
52
+ remove(id: string, options?: RequestOptions): APIPromise<void> {
53
53
  return this._client.delete(path`/pronunciation-dicts/${id}`, {
54
54
  ...options,
55
55
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),