Skip to content

Commit 9ecc414

Browse files
(feat): latest updates from API Definition
1 parent 24ae80e commit 9ecc414

File tree

79 files changed

+1063
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1063
-225
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- name: Compile
1717
run: yarn && yarn build
18-
18+
1919
test:
2020
runs-on: ubuntu-latest
2121

@@ -27,13 +27,13 @@ jobs:
2727
uses: actions/setup-node@v3
2828

2929
- name: Compile
30-
run: yarn && yarn test
31-
30+
run: yarn && yarn test
31+
3232
publish:
3333
needs: [ compile, test ]
3434
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
3535
runs-on: ubuntu-latest
36-
36+
3737
steps:
3838
- name: Checkout repo
3939
uses: actions/checkout@v3

.gitignore

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
node_modules
22
.DS_Store
3-
/dist
4-
/Client.d.ts
5-
/Client.js
6-
/environments.d.ts
7-
/environments.js
8-
/index.d.ts
9-
/index.js
10-
/api
11-
/core
12-
/errors
3+
/dist

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
src
3+
tests
34
.gitignore
45
.github
56
.fernignore

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "elevenlabs",
3-
"version": "v0.3.0",
3+
"version": "v0.4.0",
44
"private": false,
55
"repository": "https://github.com/elevenlabs/elevenlabs-js",
66
"license": "MIT",
77
"main": "./index.js",
88
"types": "./index.d.ts",
99
"scripts": {
10-
"format": "prettier --write 'src/**/*.ts'",
10+
"format": "prettier . --write --ignore-unknown",
1111
"build": "tsc",
1212
"prepack": "cp -rv dist/. .",
1313
"test": "jest"
@@ -27,9 +27,10 @@
2727
"jest": "^29.7.0",
2828
"@types/jest": "^29.5.5",
2929
"ts-jest": "^29.1.1",
30+
"jest-environment-jsdom": "29.7.0",
3031
"@types/node": "17.0.33",
3132
"prettier": "2.7.1",
3233
"typescript": "4.6.4",
3334
"@types/command-exists": "^1.2.3"
3435
}
35-
}
36+
}

src/api/errors/UnprocessableEntityError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* This file was auto-generated by Fern from our API Definition.
33
*/
44

5-
import * as errors from "../../errors";
6-
import * as ElevenLabs from "..";
5+
import * as errors from "../../errors/index";
6+
import * as ElevenLabs from "../index";
77

