diff --git a/package.json b/package.json index db5ba11..b6b8466 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elevenlabs", - "version": "0.8.0", + "version": "0.8.1", "private": false, "repository": "https://github.com/elevenlabs/elevenlabs-js", "license": "MIT", diff --git a/src/Client.ts b/src/Client.ts index 60365c9..ebf02e2 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -5,6 +5,7 @@ import * as environments from "./environments"; import * as core from "./core"; import { History } from "./api/resources/history/client/Client"; +import { TextToSoundEffects } from "./api/resources/textToSoundEffects/client/Client"; import { Samples } from "./api/resources/samples/client/Client"; import { TextToSpeech } from "./api/resources/textToSpeech/client/Client"; import { SpeechToSpeech } from "./api/resources/speechToSpeech/client/Client"; @@ -17,6 +18,7 @@ import { Dubbing } from "./api/resources/dubbing/client/Client"; import { Models } from "./api/resources/models/client/Client"; import { AudioNative } from "./api/resources/audioNative/client/Client"; import { PronunciationDictionary } from "./api/resources/pronunciationDictionary/client/Client"; +import { Workspace } from "./api/resources/workspace/client/Client"; export declare namespace ElevenLabsClient { interface Options { @@ -40,6 +42,12 @@ export class ElevenLabsClient { return (this._history ??= new History(this._options)); } + protected _textToSoundEffects: TextToSoundEffects | undefined; + + public get textToSoundEffects(): TextToSoundEffects { + return (this._textToSoundEffects ??= new TextToSoundEffects(this._options)); + } + protected _samples: Samples | undefined; public get samples(): Samples { @@ -111,4 +119,10 @@ export class ElevenLabsClient { public get pronunciationDictionary(): PronunciationDictionary { return (this._pronunciationDictionary ??= new PronunciationDictionary(this._options)); } + + protected _workspace: Workspace | undefined; + + public get workspace(): Workspace { + return (this._workspace ??= new Workspace(this._options)); + } } diff --git a/src/api/resources/audioNative/client/Client.ts b/src/api/resources/audioNative/client/Client.ts index d8c8c40..46ef5de 100644 --- a/src/api/resources/audioNative/client/Client.ts +++ b/src/api/resources/audioNative/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as ElevenLabs from "../../../index"; -import * as fs from "fs"; import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; @@ -35,7 +34,6 @@ export class AudioNative { * * @example * await elevenLabs.audioNative.create({ - * file: fs.createReadStream("/path/to/your/file"), * name: "name" * }) */ @@ -81,7 +79,10 @@ export class AudioNative { await _request.append("model_id", request.model_id); } - await _request.append("file", request.file); + if (request.file != null) { + await _request.append("file", request.file); + } + if (request.auto_convert != null) { await _request.append("auto_convert", request.auto_convert.toString()); } @@ -100,7 +101,7 @@ export class AudioNative { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), diff --git a/src/api/resources/audioNative/client/requests/BodyCreatesAudioNativeEnabledProjectV1AudioNativePost.ts b/src/api/resources/audioNative/client/requests/BodyCreatesAudioNativeEnabledProjectV1AudioNativePost.ts index 970a0a9..66ea387 100644 --- a/src/api/resources/audioNative/client/requests/BodyCreatesAudioNativeEnabledProjectV1AudioNativePost.ts +++ b/src/api/resources/audioNative/client/requests/BodyCreatesAudioNativeEnabledProjectV1AudioNativePost.ts @@ -7,7 +7,6 @@ import * as fs from "fs"; /** * @example * { - * file: fs.createReadStream("/path/to/your/file"), * name: "name" * } */ @@ -32,7 +31,7 @@ export interface BodyCreatesAudioNativeEnabledProjectV1AudioNativePost { voice_id?: string; /** TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. */ model_id?: string; - file: File | fs.ReadStream; + file?: File | fs.ReadStream | undefined; /** Whether to auto convert the project to audio or not. */ auto_convert?: boolean; } diff --git a/src/api/resources/chapters/client/Client.ts b/src/api/resources/chapters/client/Client.ts index 524ea3b..e674275 100644 --- a/src/api/resources/chapters/client/Client.ts +++ b/src/api/resources/chapters/client/Client.ts @@ -52,7 +52,7 @@ export class Chapters { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -124,7 +124,7 @@ export class Chapters { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -196,7 +196,7 @@ export class Chapters { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -268,7 +268,7 @@ export class Chapters { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -340,7 +340,7 @@ export class Chapters { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -418,7 +418,7 @@ export class Chapters { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/dubbing/client/Client.ts b/src/api/resources/dubbing/client/Client.ts index b60f3d7..6ba5925 100644 --- a/src/api/resources/dubbing/client/Client.ts +++ b/src/api/resources/dubbing/client/Client.ts @@ -114,7 +114,7 @@ export class Dubbing { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), @@ -185,7 +185,7 @@ export class Dubbing { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -252,7 +252,7 @@ export class Dubbing { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -316,7 +316,7 @@ export class Dubbing { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -358,4 +358,85 @@ export class Dubbing { }); } } + + /** + * Returns transcript for the dub as an SRT file. + * + * @param {string} dubbingId - ID of the dubbing project. + * @param {string} languageCode - ID of the language. + * @param {ElevenLabs.GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest} request + * @param {Dubbing.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.dubbing.getTranscriptForDub("dubbing_id", "language_code") + */ + public async getTranscriptForDub( + dubbingId: string, + languageCode: string, + request: ElevenLabs.GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest = {}, + requestOptions?: Dubbing.RequestOptions + ): Promise { + const { format_type: formatType } = request; + const _queryParams: Record = {}; + if (formatType != null) { + _queryParams["format_type"] = formatType; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + `v1/dubbing/${encodeURIComponent(dubbingId)}/transcript/${encodeURIComponent(languageCode)}` + ), + method: "GET", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } } diff --git a/src/api/resources/dubbing/client/requests/BodyDubAVideoOrAnAudioFileV1DubbingPost.ts b/src/api/resources/dubbing/client/requests/BodyDubAVideoOrAnAudioFileV1DubbingPost.ts index ffa67d5..8305963 100644 --- a/src/api/resources/dubbing/client/requests/BodyDubAVideoOrAnAudioFileV1DubbingPost.ts +++ b/src/api/resources/dubbing/client/requests/BodyDubAVideoOrAnAudioFileV1DubbingPost.ts @@ -11,7 +11,7 @@ import * as fs from "fs"; * } */ export interface BodyDubAVideoOrAnAudioFileV1DubbingPost { - /** automatic or manual. */ + /** automatic or manual. Manual mode is only supported when creating a dubbing studio project */ mode?: string; file?: File | fs.ReadStream | undefined; csv_file?: File | fs.ReadStream | undefined; @@ -25,7 +25,7 @@ export interface BodyDubAVideoOrAnAudioFileV1DubbingPost { source_lang?: string; /** The Target language to dub the content into. Can be none if dubbing studio editor is enabled and running manual mode */ target_lang: string; - /** Number of speakers to use for the dubbing. */ + /** Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers */ num_speakers?: number; /** Whether to apply watermark to the output video. */ watermark?: boolean; diff --git a/src/api/resources/dubbing/client/requests/GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest.ts b/src/api/resources/dubbing/client/requests/GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest.ts new file mode 100644 index 0000000..db1a153 --- /dev/null +++ b/src/api/resources/dubbing/client/requests/GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../../../../index"; + +/** + * @example + * {} + */ +export interface GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest { + /** + * Format to use for the subtitle file, either 'srt' or 'webvtt' + */ + format_type?: ElevenLabs.GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType; +} diff --git a/src/api/resources/dubbing/client/requests/index.ts b/src/api/resources/dubbing/client/requests/index.ts index 38679a0..fc997df 100644 --- a/src/api/resources/dubbing/client/requests/index.ts +++ b/src/api/resources/dubbing/client/requests/index.ts @@ -1 +1,2 @@ export { type BodyDubAVideoOrAnAudioFileV1DubbingPost } from "./BodyDubAVideoOrAnAudioFileV1DubbingPost"; +export { type GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest } from "./GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequest"; diff --git a/src/api/resources/dubbing/index.ts b/src/api/resources/dubbing/index.ts index 5ec7692..c9240f8 100644 --- a/src/api/resources/dubbing/index.ts +++ b/src/api/resources/dubbing/index.ts @@ -1 +1,2 @@ +export * from "./types"; export * from "./client"; diff --git a/src/api/resources/dubbing/types/GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType.ts b/src/api/resources/dubbing/types/GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType.ts new file mode 100644 index 0000000..1dd9c49 --- /dev/null +++ b/src/api/resources/dubbing/types/GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Format to use for the subtitle file, either 'srt' or 'webvtt' + */ +export type GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType = "srt" | "webvtt"; + +export const GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType = { + Srt: "srt", + Webvtt: "webvtt", +} as const; diff --git a/src/api/resources/dubbing/types/index.ts b/src/api/resources/dubbing/types/index.ts new file mode 100644 index 0000000..07e8929 --- /dev/null +++ b/src/api/resources/dubbing/types/index.ts @@ -0,0 +1 @@ +export * from "./GetTranscriptForDubV1DubbingDubbingIdTranscriptLanguageCodeGetRequestFormatType"; diff --git a/src/api/resources/history/client/Client.ts b/src/api/resources/history/client/Client.ts index e035825..48568ae 100644 --- a/src/api/resources/history/client/Client.ts +++ b/src/api/resources/history/client/Client.ts @@ -74,7 +74,7 @@ export class History { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -145,7 +145,7 @@ export class History { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -212,7 +212,7 @@ export class History { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -272,7 +272,7 @@ export class History { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -345,7 +345,7 @@ export class History { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 078bd10..f0ee01c 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,8 +1,13 @@ export * as textToSpeech from "./textToSpeech"; export * from "./textToSpeech/types"; +export * as dubbing from "./dubbing"; +export * from "./dubbing/types"; export * as pronunciationDictionary from "./pronunciationDictionary"; export * from "./pronunciationDictionary/types"; +export * as workspace from "./workspace"; +export * from "./workspace/types"; export * as history from "./history"; +export * as textToSoundEffects from "./textToSoundEffects"; export * as samples from "./samples"; export * as speechToSpeech from "./speechToSpeech"; export * as voiceGeneration from "./voiceGeneration"; @@ -10,10 +15,10 @@ export * as user from "./user"; export * as voices from "./voices"; export * as projects from "./projects"; export * as chapters from "./chapters"; -export * as dubbing from "./dubbing"; export * as models from "./models"; export * as audioNative from "./audioNative"; export * from "./history/client/requests"; +export * from "./textToSoundEffects/client/requests"; export * from "./textToSpeech/client/requests"; export * from "./speechToSpeech/client/requests"; export * from "./voiceGeneration/client/requests"; @@ -23,3 +28,4 @@ export * from "./chapters/client/requests"; export * from "./dubbing/client/requests"; export * from "./audioNative/client/requests"; export * from "./pronunciationDictionary/client/requests"; +export * from "./workspace/client/requests"; diff --git a/src/api/resources/models/client/Client.ts b/src/api/resources/models/client/Client.ts index faac416..db20880 100644 --- a/src/api/resources/models/client/Client.ts +++ b/src/api/resources/models/client/Client.ts @@ -51,7 +51,7 @@ export class Models { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/projects/client/Client.ts b/src/api/resources/projects/client/Client.ts index a274968..5d9e180 100644 --- a/src/api/resources/projects/client/Client.ts +++ b/src/api/resources/projects/client/Client.ts @@ -52,7 +52,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -116,6 +116,9 @@ export class Projects { ): Promise { const _request = new core.FormDataWrapper(); await _request.append("name", request.name); + await _request.append("default_title_voice_id", request.default_title_voice_id); + await _request.append("default_paragraph_voice_id", request.default_paragraph_voice_id); + await _request.append("default_model_id", request.default_model_id); if (request.from_url != null) { await _request.append("from_url", request.from_url); } @@ -124,9 +127,6 @@ export class Projects { await _request.append("from_document", request.from_document); } - await _request.append("default_title_voice_id", request.default_title_voice_id); - await _request.append("default_paragraph_voice_id", request.default_paragraph_voice_id); - await _request.append("default_model_id", request.default_model_id); if (request.quality_preset != null) { await _request.append("quality_preset", request.quality_preset); } @@ -175,7 +175,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), @@ -246,7 +246,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -288,6 +288,83 @@ export class Projects { } } + /** + * Edits basic project info. + * + * @param {string} projectId - The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + * @param {ElevenLabs.BodyEditBasicProjectInfoV1ProjectsProjectIdPost} request + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.projects.editBasicProjectInfo("project_id", { + * name: "name", + * default_title_voice_id: "default_title_voice_id", + * default_paragraph_voice_id: "default_paragraph_voice_id" + * }) + */ + public async editBasicProjectInfo( + projectId: string, + request: ElevenLabs.BodyEditBasicProjectInfoV1ProjectsProjectIdPost, + requestOptions?: Projects.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + `v1/projects/${encodeURIComponent(projectId)}` + ), + method: "POST", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body as ElevenLabs.EditProjectResponseModel; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } + /** * Delete a project by its project_id. * @@ -313,7 +390,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -380,7 +457,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -450,7 +527,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -515,7 +592,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -591,7 +668,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -668,7 +745,7 @@ export class Projects { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/projects/client/requests/BodyAddProjectV1ProjectsAddPost.ts b/src/api/resources/projects/client/requests/BodyAddProjectV1ProjectsAddPost.ts index cc3dc97..5142638 100644 --- a/src/api/resources/projects/client/requests/BodyAddProjectV1ProjectsAddPost.ts +++ b/src/api/resources/projects/client/requests/BodyAddProjectV1ProjectsAddPost.ts @@ -16,15 +16,15 @@ import * as fs from "fs"; export interface BodyAddProjectV1ProjectsAddPost { /** The name of the project, used for identification only. */ name: string; - /** An optional URL from which we will extract content to initialize the project. If this is set, 'from_url' must be null. If neither 'from_url' or 'from_document' are provided we will initialize the project as blank. */ - from_url?: string; - from_document?: File | fs.ReadStream | undefined; /** The voice_id that corresponds to the default voice used for new titles. */ default_title_voice_id: string; /** The voice_id that corresponds to the default voice used for new paragraphs. */ default_paragraph_voice_id: string; /** The model_id of the model to be used for this project, you can query GET https://api.elevenlabs.io/v1/models to list all available models. */ default_model_id: string; + /** An optional URL from which we will extract content to initialize the project. If this is set, 'from_url' must be null. If neither 'from_url' or 'from_document' are provided we will initialize the project as blank. */ + from_url?: string; + from_document?: File | fs.ReadStream | undefined; /** * Output quality of the generated audio. Must be one of: * standard - standard output format, 128kbps with 44.1kHz sample rate. @@ -44,7 +44,7 @@ export interface BodyAddProjectV1ProjectsAddPost { acx_volume_normalization?: boolean; /** When the project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements */ volume_normalization?: boolean; - /** A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody */ + /** A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"Vmd4Zor6fplcA7WrINey\",\"version_id\":\"hRPaxjlTdR7wFMhV4w0b\"}"' --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"JzWtcGQMJ6bnlWwyMo7e\",\"version_id\":\"lbmwxiLu4q6txYxgdZqn\"}"'. Note that multiple dictionaries are not currently supported by our UI which will only show the first. */ pronunciation_dictionary_locators?: string[]; /** A url that will be called by our service when the project is converted with a json containing the status of the conversion */ callback_url?: string; diff --git a/src/api/resources/projects/client/requests/BodyEditBasicProjectInfoV1ProjectsProjectIdPost.ts b/src/api/resources/projects/client/requests/BodyEditBasicProjectInfoV1ProjectsProjectIdPost.ts new file mode 100644 index 0000000..2891ff9 --- /dev/null +++ b/src/api/resources/projects/client/requests/BodyEditBasicProjectInfoV1ProjectsProjectIdPost.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * name: "name", + * default_title_voice_id: "default_title_voice_id", + * default_paragraph_voice_id: "default_paragraph_voice_id" + * } + */ +export interface BodyEditBasicProjectInfoV1ProjectsProjectIdPost { + /** The name of the project, used for identification only. */ + name: string; + /** The voice_id that corresponds to the default voice used for new titles. */ + default_title_voice_id: string; + /** The voice_id that corresponds to the default voice used for new paragraphs. */ + default_paragraph_voice_id: string; + /** An optional name of the author of the project, this will be added as metadata to the mp3 file on project / chapter download. */ + title?: string; + /** An optional name of the author of the project, this will be added as metadata to the mp3 file on project / chapter download. */ + author?: string; + /** An optional ISBN number of the project you want to create, this will be added as metadata to the mp3 file on project / chapter download. */ + isbn_number?: string; + /** When the project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements */ + volume_normalization?: boolean; +} diff --git a/src/api/resources/projects/client/requests/UpdatePronunciationDictionariesRequest.ts b/src/api/resources/projects/client/requests/UpdatePronunciationDictionariesRequest.ts index 2b85e08..e6b59db 100644 --- a/src/api/resources/projects/client/requests/UpdatePronunciationDictionariesRequest.ts +++ b/src/api/resources/projects/client/requests/UpdatePronunciationDictionariesRequest.ts @@ -14,6 +14,6 @@ import * as ElevenLabs from "../../../../index"; * } */ export interface UpdatePronunciationDictionariesRequest { - /** A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody */ + /** A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"Vmd4Zor6fplcA7WrINey\",\"version_id\":\"hRPaxjlTdR7wFMhV4w0b\"}"' --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"JzWtcGQMJ6bnlWwyMo7e\",\"version_id\":\"lbmwxiLu4q6txYxgdZqn\"}"'. Note that multiple dictionaries are not currently supported by our UI which will only show the first. */ pronunciation_dictionary_locators: ElevenLabs.PronunciationDictionaryVersionLocator[]; } diff --git a/src/api/resources/projects/client/requests/index.ts b/src/api/resources/projects/client/requests/index.ts index 3899081..1de168e 100644 --- a/src/api/resources/projects/client/requests/index.ts +++ b/src/api/resources/projects/client/requests/index.ts @@ -1,3 +1,4 @@ export { type BodyAddProjectV1ProjectsAddPost } from "./BodyAddProjectV1ProjectsAddPost"; +export { type BodyEditBasicProjectInfoV1ProjectsProjectIdPost } from "./BodyEditBasicProjectInfoV1ProjectsProjectIdPost"; export { type BodyStreamProjectAudioV1ProjectsProjectIdSnapshotsProjectSnapshotIdStreamPost } from "./BodyStreamProjectAudioV1ProjectsProjectIdSnapshotsProjectSnapshotIdStreamPost"; export { type UpdatePronunciationDictionariesRequest } from "./UpdatePronunciationDictionariesRequest"; diff --git a/src/api/resources/pronunciationDictionary/client/Client.ts b/src/api/resources/pronunciationDictionary/client/Client.ts index 69ab236..0d06196 100644 --- a/src/api/resources/pronunciationDictionary/client/Client.ts +++ b/src/api/resources/pronunciationDictionary/client/Client.ts @@ -42,15 +42,19 @@ export class PronunciationDictionary { requestOptions?: PronunciationDictionary.RequestOptions ): Promise { const _request = new core.FormDataWrapper(); + await _request.append("name", request.name); if (request.file != null) { await _request.append("file", request.file); } - await _request.append("name", request.name); if (request.description != null) { await _request.append("description", request.description); } + if (request.workspace_access != null) { + await _request.append("workspace_access", request.workspace_access); + } + const _maybeEncodedRequest = _request.getRequest(); const _response = await core.fetcher({ url: urlJoin( @@ -65,7 +69,7 @@ export class PronunciationDictionary { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), @@ -140,7 +144,7 @@ export class PronunciationDictionary { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -215,7 +219,7 @@ export class PronunciationDictionary { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -290,7 +294,7 @@ export class PronunciationDictionary { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -361,7 +365,7 @@ export class PronunciationDictionary { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -443,7 +447,7 @@ export class PronunciationDictionary { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/pronunciationDictionary/client/requests/BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromFilePost.ts b/src/api/resources/pronunciationDictionary/client/requests/BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromFilePost.ts index ac5f704..fa42ea9 100644 --- a/src/api/resources/pronunciationDictionary/client/requests/BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromFilePost.ts +++ b/src/api/resources/pronunciationDictionary/client/requests/BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromFilePost.ts @@ -3,6 +3,7 @@ */ import * as fs from "fs"; +import * as ElevenLabs from "../../../../index"; /** * @example @@ -11,9 +12,11 @@ import * as fs from "fs"; * } */ export interface BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromFilePost { - file?: File | fs.ReadStream | undefined; /** The name of the pronunciation dictionary, used for identification only. */ name: string; + file?: File | fs.ReadStream | undefined; /** A description of the pronunciation dictionary, used for identification only. */ description?: string; + /** Should be one of 'editor' or 'viewer'. If not provided, defaults to no access. */ + workspace_access?: ElevenLabs.PronunciationDictionaryAddFromFileRequestWorkspaceAccess; } diff --git a/src/api/resources/pronunciationDictionary/types/PronunciationDictionaryAddFromFileRequestWorkspaceAccess.ts b/src/api/resources/pronunciationDictionary/types/PronunciationDictionaryAddFromFileRequestWorkspaceAccess.ts new file mode 100644 index 0000000..8cc62e1 --- /dev/null +++ b/src/api/resources/pronunciationDictionary/types/PronunciationDictionaryAddFromFileRequestWorkspaceAccess.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Should be one of 'editor' or 'viewer'. If not provided, defaults to no access. + */ +export type PronunciationDictionaryAddFromFileRequestWorkspaceAccess = "admin" | "editor" | "viewer"; + +export const PronunciationDictionaryAddFromFileRequestWorkspaceAccess = { + Admin: "admin", + Editor: "editor", + Viewer: "viewer", +} as const; diff --git a/src/api/resources/pronunciationDictionary/types/index.ts b/src/api/resources/pronunciationDictionary/types/index.ts index 561821e..4ec7098 100644 --- a/src/api/resources/pronunciationDictionary/types/index.ts +++ b/src/api/resources/pronunciationDictionary/types/index.ts @@ -1 +1,2 @@ +export * from "./PronunciationDictionaryAddFromFileRequestWorkspaceAccess"; export * from "./PronunciationDictionaryRule"; diff --git a/src/api/resources/samples/client/Client.ts b/src/api/resources/samples/client/Client.ts index 68995dc..758c776 100644 --- a/src/api/resources/samples/client/Client.ts +++ b/src/api/resources/samples/client/Client.ts @@ -54,7 +54,7 @@ export class Samples { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -118,7 +118,7 @@ export class Samples { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/speechToSpeech/client/Client.ts b/src/api/resources/speechToSpeech/client/Client.ts index 0a0d876..d608704 100644 --- a/src/api/resources/speechToSpeech/client/Client.ts +++ b/src/api/resources/speechToSpeech/client/Client.ts @@ -35,6 +35,10 @@ export class SpeechToSpeech { requestOptions?: SpeechToSpeech.RequestOptions ): Promise { const _queryParams: Record = {}; + if (request.enable_logging != null) { + _queryParams["enable_logging"] = request.enable_logging; + } + if (request.optimize_streaming_latency != null) { _queryParams["optimize_streaming_latency"] = request.optimize_streaming_latency; } @@ -53,6 +57,10 @@ export class SpeechToSpeech { await _request.append("voice_settings", request.voice_settings); } + if (request.seed != null) { + await _request.append("seed", request.seed.toString()); + } + const _maybeEncodedRequest = _request.getRequest(); const _response = await core.fetcher({ url: urlJoin( @@ -67,7 +75,7 @@ export class SpeechToSpeech { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), @@ -122,6 +130,10 @@ export class SpeechToSpeech { requestOptions?: SpeechToSpeech.RequestOptions ): Promise { const _queryParams: Record = {}; + if (request.enable_logging != null) { + _queryParams["enable_logging"] = request.enable_logging; + } + if (request.optimize_streaming_latency != null) { _queryParams["optimize_streaming_latency"] = request.optimize_streaming_latency; } @@ -140,6 +152,10 @@ export class SpeechToSpeech { await _request.append("voice_settings", request.voice_settings); } + if (request.seed != null) { + await _request.append("seed", request.seed.toString()); + } + const _maybeEncodedRequest = _request.getRequest(); const _response = await core.fetcher({ url: urlJoin( @@ -154,7 +170,7 @@ export class SpeechToSpeech { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), diff --git a/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechStreamingV1SpeechToSpeechVoiceIdStreamPost.ts b/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechStreamingV1SpeechToSpeechVoiceIdStreamPost.ts index 3968668..db49e22 100644 --- a/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechStreamingV1SpeechToSpeechVoiceIdStreamPost.ts +++ b/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechStreamingV1SpeechToSpeechVoiceIdStreamPost.ts @@ -9,22 +9,40 @@ import * as ElevenLabs from "../../../../index"; * @example * { * audio: fs.createReadStream("/path/to/your/file"), - * optimize_streaming_latency: ElevenLabs.OptimizeStreamingLatency.Zero, - * output_format: ElevenLabs.OutputFormat.Mp32205032 + * enable_logging: ElevenLabs.OptimizeStreamingLatency.Zero, + * optimize_streaming_latency: ElevenLabs.OutputFormat.Mp32205032, + * output_format: "string" * } */ export interface BodySpeechToSpeechStreamingV1SpeechToSpeechVoiceIdStreamPost { /** * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. */ - optimize_streaming_latency?: ElevenLabs.OptimizeStreamingLatency; + enable_logging?: ElevenLabs.OptimizeStreamingLatency; /** * The output format of the generated audio. */ - output_format?: ElevenLabs.OutputFormat; + optimize_streaming_latency?: ElevenLabs.OutputFormat; + /** + * Output format of the generated audio. Must be one of: + * mp3_22050_32 - output format, mp3 with 22.05kHz sample rate at 32kbps. + * mp3_44100_32 - output format, mp3 with 44.1kHz sample rate at 32kbps. + * mp3_44100_64 - output format, mp3 with 44.1kHz sample rate at 64kbps. + * mp3_44100_96 - output format, mp3 with 44.1kHz sample rate at 96kbps. + * mp3_44100_128 - default output format, mp3 with 44.1kHz sample rate at 128kbps. + * mp3_44100_192 - output format, mp3 with 44.1kHz sample rate at 192kbps. Requires you to be subscribed to Creator tier or above. + * pcm_16000 - PCM format (S16LE) with 16kHz sample rate. + * pcm_22050 - PCM format (S16LE) with 22.05kHz sample rate. + * pcm_24000 - PCM format (S16LE) with 24kHz sample rate. + * pcm_44100 - PCM format (S16LE) with 44.1kHz sample rate. Requires you to be subscribed to Pro tier or above. + * ulaw_8000 - μ-law format (sometimes written mu-law, often approximated as u-law) with 8kHz sample rate. Note that this format is commonly used for Twilio audio inputs. + */ + output_format?: string; audio: File | fs.ReadStream; /** Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. */ model_id?: string; /** Voice settings overriding stored setttings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. */ voice_settings?: string; + /** If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. */ + seed?: number; } diff --git a/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost.ts b/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost.ts index cc1f089..3fb012b 100644 --- a/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost.ts +++ b/src/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost.ts @@ -9,22 +9,40 @@ import * as ElevenLabs from "../../../../index"; * @example * { * audio: fs.createReadStream("/path/to/your/file"), - * optimize_streaming_latency: ElevenLabs.OptimizeStreamingLatency.Zero, - * output_format: ElevenLabs.OutputFormat.Mp32205032 + * enable_logging: ElevenLabs.OptimizeStreamingLatency.Zero, + * optimize_streaming_latency: ElevenLabs.OutputFormat.Mp32205032, + * output_format: "string" * } */ export interface BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost { /** * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. */ - optimize_streaming_latency?: ElevenLabs.OptimizeStreamingLatency; + enable_logging?: ElevenLabs.OptimizeStreamingLatency; /** * The output format of the generated audio. */ - output_format?: ElevenLabs.OutputFormat; + optimize_streaming_latency?: ElevenLabs.OutputFormat; + /** + * Output format of the generated audio. Must be one of: + * mp3_22050_32 - output format, mp3 with 22.05kHz sample rate at 32kbps. + * mp3_44100_32 - output format, mp3 with 44.1kHz sample rate at 32kbps. + * mp3_44100_64 - output format, mp3 with 44.1kHz sample rate at 64kbps. + * mp3_44100_96 - output format, mp3 with 44.1kHz sample rate at 96kbps. + * mp3_44100_128 - default output format, mp3 with 44.1kHz sample rate at 128kbps. + * mp3_44100_192 - output format, mp3 with 44.1kHz sample rate at 192kbps. Requires you to be subscribed to Creator tier or above. + * pcm_16000 - PCM format (S16LE) with 16kHz sample rate. + * pcm_22050 - PCM format (S16LE) with 22.05kHz sample rate. + * pcm_24000 - PCM format (S16LE) with 24kHz sample rate. + * pcm_44100 - PCM format (S16LE) with 44.1kHz sample rate. Requires you to be subscribed to Pro tier or above. + * ulaw_8000 - μ-law format (sometimes written mu-law, often approximated as u-law) with 8kHz sample rate. Note that this format is commonly used for Twilio audio inputs. + */ + output_format?: string; audio: File | fs.ReadStream; /** Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. */ model_id?: string; /** Voice settings overriding stored setttings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. */ voice_settings?: string; + /** If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. */ + seed?: number; } diff --git a/src/api/resources/textToSoundEffects/client/Client.ts b/src/api/resources/textToSoundEffects/client/Client.ts new file mode 100644 index 0000000..9af6cf9 --- /dev/null +++ b/src/api/resources/textToSoundEffects/client/Client.ts @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as ElevenLabs from "../../../index"; +import * as stream from "stream"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace TextToSoundEffects { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class TextToSoundEffects { + constructor(protected readonly _options: TextToSoundEffects.Options = {}) {} + + /** + * Converts a text of your choice into sound + * @throws {@link ElevenLabs.UnprocessableEntityError} + */ + public async convert( + request: ElevenLabs.BodySoundGenerationV1SoundGenerationPost, + requestOptions?: TextToSoundEffects.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + "v1/sound-generation" + ), + method: "POST", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + body: request, + responseType: "streaming", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } +} diff --git a/src/api/resources/textToSoundEffects/client/index.ts b/src/api/resources/textToSoundEffects/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/textToSoundEffects/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/textToSoundEffects/client/requests/BodySoundGenerationV1SoundGenerationPost.ts b/src/api/resources/textToSoundEffects/client/requests/BodySoundGenerationV1SoundGenerationPost.ts new file mode 100644 index 0000000..ff7e298 --- /dev/null +++ b/src/api/resources/textToSoundEffects/client/requests/BodySoundGenerationV1SoundGenerationPost.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * text: "string", + * duration_seconds: 1.1, + * prompt_influence: 1.1 + * } + */ +export interface BodySoundGenerationV1SoundGenerationPost { + /** The text that will get converted into a sound effect. */ + text: string; + /** The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 22. If set to None we will guess the optimal duration using the prompt. Defaults to None. */ + duration_seconds?: number; + /** A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3. */ + prompt_influence?: number; +} diff --git a/src/api/resources/textToSoundEffects/client/requests/index.ts b/src/api/resources/textToSoundEffects/client/requests/index.ts new file mode 100644 index 0000000..7ccf18c --- /dev/null +++ b/src/api/resources/textToSoundEffects/client/requests/index.ts @@ -0,0 +1 @@ +export { type BodySoundGenerationV1SoundGenerationPost } from "./BodySoundGenerationV1SoundGenerationPost"; diff --git a/src/api/resources/textToSoundEffects/index.ts b/src/api/resources/textToSoundEffects/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/textToSoundEffects/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/textToSpeech/client/Client.ts b/src/api/resources/textToSpeech/client/Client.ts index 5dc5bff..18e4cb1 100644 --- a/src/api/resources/textToSpeech/client/Client.ts +++ b/src/api/resources/textToSpeech/client/Client.ts @@ -34,8 +34,17 @@ export class TextToSpeech { request: ElevenLabs.TextToSpeechRequest, requestOptions?: TextToSpeech.RequestOptions ): Promise { - const { optimize_streaming_latency: optimizeStreamingLatency, output_format: outputFormat, ..._body } = request; + const { + enable_logging: enableLogging, + optimize_streaming_latency: optimizeStreamingLatency, + output_format: outputFormat, + ..._body + } = request; const _queryParams: Record = {}; + if (enableLogging != null) { + _queryParams["enable_logging"] = enableLogging.toString(); + } + if (optimizeStreamingLatency != null) { _queryParams["optimize_streaming_latency"] = optimizeStreamingLatency; } @@ -57,7 +66,7 @@ export class TextToSpeech { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -102,17 +111,121 @@ export class TextToSpeech { } } + /** + * Converts text into speech using a voice of your choice and returns JSON containing audio as a base64 encoded string together with information on when which character was spoken. + * + * @param {string} voiceId - Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + * @param {ElevenLabs.TextToSpeechWithTimstampsRequest} request + * @param {TextToSpeech.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.textToSpeech.convertWithTimstamps("voice_id", { + * text: "text" + * }) + */ + public async convertWithTimstamps( + voiceId: string, + request: ElevenLabs.TextToSpeechWithTimstampsRequest, + requestOptions?: TextToSpeech.RequestOptions + ): Promise { + const { + enable_logging: enableLogging, + optimize_streaming_latency: optimizeStreamingLatency, + output_format: outputFormat, + ..._body + } = request; + const _queryParams: Record = {}; + if (enableLogging != null) { + _queryParams["enable_logging"] = enableLogging.toString(); + } + + if (optimizeStreamingLatency != null) { + _queryParams["optimize_streaming_latency"] = optimizeStreamingLatency; + } + + if (outputFormat != null) { + _queryParams["output_format"] = outputFormat; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + `v1/text-to-speech/${encodeURIComponent(voiceId)}/with-timestamps` + ), + method: "POST", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + queryParameters: _queryParams, + body: _body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } + /** * Converts text into speech using a voice of your choice and returns audio as an audio stream. * @throws {@link ElevenLabs.UnprocessableEntityError} */ public async convertAsStream( voiceId: string, - request: ElevenLabs.TextToSpeechAsStreamRequest, + request: ElevenLabs.StreamTextToSpeechRequest, requestOptions?: TextToSpeech.RequestOptions ): Promise { - const { optimize_streaming_latency: optimizeStreamingLatency, output_format: outputFormat, ..._body } = request; + const { + enable_logging: enableLogging, + optimize_streaming_latency: optimizeStreamingLatency, + output_format: outputFormat, + ..._body + } = request; const _queryParams: Record = {}; + if (enableLogging != null) { + _queryParams["enable_logging"] = enableLogging.toString(); + } + if (optimizeStreamingLatency != null) { _queryParams["optimize_streaming_latency"] = optimizeStreamingLatency; } @@ -134,7 +247,7 @@ export class TextToSpeech { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -178,4 +291,99 @@ export class TextToSpeech { }); } } + + /** + * Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken. + * + * @param {string} voiceId - Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + * @param {ElevenLabs.StreamTextToSpeechWithTimstampsRequest} request + * @param {TextToSpeech.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.textToSpeech.streamWithTimestamps("voice_id", { + * text: "text" + * }) + */ + public async streamWithTimestamps( + voiceId: string, + request: ElevenLabs.StreamTextToSpeechWithTimstampsRequest, + requestOptions?: TextToSpeech.RequestOptions + ): Promise { + const { + enable_logging: enableLogging, + optimize_streaming_latency: optimizeStreamingLatency, + output_format: outputFormat, + ..._body + } = request; + const _queryParams: Record = {}; + if (enableLogging != null) { + _queryParams["enable_logging"] = enableLogging.toString(); + } + + if (optimizeStreamingLatency != null) { + _queryParams["optimize_streaming_latency"] = optimizeStreamingLatency; + } + + if (outputFormat != null) { + _queryParams["output_format"] = outputFormat; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + `v1/text-to-speech/${encodeURIComponent(voiceId)}/stream/with-timestamps` + ), + method: "POST", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + queryParameters: _queryParams, + body: _body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } } diff --git a/src/api/resources/textToSpeech/client/requests/StreamTextToSpeechRequest.ts b/src/api/resources/textToSpeech/client/requests/StreamTextToSpeechRequest.ts new file mode 100644 index 0000000..eb637ad --- /dev/null +++ b/src/api/resources/textToSpeech/client/requests/StreamTextToSpeechRequest.ts @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../../../../index"; + +/** + * @example + * { + * optimize_streaming_latency: ElevenLabs.OptimizeStreamingLatency.Zero, + * output_format: ElevenLabs.OutputFormat.Mp32205032, + * text: "It sure does, Jackie\u2026 My mama always said: \u201CIn Carolina, the air's so thick you can wear it!\u201D", + * voice_settings: { + * stability: 0.1, + * similarity_boost: 0.3, + * style: 0.2 + * } + * } + */ +export interface StreamTextToSpeechRequest { + /** + * When enable_logging is set to false full privacy mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Full privacy mode may only be used by enterprise customers. + */ + enable_logging?: boolean; + /** + * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. + */ + optimize_streaming_latency?: ElevenLabs.OptimizeStreamingLatency; + /** + * The output format of the generated audio. + */ + output_format?: ElevenLabs.OutputFormat; + /** The text that will get converted into speech. */ + text: string; + /** Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. */ + model_id?: string; + /** Voice settings overriding stored setttings for the given voice. They are applied only on the given request. */ + voice_settings?: ElevenLabs.VoiceSettings; + /** A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request */ + pronunciation_dictionary_locators?: ElevenLabs.PronunciationDictionaryVersionLocator[]; + /** If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. */ + seed?: number; + /** The text that came before the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + previous_text?: string; + /** The text that comes after the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + next_text?: string; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. */ + previous_request_ids?: string[]; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. */ + next_request_ids?: string[]; +} diff --git a/src/api/resources/textToSpeech/client/requests/StreamTextToSpeechWithTimstampsRequest.ts b/src/api/resources/textToSpeech/client/requests/StreamTextToSpeechWithTimstampsRequest.ts new file mode 100644 index 0000000..1bf4b86 --- /dev/null +++ b/src/api/resources/textToSpeech/client/requests/StreamTextToSpeechWithTimstampsRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../../../../index"; + +/** + * @example + * { + * text: "text" + * } + */ +export interface StreamTextToSpeechWithTimstampsRequest { + /** + * When enable_logging is set to false full privacy mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Full privacy mode may only be used by enterprise customers. + */ + enable_logging?: boolean; + /** + * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. + */ + optimize_streaming_latency?: ElevenLabs.OptimizeStreamingLatency; + /** + * The output format of the generated audio. + */ + output_format?: ElevenLabs.OutputFormat; + /** The text that will get converted into speech. */ + text: string; + /** Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. */ + model_id?: string; + /** Voice settings overriding stored setttings for the given voice. They are applied only on the given request. */ + voice_settings?: ElevenLabs.VoiceSettings; + /** A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request */ + pronunciation_dictionary_locators?: ElevenLabs.PronunciationDictionaryVersionLocator[]; + /** If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. */ + seed?: number; + /** The text that came before the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + previous_text?: string; + /** The text that comes after the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + next_text?: string; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. */ + previous_request_ids?: string[]; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. */ + next_request_ids?: string[]; +} diff --git a/src/api/resources/textToSpeech/client/requests/TextToSpeechAsStreamRequest.ts b/src/api/resources/textToSpeech/client/requests/TextToSpeechAsStreamRequest.ts deleted file mode 100644 index 3e8b01d..0000000 --- a/src/api/resources/textToSpeech/client/requests/TextToSpeechAsStreamRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as ElevenLabs from "../../../../index"; - -/** - * @example - * { - * optimize_streaming_latency: ElevenLabs.OptimizeStreamingLatency.Zero, - * output_format: ElevenLabs.OutputFormat.Mp32205032, - * text: "It sure does, Jackie\u2026 My mama always said: \u201CIn Carolina, the air's so thick you can wear it!\u201D", - * voice_settings: { - * stability: 0.1, - * similarity_boost: 0.3, - * style: 0.2 - * } - * } - */ -export interface TextToSpeechAsStreamRequest { - /** - * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. - */ - optimize_streaming_latency?: ElevenLabs.OptimizeStreamingLatency; - /** - * The output format of the generated audio. - */ - output_format?: ElevenLabs.OutputFormat; - /** The text that will get converted into speech. */ - text: string; - /** Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. */ - model_id?: string; - /** Voice settings overriding stored setttings for the given voice. They are applied only on the given request. */ - voice_settings?: ElevenLabs.VoiceSettings; - /** A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request */ - pronunciation_dictionary_locators?: ElevenLabs.PronunciationDictionaryVersionLocator[]; -} diff --git a/src/api/resources/textToSpeech/client/requests/TextToSpeechRequest.ts b/src/api/resources/textToSpeech/client/requests/TextToSpeechRequest.ts index 0fa6c71..f99e117 100644 --- a/src/api/resources/textToSpeech/client/requests/TextToSpeechRequest.ts +++ b/src/api/resources/textToSpeech/client/requests/TextToSpeechRequest.ts @@ -18,6 +18,10 @@ import * as ElevenLabs from "../../../../index"; * } */ export interface TextToSpeechRequest { + /** + * When enable_logging is set to false full privacy mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Full privacy mode may only be used by enterprise customers. + */ + enable_logging?: boolean; /** * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. */ @@ -34,4 +38,14 @@ export interface TextToSpeechRequest { voice_settings?: ElevenLabs.VoiceSettings; /** A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request */ pronunciation_dictionary_locators?: ElevenLabs.PronunciationDictionaryVersionLocator[]; + /** If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. */ + seed?: number; + /** The text that came before the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + previous_text?: string; + /** The text that comes after the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + next_text?: string; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. */ + previous_request_ids?: string[]; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. */ + next_request_ids?: string[]; } diff --git a/src/api/resources/textToSpeech/client/requests/TextToSpeechWithTimstampsRequest.ts b/src/api/resources/textToSpeech/client/requests/TextToSpeechWithTimstampsRequest.ts new file mode 100644 index 0000000..3d0114a --- /dev/null +++ b/src/api/resources/textToSpeech/client/requests/TextToSpeechWithTimstampsRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../../../../index"; + +/** + * @example + * { + * text: "text" + * } + */ +export interface TextToSpeechWithTimstampsRequest { + /** + * When enable_logging is set to false full privacy mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Full privacy mode may only be used by enterprise customers. + */ + enable_logging?: boolean; + /** + * You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. + */ + optimize_streaming_latency?: ElevenLabs.OptimizeStreamingLatency; + /** + * The output format of the generated audio. + */ + output_format?: ElevenLabs.OutputFormat; + /** The text that will get converted into speech. */ + text: string; + /** Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. */ + model_id?: string; + /** Voice settings overriding stored setttings for the given voice. They are applied only on the given request. */ + voice_settings?: ElevenLabs.VoiceSettings; + /** A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request */ + pronunciation_dictionary_locators?: ElevenLabs.PronunciationDictionaryVersionLocator[]; + /** If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. */ + seed?: number; + /** The text that came before the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + previous_text?: string; + /** The text that comes after the text of the current request. Can be used to improve the flow of prosody when concatenating together multiple generations or to influence the prosody in the current generation. */ + next_text?: string; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. */ + previous_request_ids?: string[]; + /** A list of request_id of the samples that were generated before this generation. Can be used to improve the flow of prosody when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. */ + next_request_ids?: string[]; +} diff --git a/src/api/resources/textToSpeech/client/requests/index.ts b/src/api/resources/textToSpeech/client/requests/index.ts index 6524e8e..6dd4ab4 100644 --- a/src/api/resources/textToSpeech/client/requests/index.ts +++ b/src/api/resources/textToSpeech/client/requests/index.ts @@ -1,2 +1,4 @@ export { type TextToSpeechRequest } from "./TextToSpeechRequest"; -export { type TextToSpeechAsStreamRequest } from "./TextToSpeechAsStreamRequest"; +export { type TextToSpeechWithTimstampsRequest } from "./TextToSpeechWithTimstampsRequest"; +export { type StreamTextToSpeechRequest } from "./StreamTextToSpeechRequest"; +export { type StreamTextToSpeechWithTimstampsRequest } from "./StreamTextToSpeechWithTimstampsRequest"; diff --git a/src/api/resources/user/client/Client.ts b/src/api/resources/user/client/Client.ts index 1655503..480fbe5 100644 --- a/src/api/resources/user/client/Client.ts +++ b/src/api/resources/user/client/Client.ts @@ -48,7 +48,7 @@ export class User { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -114,7 +114,7 @@ export class User { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/voiceGeneration/client/Client.ts b/src/api/resources/voiceGeneration/client/Client.ts index 5e6e4d9..76d3095 100644 --- a/src/api/resources/voiceGeneration/client/Client.ts +++ b/src/api/resources/voiceGeneration/client/Client.ts @@ -49,7 +49,7 @@ export class VoiceGeneration { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -105,7 +105,7 @@ export class VoiceGeneration { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -181,7 +181,7 @@ export class VoiceGeneration { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, diff --git a/src/api/resources/voices/client/Client.ts b/src/api/resources/voices/client/Client.ts index dfa0609..6a06a3d 100644 --- a/src/api/resources/voices/client/Client.ts +++ b/src/api/resources/voices/client/Client.ts @@ -52,7 +52,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -116,7 +116,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -179,7 +179,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -257,7 +257,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -325,7 +325,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -401,7 +401,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -490,7 +490,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), @@ -582,7 +582,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...(await _maybeEncodedRequest.getHeaders()), @@ -659,7 +659,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -815,7 +815,7 @@ export class Voices { : undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "0.8.0", + "X-Fern-SDK-Version": "0.8.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -857,4 +857,74 @@ export class Voices { }); } } + + /** + * Gets a profile page based on a handle + * + * @param {string} handle - Handle for a VA's profile page + * @param {Voices.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.voices.getAProfilePage("handle") + */ + public async getAProfilePage( + handle: string, + requestOptions?: Voices.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + `profile/${encodeURIComponent(handle)}` + ), + method: "GET", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body as ElevenLabs.ProfilePageResponseModel; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } } diff --git a/src/api/resources/workspace/client/Client.ts b/src/api/resources/workspace/client/Client.ts new file mode 100644 index 0000000..b03afc6 --- /dev/null +++ b/src/api/resources/workspace/client/Client.ts @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as ElevenLabs from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Workspace { + interface Options { + environment?: core.Supplier; + apiKey?: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Workspace { + constructor(protected readonly _options: Workspace.Options = {}) {} + + /** + * Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace administrators. + * + * @param {ElevenLabs.BodyInviteUserV1WorkspaceInvitesAddPost} request + * @param {Workspace.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.workspace.inviteUser({ + * email: "email" + * }) + */ + public async inviteUser( + request: ElevenLabs.BodyInviteUserV1WorkspaceInvitesAddPost, + requestOptions?: Workspace.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + "v1/workspace/invites/add" + ), + method: "POST", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace administrators. + * + * @param {ElevenLabs.BodyDeleteExistingInvitationV1WorkspaceInvitesDelete} request + * @param {Workspace.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.workspace.deleteExistingInvitation({ + * email: "email" + * }) + */ + public async deleteExistingInvitation( + request: ElevenLabs.BodyDeleteExistingInvitationV1WorkspaceInvitesDelete, + requestOptions?: Workspace.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + "v1/workspace/invites" + ), + method: "DELETE", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates attributes of a workspace member. Apart from the email identifier, all parameters will remain unchanged unless specified. This endpoint may only be called by workspace administrators. + * + * @param {ElevenLabs.BodyUpdateMemberV1WorkspaceMembersPost} request + * @param {Workspace.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link ElevenLabs.UnprocessableEntityError} + * + * @example + * await elevenLabs.workspace.updateMember({ + * email: "email" + * }) + */ + public async updateMember( + request: ElevenLabs.BodyUpdateMemberV1WorkspaceMembersPost, + requestOptions?: Workspace.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.ElevenLabsEnvironment.Production, + "v1/workspace/members" + ), + method: "POST", + headers: { + "xi-api-key": + (await core.Supplier.get(this._options.apiKey)) != null + ? await core.Supplier.get(this._options.apiKey) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "0.8.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + contentType: "application/json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new ElevenLabs.UnprocessableEntityError( + _response.error.body as ElevenLabs.HttpValidationError + ); + default: + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.ElevenLabsError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.ElevenLabsTimeoutError(); + case "unknown": + throw new errors.ElevenLabsError({ + message: _response.error.errorMessage, + }); + } + } +} diff --git a/src/api/resources/workspace/client/index.ts b/src/api/resources/workspace/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/workspace/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/workspace/client/requests/BodyDeleteExistingInvitationV1WorkspaceInvitesDelete.ts b/src/api/resources/workspace/client/requests/BodyDeleteExistingInvitationV1WorkspaceInvitesDelete.ts new file mode 100644 index 0000000..878d046 --- /dev/null +++ b/src/api/resources/workspace/client/requests/BodyDeleteExistingInvitationV1WorkspaceInvitesDelete.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * email: "email" + * } + */ +export interface BodyDeleteExistingInvitationV1WorkspaceInvitesDelete { + /** Email of the target user. */ + email: string; +} diff --git a/src/api/resources/workspace/client/requests/BodyInviteUserV1WorkspaceInvitesAddPost.ts b/src/api/resources/workspace/client/requests/BodyInviteUserV1WorkspaceInvitesAddPost.ts new file mode 100644 index 0000000..9cbdcd8 --- /dev/null +++ b/src/api/resources/workspace/client/requests/BodyInviteUserV1WorkspaceInvitesAddPost.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * email: "email" + * } + */ +export interface BodyInviteUserV1WorkspaceInvitesAddPost { + /** Email of the target user. */ + email: string; +} diff --git a/src/api/resources/workspace/client/requests/BodyUpdateMemberV1WorkspaceMembersPost.ts b/src/api/resources/workspace/client/requests/BodyUpdateMemberV1WorkspaceMembersPost.ts new file mode 100644 index 0000000..6091e28 --- /dev/null +++ b/src/api/resources/workspace/client/requests/BodyUpdateMemberV1WorkspaceMembersPost.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../../../../index"; + +/** + * @example + * { + * email: "email" + * } + */ +export interface BodyUpdateMemberV1WorkspaceMembersPost { + /** Email of the target user. */ + email: string; + /** Whether to lock or unlock the user account. */ + is_locked?: boolean; + /** Role dictating permissions in the workspace. */ + workspace_role?: ElevenLabs.BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole; +} diff --git a/src/api/resources/workspace/client/requests/index.ts b/src/api/resources/workspace/client/requests/index.ts new file mode 100644 index 0000000..60e48f6 --- /dev/null +++ b/src/api/resources/workspace/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type BodyInviteUserV1WorkspaceInvitesAddPost } from "./BodyInviteUserV1WorkspaceInvitesAddPost"; +export { type BodyDeleteExistingInvitationV1WorkspaceInvitesDelete } from "./BodyDeleteExistingInvitationV1WorkspaceInvitesDelete"; +export { type BodyUpdateMemberV1WorkspaceMembersPost } from "./BodyUpdateMemberV1WorkspaceMembersPost"; diff --git a/src/api/resources/workspace/index.ts b/src/api/resources/workspace/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/workspace/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/workspace/types/BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole.ts b/src/api/resources/workspace/types/BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole.ts new file mode 100644 index 0000000..65d2863 --- /dev/null +++ b/src/api/resources/workspace/types/BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Role dictating permissions in the workspace. + */ +export type BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole = "workspace_admin" | "workspace_member"; + +export const BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole = { + WorkspaceAdmin: "workspace_admin", + WorkspaceMember: "workspace_member", +} as const; diff --git a/src/api/resources/workspace/types/index.ts b/src/api/resources/workspace/types/index.ts new file mode 100644 index 0000000..30a32ea --- /dev/null +++ b/src/api/resources/workspace/types/index.ts @@ -0,0 +1 @@ +export * from "./BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole"; diff --git a/src/api/types/DubbingMetadataResponse.ts b/src/api/types/DubbingMetadataResponse.ts index 0c5038c..a156504 100644 --- a/src/api/types/DubbingMetadataResponse.ts +++ b/src/api/types/DubbingMetadataResponse.ts @@ -6,6 +6,6 @@ export interface DubbingMetadataResponse { dubbing_id: string; name: string; status: string; - error: string; target_languages: string[]; + error?: string; } diff --git a/src/api/types/EditProjectResponseModel.ts b/src/api/types/EditProjectResponseModel.ts new file mode 100644 index 0000000..f60a1fb --- /dev/null +++ b/src/api/types/EditProjectResponseModel.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../index"; + +export interface EditProjectResponseModel { + project: ElevenLabs.ProjectResponse; +} diff --git a/src/api/types/ExtendedSubscriptionResponseModelCharacterRefreshPeriod.ts b/src/api/types/ExtendedSubscriptionResponseModelCharacterRefreshPeriod.ts new file mode 100644 index 0000000..62523a6 --- /dev/null +++ b/src/api/types/ExtendedSubscriptionResponseModelCharacterRefreshPeriod.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ExtendedSubscriptionResponseModelCharacterRefreshPeriod = "monthly_period" | "annual_period"; + +export const ExtendedSubscriptionResponseModelCharacterRefreshPeriod = { + MonthlyPeriod: "monthly_period", + AnnualPeriod: "annual_period", +} as const; diff --git a/src/api/types/LibraryVoiceResponse.ts b/src/api/types/LibraryVoiceResponse.ts index 4ec9911..6fe3d9c 100644 --- a/src/api/types/LibraryVoiceResponse.ts +++ b/src/api/types/LibraryVoiceResponse.ts @@ -18,6 +18,7 @@ export interface LibraryVoiceResponse { preview_url: string; usage_character_count_1y: number; usage_character_count_7d: number; + play_api_usage_character_count_1y: number; cloned_by_count: number; rate: number; free_users_allowed: boolean; diff --git a/src/api/types/Model.ts b/src/api/types/Model.ts index 8c8fc36..ac45434 100644 --- a/src/api/types/Model.ts +++ b/src/api/types/Model.ts @@ -18,5 +18,6 @@ export interface Model { requires_alpha_access?: boolean; max_characters_request_free_user?: number; max_characters_request_subscribed_user?: number; + maximum_text_length_per_request?: number; languages?: ElevenLabs.LanguageResponse[]; } diff --git a/src/api/types/ProfilePageResponseModel.ts b/src/api/types/ProfilePageResponseModel.ts new file mode 100644 index 0000000..af7d552 --- /dev/null +++ b/src/api/types/ProfilePageResponseModel.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ProfilePageResponseModel { + handle: string; + public_user_id: string; + name: string; + bio: string; + profile_picture: string; +} diff --git a/src/api/types/ProjectSnapshotResponse.ts b/src/api/types/ProjectSnapshotResponse.ts index fdc383d..e94f14c 100644 --- a/src/api/types/ProjectSnapshotResponse.ts +++ b/src/api/types/ProjectSnapshotResponse.ts @@ -2,9 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as ElevenLabs from "../index"; + export interface ProjectSnapshotResponse { project_snapshot_id: string; project_id: string; created_at_unix: number; name: string; + audio_upload?: ElevenLabs.ProjectSnapshotUploadResponseModel; + zip_upload?: ElevenLabs.ProjectSnapshotUploadResponseModel; } diff --git a/src/api/types/ProjectSnapshotUploadResponseModel.ts b/src/api/types/ProjectSnapshotUploadResponseModel.ts new file mode 100644 index 0000000..a5cf347 --- /dev/null +++ b/src/api/types/ProjectSnapshotUploadResponseModel.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as ElevenLabs from "../index"; + +export interface ProjectSnapshotUploadResponseModel { + status: ElevenLabs.Status; + acx_volume_normalization?: boolean; +} diff --git a/src/api/types/Status.ts b/src/api/types/Status.ts new file mode 100644 index 0000000..e8a1ccb --- /dev/null +++ b/src/api/types/Status.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type Status = "success" | "pending" | "failed"; + +export const Status = { + Success: "success", + Pending: "pending", + Failed: "failed", +} as const; diff --git a/src/api/types/Subscription.ts b/src/api/types/Subscription.ts index 766844c..2cb6072 100644 --- a/src/api/types/Subscription.ts +++ b/src/api/types/Subscription.ts @@ -21,6 +21,7 @@ export interface Subscription { currency?: ElevenLabs.Currency; status?: ElevenLabs.SubscriptionStatus; billing_period?: ElevenLabs.ExtendedSubscriptionResponseModelBillingPeriod; + character_refresh_period?: ElevenLabs.ExtendedSubscriptionResponseModelCharacterRefreshPeriod; next_invoice?: ElevenLabs.Invoice; has_open_invoices?: boolean; } diff --git a/src/api/types/SubscriptionResponse.ts b/src/api/types/SubscriptionResponse.ts index c4c64e5..0380c64 100644 --- a/src/api/types/SubscriptionResponse.ts +++ b/src/api/types/SubscriptionResponse.ts @@ -21,4 +21,5 @@ export interface SubscriptionResponse { currency: ElevenLabs.Currency; status: ElevenLabs.SubscriptionStatus; billing_period: ElevenLabs.SubscriptionResponseModelBillingPeriod; + character_refresh_period: ElevenLabs.SubscriptionResponseModelCharacterRefreshPeriod; } diff --git a/src/api/types/SubscriptionResponseModelCharacterRefreshPeriod.ts b/src/api/types/SubscriptionResponseModelCharacterRefreshPeriod.ts new file mode 100644 index 0000000..2437a2a --- /dev/null +++ b/src/api/types/SubscriptionResponseModelCharacterRefreshPeriod.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type SubscriptionResponseModelCharacterRefreshPeriod = "monthly_period" | "annual_period"; + +export const SubscriptionResponseModelCharacterRefreshPeriod = { + MonthlyPeriod: "monthly_period", + AnnualPeriod: "annual_period", +} as const; diff --git a/src/api/types/TextToSpeechAsStreamRequest.ts b/src/api/types/TextToSpeechAsStreamRequest.ts new file mode 100644 index 0000000..580e2ed --- /dev/null +++ b/src/api/types/TextToSpeechAsStreamRequest.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type TextToSpeechAsStreamRequest = unknown; diff --git a/src/api/types/User.ts b/src/api/types/User.ts index d3b8f0f..3bce4da 100644 --- a/src/api/types/User.ts +++ b/src/api/types/User.ts @@ -10,5 +10,8 @@ export interface User { xi_api_key: string; can_use_delayed_payment_methods: boolean; is_onboarding_completed: boolean; + is_onboarding_checklist_completed: boolean; first_name?: string; + is_api_key_hashed?: boolean; + xi_api_key_preview?: string; } diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 97db440..f8145dd 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -10,9 +10,11 @@ export * from "./ChapterSnapshotsResponse"; export * from "./ChapterStatisticsResponse"; export * from "./DoDubbingResponse"; export * from "./DubbingMetadataResponse"; +export * from "./EditProjectResponseModel"; export * from "./Currency"; export * from "./SubscriptionStatus"; export * from "./ExtendedSubscriptionResponseModelBillingPeriod"; +export * from "./ExtendedSubscriptionResponseModelCharacterRefreshPeriod"; export * from "./Subscription"; export * from "./FeedbackItem"; export * from "./FinetuningState"; @@ -31,10 +33,13 @@ export * from "./LibraryVoiceResponse"; export * from "./ManualVerificationFileResponse"; export * from "./ManualVerificationResponse"; export * from "./Model"; +export * from "./ProfilePageResponseModel"; export * from "./ProjectState"; export * from "./ProjectExtendedResponseModel"; export * from "./ProjectResponse"; export * from "./ProjectSnapshotResponse"; +export * from "./Status"; +export * from "./ProjectSnapshotUploadResponseModel"; export * from "./ProjectSnapshotsResponse"; export * from "./PronunciationDictionaryAliasRuleRequestModel"; export * from "./PronunciationDictionaryPhonemeRuleRequestModel"; @@ -48,6 +53,7 @@ export * from "./SpeechHistoryItemResponse"; export * from "./SsoProviderDbModelProviderType"; export * from "./SsoProviderDbModel"; export * from "./SubscriptionResponseModelBillingPeriod"; +export * from "./SubscriptionResponseModelCharacterRefreshPeriod"; export * from "./SubscriptionResponse"; export * from "./User"; export * from "./ValidationErrorLocItem"; @@ -69,6 +75,7 @@ export * from "./History"; export * from "./Accent"; export * from "./Age"; export * from "./Gender"; +export * from "./TextToSpeechAsStreamRequest"; export * from "./OutputFormat"; export * from "./OptimizeStreamingLatency"; export * from "./InitializeConnection"; diff --git a/src/wrapper/ElevenLabsClient.ts b/src/wrapper/ElevenLabsClient.ts index 997d8bc..eedd5db 100644 --- a/src/wrapper/ElevenLabsClient.ts +++ b/src/wrapper/ElevenLabsClient.ts @@ -15,7 +15,7 @@ export declare namespace ElevenLabsClient { interface GeneratAudioBulk extends ElevenLabs.TextToSpeechRequest {} - interface GenerateAudioStream extends ElevenLabs.TextToSpeechAsStreamRequest { + interface GenerateAudioStream extends ElevenLabs.StreamTextToSpeechRequest { /* Specify stream: true if you would like to get the audio in chunks */ stream: true; } diff --git a/yarn.lock b/yarn.lock index b15bfec..d2e2cdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -712,14 +712,16 @@ acorn-globals@^7.0.0: acorn-walk "^8.0.2" acorn-walk@^8.0.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa" - integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A== + version "8.3.3" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" + integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + dependencies: + acorn "^8.11.0" -acorn@^8.1.0, acorn@^8.8.1: - version "8.11.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" - integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: + version "8.12.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.0.tgz#1627bfa2e058148036133b8d9b51a700663c294c" + integrity sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw== agent-base@6: version "6.0.2" @@ -915,9 +917,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001629: - version "1.0.30001632" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz#964207b7cba5851701afb4c8afaf1448db3884b6" - integrity sha512-udx3o7yHJfUxMLkGohMlVHCvFvWmirKh9JAH/d7WOLPetlH+LTL5cocMZ0t7oZx/mdlOWXti97xLZWc8uURRHg== + version "1.0.30001636" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz#b15f52d2bdb95fad32c2f53c0b68032b85188a78" + integrity sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg== chalk@^2.4.2: version "2.4.2" @@ -1118,9 +1120,9 @@ domexception@^4.0.0: webidl-conversions "^7.0.0" electron-to-chromium@^1.4.796: - version "1.4.799" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.799.tgz#271c56654ab4dc703037e47a5af4fc8945160611" - integrity sha512-3D3DwWkRTzrdEpntY0hMLYwj7SeBk1138CkPE8sBDSj3WzrzOiG2rHm3luw8jucpf+WiyLBCZyU9lMHyQI9M9Q== + version "1.4.803" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.803.tgz#cf55808a5ee12e2a2778bbe8cdc941ef87c2093b" + integrity sha512-61H9mLzGOCLLVsnLiRzCbc63uldP0AniRYPV3hbGVtONA1pI7qSGILdbofR7A8TMbOypDocEAjH/e+9k1QIe3g== emittery@^0.13.1: version "0.13.1" @@ -2520,9 +2522,9 @@ tr46@~0.0.3: integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== ts-jest@^29.1.1: - version "29.1.4" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.4.tgz#26f8a55ce31e4d2ef7a1fd47dc7fa127e92793ef" - integrity sha512-YiHwDhSvCiItoAgsKtoLFCuakDzDsJ1DLDnSouTaTmdOcOwIkSzbLXduaQ6M5DRVhuZC/NYaaZ/mtHbWMv/S6Q== + version "29.1.5" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.5.tgz#d6c0471cc78bffa2cb4664a0a6741ef36cfe8f69" + integrity sha512-UuClSYxM7byvvYfyWdFI+/2UxMmwNyJb0NPkZPQE2hew3RurV7l7zURgOHAd/1I1ZdPpe3GUsXNXAcN8TFKSIg== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" @@ -2670,9 +2672,9 @@ write-file-atomic@^4.0.2: signal-exit "^3.0.7" ws@^8.11.0: - version "8.17.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.0.tgz#d145d18eca2ed25aaf791a183903f7be5e295fea" - integrity sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow== + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== xml-name-validator@^4.0.0: version "4.0.0"