88
export class UnprocessableEntityError extends errors.ElevenLabsError {
99
constructor(body: ElevenLabs.HttpValidationError) {

src/api/resources/audioNative/client/Client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import * as environments from "../../../../environments";
66
import * as core from "../../../../core";
77
import * as fs from "fs";
8-
import * as ElevenLabs from "../../..";
8+
import * as ElevenLabs from "../../../index";
99
import { default as FormData } from "form-data";
1010
import urlJoin from "url-join";
11-
import * as errors from "../../../../errors";
11+
import * as errors from "../../../../errors/index";
1212

1313
export declare namespace AudioNative {
1414
interface Options {
@@ -28,6 +28,11 @@ export class AudioNative {
2828
/**
2929
* Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet.
3030
* @throws {@link ElevenLabs.UnprocessableEntityError}
31+
*
32+
* @example
33+
* await elevenLabs.audioNative.create(fs.createReadStream("/path/to/your/file"), {
34+
* name: "name"
35+
* })
3136
*/
3237
public async create(
3338
file: File | fs.ReadStream,
@@ -90,7 +95,7 @@ export class AudioNative {
9095
: undefined,
9196
"X-Fern-Language": "JavaScript",
9297
"X-Fern-SDK-Name": "elevenlabs",
93-
"X-Fern-SDK-Version": "v0.3.0",
98+
"X-Fern-SDK-Version": "v0.4.0",
9499
"X-Fern-Runtime": core.RUNTIME.type,
95100
"X-Fern-Runtime-Version": core.RUNTIME.version,
96101
},

src/api/resources/audioNative/client/requests/BodyCreatesAudioNativeEnabledProjectV1AudioNativePost.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
*/
44

55
/**
6+
* @example
7+
* {
8+
* name: "name"
9+
* }
10+
*
11+
* @example
12+
* {
13+
* name: "name"
14+
* }
15+
*
616
* @example
717
* {
818
* name: "name"

src/api/resources/chapters/client/Client.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import * as environments from "../../../../environments";
66
import * as core from "../../../../core";
7-
import * as ElevenLabs from "../../..";
7+
import * as ElevenLabs from "../../../index";
88
import urlJoin from "url-join";
9-
import * as errors from "../../../../errors";
9+
import * as errors from "../../../../errors/index";
1010

1111
export declare namespace Chapters {
1212
interface Options {
@@ -29,6 +29,9 @@ export class Chapters {
2929
*
3030
* @example
3131
* await elevenLabs.chapters.getAll("project_id")
32+
*
33+
* @example
34+
* await elevenLabs.chapters.getAll("string")
3235
*/
3336
public async getAll(
3437
projectId: string,
@@ -47,7 +50,7 @@ export class Chapters {
4750
: undefined,
4851
"X-Fern-Language": "JavaScript",
4952
"X-Fern-SDK-Name": "elevenlabs",
50-
"X-Fern-SDK-Version": "v0.3.0",
53+
"X-Fern-SDK-Version": "v0.4.0",
5154
"X-Fern-Runtime": core.RUNTIME.type,
5255
"X-Fern-Runtime-Version": core.RUNTIME.version,
5356
},
@@ -94,6 +97,9 @@ export class Chapters {
9497
*
9598
* @example
9699
* await elevenLabs.chapters.get("project_id", "chapter_id")
100+
*
101+
* @example
102+
* await elevenLabs.chapters.get("string", "string")
97103
*/
98104
public async get(
99105
projectId: string,
@@ -113,7 +119,7 @@ export class Chapters {
113119
: undefined,
114120
"X-Fern-Language": "JavaScript",
115121
"X-Fern-SDK-Name": "elevenlabs",
116-
"X-Fern-SDK-Version": "v0.3.0",
122+
"X-Fern-SDK-Version": "v0.4.0",
117123
"X-Fern-Runtime": core.RUNTIME.type,
118124
"X-Fern-Runtime-Version": core.RUNTIME.version,
119125
},
@@ -160,6 +166,9 @@ export class Chapters {
160166
*
161167
* @example
162168
* await elevenLabs.chapters.delete("project_id", "chapter_id")
169+
*
170+
* @example
171+
* await elevenLabs.chapters.delete("string", "string")
163172
*/
164173
public async delete(
165174
projectId: string,
@@ -179,7 +188,7 @@ export class Chapters {
179188
: undefined,
180189
"X-Fern-Language": "JavaScript",
181190
"X-Fern-SDK-Name": "elevenlabs",
182-
"X-Fern-SDK-Version": "v0.3.0",
191+
"X-Fern-SDK-Version": "v0.4.0",
183192
"X-Fern-Runtime": core.RUNTIME.type,
184193
"X-Fern-Runtime-Version": core.RUNTIME.version,
185194
},
@@ -226,6 +235,9 @@ export class Chapters {
226235
*
227236
* @example
228237
* await elevenLabs.chapters.convert("project_id", "chapter_id")
238+
*
239+
* @example
240+
* await elevenLabs.chapters.convert("string", "string")
229241
*/
230242
public async convert(
231243
projectId: string,
@@ -245,7 +257,7 @@ export class Chapters {
245257
: undefined,
246258
"X-Fern-Language": "JavaScript",
247259
"X-Fern-SDK-Name": "elevenlabs",
248-
"X-Fern-SDK-Version": "v0.3.0",
260+
"X-Fern-SDK-Version": "v0.4.0",
249261
"X-Fern-Runtime": core.RUNTIME.type,
250262
"X-Fern-Runtime-Version": core.RUNTIME.version,
251263
},
@@ -292,6 +304,9 @@ export class Chapters {
292304
*
293305
* @example
294306
* await elevenLabs.chapters.getAllSnapshots("project_id", "chapter_id")
307+
*
308+
* @example
309+
* await elevenLabs.chapters.getAllSnapshots("string", "string")
295310
*/
296311
public async getAllSnapshots(
297312
projectId: string,
@@ -311,7 +326,7 @@ export class Chapters {
311326
: undefined,
312327
"X-Fern-Language": "JavaScript",
313328
"X-Fern-SDK-Name": "elevenlabs",
314-
"X-Fern-SDK-Version": "v0.3.0",
329+
"X-Fern-SDK-Version": "v0.4.0",
315330
"X-Fern-Runtime": core.RUNTIME.type,
316331
"X-Fern-Runtime-Version": core.RUNTIME.version,
317332
},
@@ -358,6 +373,9 @@ export class Chapters {
358373
*
359374
* @example
360375
* await elevenLabs.chapters.streamSnapshot("project_id", "chapter_id", "chapter_snapshot_id")
376+
*
377+
* @example
378+
* await elevenLabs.chapters.streamSnapshot("string", "string", "string")
361379
*/
362380
public async streamSnapshot(
363381
projectId: string,
@@ -379,7 +397,7 @@ export class Chapters {
379397
: undefined,
380398
"X-Fern-Language": "JavaScript",
381399
"X-Fern-SDK-Name": "elevenlabs",
382-
"X-Fern-SDK-Version": "v0.3.0",
400+
"X-Fern-SDK-Version": "v0.4.0",
383401
"X-Fern-Runtime": core.RUNTIME.type,
384402
"X-Fern-Runtime-Version": core.RUNTIME.version,
385403
},

src/api/resources/chapters/client/requests/BodyStreamChapterAudioV1ProjectsProjectIdChaptersChapterIdSnapshotsChapterSnapshotIdStreamPost.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
*/
44

55
/**
6+
* @example
7+
* {}
8+
*
9+
* @example
10+
* {}
11+
*
612
* @example
713
* {}
814
*/

src/api/resources/dubbing/client/Client.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
import * as environments from "../../../../environments";
66
import * as core from "../../../../core";
77
import * as fs from "fs";
8-
import * as ElevenLabs from "../../..";
8+
import * as ElevenLabs from "../../../index";
99
import { default as FormData } from "form-data";
1010
import urlJoin from "url-join";
11-
import * as errors from "../../../../errors";
11+
import * as errors from "../../../../errors/index";
12+
import * as stream from "stream";
1213

1314
export declare namespace Dubbing {
1415
interface Options {
@@ -28,6 +29,11 @@ export class Dubbing {
2829
/**
2930
* Dubs provided audio or video file into given language.
3031
* @throws {@link ElevenLabs.UnprocessableEntityError}
32+
*
33+
* @example
34+
* await elevenLabs.dubbing.dubAVideoOrAnAudioFile(fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), {
35+
* target_lang: "target_lang"
36+
* })
3137
*/
3238
public async dubAVideoOrAnAudioFile(
3339
file: File | fs.ReadStream | undefined,
@@ -108,7 +114,7 @@ export class Dubbing {
108114
: undefined,
109115
"X-Fern-Language": "JavaScript",
110116
"X-Fern-SDK-Name": "elevenlabs",
111-
"X-Fern-SDK-Version": "v0.3.0",
117+
"X-Fern-SDK-Version": "v0.4.0",
112118
"X-Fern-Runtime": core.RUNTIME.type,
113119
"X-Fern-Runtime-Version": core.RUNTIME.version,
114120
},
@@ -156,6 +162,9 @@ export class Dubbing {
156162
*
157163
* @example
158164
* await elevenLabs.dubbing.getDubbingProjectMetadata("dubbing_id")
165+
*
166+
* @example
167+
* await elevenLabs.dubbing.getDubbingProjectMetadata("string")
159168
*/
160169
public async getDubbingProjectMetadata(
161170
dubbingId: string,
@@ -174,7 +183,7 @@ export class Dubbing {
174183
: undefined,
175184
"X-Fern-Language": "JavaScript",
176185
"X-Fern-SDK-Name": "elevenlabs",
177-
"X-Fern-SDK-Version": "v0.3.0",
186+
"X-Fern-SDK-Version": "v0.4.0",
178187
"X-Fern-Runtime": core.RUNTIME.type,
179188
"X-Fern-Runtime-Version": core.RUNTIME.version,
180189
},
@@ -221,6 +230,9 @@ export class Dubbing {
221230
*
222231
* @example
223232
* await elevenLabs.dubbing.deleteDubbingProject("dubbing_id")
233+
*
234+
* @example
235+
* await elevenLabs.dubbing.deleteDubbingProject("string")
224236
*/
225237
public async deleteDubbingProject(dubbingId: string, requestOptions?: Dubbing.RequestOptions): Promise<unknown> {
226238
const _response = await core.fetcher({
@@ -236,7 +248,7 @@ export class Dubbing {
236248
: undefined,
237249
"X-Fern-Language": "JavaScript",
238250
"X-Fern-SDK-Name": "elevenlabs",
239-
"X-Fern-SDK-Version": "v0.3.0",
251+
"X-Fern-SDK-Version": "v0.4.0",
240252
"X-Fern-Runtime": core.RUNTIME.type,
241253
"X-Fern-Runtime-Version": core.RUNTIME.version,
242254
},
@@ -280,16 +292,13 @@ export class Dubbing {
280292
/**
281293
* Returns dubbed file as a streamed file. Videos will be returned in MP4 format and audio only dubs will be returned in MP3.
282294
* @throws {@link ElevenLabs.UnprocessableEntityError}
283-
*
284-
* @example
285-
* await elevenLabs.dubbing.getDubbedFile("dubbing_id", "language_code")
286295
*/
287296
public async getDubbedFile(
288297
dubbingId: string,
289298
languageCode: string,
290299
requestOptions?: Dubbing.RequestOptions
291-
): Promise<void> {
292-
const _response = await core.fetcher({
300+
): Promise<stream.Readable> {
301+
const _response = await core.fetcher<stream.Readable>({
293302
url: urlJoin(
294303
(await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production,
295304
`v1/dubbing/${dubbingId}/audio/${languageCode}`
@@ -302,16 +311,17 @@ export class Dubbing {
302311
: undefined,
303312
"X-Fern-Language": "JavaScript",
304313
"X-Fern-SDK-Name": "elevenlabs",
305-
"X-Fern-SDK-Version": "v0.3.0",
314+
"X-Fern-SDK-Version": "v0.4.0",
306315
"X-Fern-Runtime": core.RUNTIME.type,
307316
"X-Fern-Runtime-Version": core.RUNTIME.version,
308317
},
309318
contentType: "application/json",
319+
responseType: "streaming",
310320
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
311321
maxRetries: requestOptions?.maxRetries,
312322
});
313323
if (_response.ok) {
314-
return;
324+
return _response.body;
315325
}
316326

317327
if (_response.error.reason === "status-code") {

0 commit comments

Comments
 (0)