@cartesia/cartesia-js 2.1.10 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +3 -3
- package/Client.js +3 -3
- package/README.md +5 -2
- package/api/resources/apiStatus/client/Client.js +1 -1
- package/api/resources/auth/client/Client.d.ts +51 -0
- package/api/resources/auth/client/Client.js +126 -0
- package/api/resources/auth/client/index.d.ts +1 -0
- package/api/resources/auth/types/TokenGrant.d.ts +7 -0
- package/api/resources/auth/types/TokenRequest.d.ts +10 -0
- package/api/resources/auth/types/TokenResponse.d.ts +7 -0
- package/api/resources/auth/types/index.d.ts +3 -0
- package/{dist/api/resources/datasets/client → api/resources/auth/types}/index.js +3 -1
- package/api/resources/index.d.ts +2 -3
- package/api/resources/index.js +3 -4
- package/api/resources/infill/client/Client.js +1 -1
- package/api/resources/tts/types/FlushId.d.ts +2 -2
- package/api/resources/tts/types/GenerationRequest.d.ts +11 -1
- package/api/resources/tts/types/TtsRequest.d.ts +9 -1
- package/api/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
- package/api/resources/voices/client/Client.js +11 -9
- package/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +1 -1
- package/core/websocket/ws.d.ts +1 -0
- package/core/websocket/ws.js +1 -1
- package/dist/Client.d.ts +3 -3
- package/dist/Client.js +3 -3
- package/dist/api/resources/apiStatus/client/Client.js +1 -1
- package/dist/api/resources/auth/client/Client.d.ts +51 -0
- package/dist/api/resources/auth/client/Client.js +126 -0
- package/dist/api/resources/auth/client/index.d.ts +1 -0
- package/dist/api/resources/auth/types/TokenGrant.d.ts +7 -0
- package/dist/api/resources/auth/types/TokenRequest.d.ts +10 -0
- package/dist/api/resources/auth/types/TokenResponse.d.ts +7 -0
- package/dist/api/resources/auth/types/index.d.ts +3 -0
- package/{api/resources/datasets/client → dist/api/resources/auth/types}/index.js +3 -1
- package/dist/api/resources/index.d.ts +2 -3
- package/dist/api/resources/index.js +3 -4
- package/dist/api/resources/infill/client/Client.js +1 -1
- package/dist/api/resources/tts/types/FlushId.d.ts +2 -2
- package/dist/api/resources/tts/types/GenerationRequest.d.ts +11 -1
- package/dist/api/resources/tts/types/TtsRequest.d.ts +9 -1
- package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +3 -1
- package/dist/api/resources/voices/client/Client.js +11 -9
- package/dist/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +1 -1
- package/dist/core/websocket/ws.d.ts +1 -0
- package/dist/core/websocket/ws.js +1 -1
- package/dist/serialization/resources/{datasets/types/Dataset.d.ts → auth/types/TokenGrant.d.ts} +3 -5
- package/{serialization/resources/datasets/types/FilePurpose.js → dist/serialization/resources/auth/types/TokenGrant.js} +4 -2
- package/dist/serialization/resources/auth/types/TokenRequest.d.ts +14 -0
- package/dist/serialization/resources/{datasets/types/DatasetFile.js → auth/types/TokenRequest.js} +5 -5
- package/{serialization/resources/datasets/types/Dataset.d.ts → dist/serialization/resources/auth/types/TokenResponse.d.ts} +3 -5
- package/dist/serialization/resources/{datasets/types/CreateDatasetRequest.js → auth/types/TokenResponse.js} +3 -3
- package/dist/serialization/resources/auth/types/index.d.ts +3 -0
- package/dist/serialization/resources/auth/types/index.js +19 -0
- package/dist/serialization/resources/index.d.ts +2 -2
- package/dist/serialization/resources/index.js +3 -3
- package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +2 -0
- package/dist/serialization/resources/tts/types/GenerationRequest.js +2 -0
- package/dist/serialization/resources/tts/types/TtsRequest.d.ts +1 -0
- package/dist/serialization/resources/tts/types/TtsRequest.js +1 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +2 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/Websocket.js +8 -2
- package/package.json +1 -1
- package/reference.md +11 -81
- package/{dist/serialization/resources/datasets/types/CreateDatasetRequest.d.ts → serialization/resources/auth/types/TokenGrant.d.ts} +3 -3
- package/{dist/serialization/resources/datasets/types/FilePurpose.js → serialization/resources/auth/types/TokenGrant.js} +4 -2
- package/serialization/resources/auth/types/TokenRequest.d.ts +14 -0
- package/{dist/serialization/resources/datasets/types/Dataset.js → serialization/resources/auth/types/TokenRequest.js} +5 -5
- package/serialization/resources/{datasets/types/CreateDatasetRequest.d.ts → auth/types/TokenResponse.d.ts} +3 -3
- package/serialization/resources/{datasets/types/CreateDatasetRequest.js → auth/types/TokenResponse.js} +3 -3
- package/serialization/resources/auth/types/index.d.ts +3 -0
- package/serialization/resources/auth/types/index.js +19 -0
- package/serialization/resources/index.d.ts +2 -2
- package/serialization/resources/index.js +3 -3
- package/serialization/resources/tts/types/GenerationRequest.d.ts +2 -0
- package/serialization/resources/tts/types/GenerationRequest.js +2 -0
- package/serialization/resources/tts/types/TtsRequest.d.ts +1 -0
- package/serialization/resources/tts/types/TtsRequest.js +1 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +2 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.js +2 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/Websocket.js +8 -2
- package/api/resources/datasets/client/Client.d.ts +0 -70
- package/api/resources/datasets/client/Client.js +0 -268
- package/api/resources/datasets/client/index.d.ts +0 -1
- package/api/resources/datasets/client/requests/UploadDatasetFileRequest.d.ts +0 -7
- package/api/resources/datasets/client/requests/index.d.ts +0 -1
- package/api/resources/datasets/types/CreateDatasetRequest.d.ts +0 -6
- package/api/resources/datasets/types/Dataset.d.ts +0 -8
- package/api/resources/datasets/types/DatasetFile.d.ts +0 -8
- package/api/resources/datasets/types/FilePurpose.d.ts +0 -7
- package/api/resources/datasets/types/FilePurpose.js +0 -9
- package/api/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -8
- package/api/resources/datasets/types/PaginatedDatasets.d.ts +0 -8
- package/api/resources/datasets/types/index.d.ts +0 -6
- package/api/resources/datasets/types/index.js +0 -22
- package/dist/api/resources/datasets/client/Client.d.ts +0 -70
- package/dist/api/resources/datasets/client/Client.js +0 -268
- package/dist/api/resources/datasets/client/index.d.ts +0 -1
- package/dist/api/resources/datasets/client/requests/UploadDatasetFileRequest.d.ts +0 -7
- package/dist/api/resources/datasets/client/requests/UploadDatasetFileRequest.js +0 -5
- package/dist/api/resources/datasets/client/requests/index.d.ts +0 -1
- package/dist/api/resources/datasets/types/CreateDatasetRequest.d.ts +0 -6
- package/dist/api/resources/datasets/types/CreateDatasetRequest.js +0 -5
- package/dist/api/resources/datasets/types/Dataset.d.ts +0 -8
- package/dist/api/resources/datasets/types/Dataset.js +0 -5
- package/dist/api/resources/datasets/types/DatasetFile.d.ts +0 -8
- package/dist/api/resources/datasets/types/DatasetFile.js +0 -5
- package/dist/api/resources/datasets/types/FilePurpose.d.ts +0 -7
- package/dist/api/resources/datasets/types/FilePurpose.js +0 -9
- package/dist/api/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -8
- package/dist/api/resources/datasets/types/PaginatedDatasetFiles.js +0 -5
- package/dist/api/resources/datasets/types/PaginatedDatasets.d.ts +0 -8
- package/dist/api/resources/datasets/types/PaginatedDatasets.js +0 -5
- package/dist/api/resources/datasets/types/index.d.ts +0 -6
- package/dist/api/resources/datasets/types/index.js +0 -22
- package/dist/serialization/resources/datasets/types/DatasetFile.d.ts +0 -14
- package/dist/serialization/resources/datasets/types/FilePurpose.d.ts +0 -10
- package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -14
- package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.js +0 -45
- package/dist/serialization/resources/datasets/types/PaginatedDatasets.d.ts +0 -14
- package/dist/serialization/resources/datasets/types/PaginatedDatasets.js +0 -45
- package/dist/serialization/resources/datasets/types/index.d.ts +0 -6
- package/dist/serialization/resources/datasets/types/index.js +0 -22
- package/serialization/resources/datasets/types/Dataset.js +0 -45
- package/serialization/resources/datasets/types/DatasetFile.d.ts +0 -14
- package/serialization/resources/datasets/types/DatasetFile.js +0 -45
- package/serialization/resources/datasets/types/FilePurpose.d.ts +0 -10
- package/serialization/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -14
- package/serialization/resources/datasets/types/PaginatedDatasetFiles.js +0 -45
- package/serialization/resources/datasets/types/PaginatedDatasets.d.ts +0 -14
- package/serialization/resources/datasets/types/PaginatedDatasets.js +0 -45
- package/serialization/resources/datasets/types/index.d.ts +0 -6
- package/serialization/resources/datasets/types/index.js +0 -22
- /package/api/resources/{datasets/client/requests → auth/client}/index.js +0 -0
- /package/api/resources/{datasets → auth}/index.d.ts +0 -0
- /package/api/resources/{datasets → auth}/index.js +0 -0
- /package/api/resources/{datasets/client/requests/UploadDatasetFileRequest.js → auth/types/TokenGrant.js} +0 -0
- /package/api/resources/{datasets/types/CreateDatasetRequest.js → auth/types/TokenRequest.js} +0 -0
- /package/api/resources/{datasets/types/Dataset.js → auth/types/TokenResponse.js} +0 -0
- /package/dist/api/resources/{datasets/client/requests → auth/client}/index.js +0 -0
- /package/dist/api/resources/{datasets → auth}/index.d.ts +0 -0
- /package/dist/api/resources/{datasets → auth}/index.js +0 -0
- /package/{api/resources/datasets/types/DatasetFile.js → dist/api/resources/auth/types/TokenGrant.js} +0 -0
- /package/{api/resources/datasets/types/PaginatedDatasetFiles.js → dist/api/resources/auth/types/TokenRequest.js} +0 -0
- /package/{api/resources/datasets/types/PaginatedDatasets.js → dist/api/resources/auth/types/TokenResponse.js} +0 -0
- /package/dist/serialization/resources/{datasets → auth}/index.d.ts +0 -0
- /package/dist/serialization/resources/{datasets → auth}/index.js +0 -0
- /package/serialization/resources/{datasets → auth}/index.d.ts +0 -0
- /package/serialization/resources/{datasets → auth}/index.js +0 -0
package/Client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as environments from "./environments";
|
|
5
5
|
import * as core from "./core";
|
|
6
6
|
import { ApiStatus } from "./api/resources/apiStatus/client/Client";
|
|
7
|
-
import {
|
|
7
|
+
import { Auth } from "./api/resources/auth/client/Client";
|
|
8
8
|
import { Infill } from "./api/resources/infill/client/Client";
|
|
9
9
|
import { Tts } from "./api/resources/tts/client/Client";
|
|
10
10
|
import { VoiceChanger } from "./api/resources/voiceChanger/client/Client";
|
|
@@ -35,14 +35,14 @@ export declare namespace CartesiaClient {
|
|
|
35
35
|
export declare class CartesiaClient {
|
|
36
36
|
protected readonly _options: CartesiaClient.Options;
|
|
37
37
|
protected _apiStatus: ApiStatus | undefined;
|
|
38
|
-
protected
|
|
38
|
+
protected _auth: Auth | undefined;
|
|
39
39
|
protected _infill: Infill | undefined;
|
|
40
40
|
protected _tts: Tts | undefined;
|
|
41
41
|
protected _voiceChanger: VoiceChanger | undefined;
|
|
42
42
|
protected _voices: Voices | undefined;
|
|
43
43
|
constructor(_options?: CartesiaClient.Options);
|
|
44
44
|
get apiStatus(): ApiStatus;
|
|
45
|
-
get
|
|
45
|
+
get auth(): Auth;
|
|
46
46
|
get infill(): Infill;
|
|
47
47
|
get tts(): Tts;
|
|
48
48
|
get voiceChanger(): VoiceChanger;
|
package/Client.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CartesiaClient = void 0;
|
|
7
7
|
const Client_1 = require("./api/resources/apiStatus/client/Client");
|
|
8
|
-
const Client_2 = require("./api/resources/
|
|
8
|
+
const Client_2 = require("./api/resources/auth/client/Client");
|
|
9
9
|
const Client_3 = require("./api/resources/infill/client/Client");
|
|
10
10
|
const Client_4 = require("./api/resources/tts/client/Client");
|
|
11
11
|
const Client_5 = require("./api/resources/voiceChanger/client/Client");
|
|
@@ -18,9 +18,9 @@ class CartesiaClient {
|
|
|
18
18
|
var _a;
|
|
19
19
|
return ((_a = this._apiStatus) !== null && _a !== void 0 ? _a : (this._apiStatus = new Client_1.ApiStatus(this._options)));
|
|
20
20
|
}
|
|
21
|
-
get
|
|
21
|
+
get auth() {
|
|
22
22
|
var _a;
|
|
23
|
-
return ((_a = this.
|
|
23
|
+
return ((_a = this._auth) !== null && _a !== void 0 ? _a : (this._auth = new Client_2.Auth(this._options)));
|
|
24
24
|
}
|
|
25
25
|
get infill() {
|
|
26
26
|
var _a;
|
package/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
# Cartesia TypeScript
|
|
1
|
+
# Cartesia TypeScript SDK
|
|
2
2
|
|
|
3
3
|
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fcartesia-ai%2Fcartesia-js)
|
|
4
4
|
[](https://www.npmjs.com/package/@cartesia/cartesia-js)
|
|
5
5
|
[](https://discord.gg/cartesia)
|
|
6
6
|
|
|
7
|
-
The Cartesia TypeScript library provides convenient access to the Cartesia API from TypeScript.
|
|
7
|
+
The Cartesia TypeScript library provides convenient access to the Cartesia API from TypeScript/JavaScript, runnable in both Node.js and browsers.
|
|
8
|
+
|
|
9
|
+
> [!TIP]
|
|
10
|
+
> **[@cartesia-ai/cartesia-nextjs-demo](https://github.com/cartesia-ai/cartesia-nextjs-demo)** is our demo app that shows how to use Cartesia text-to-speech in a browser-based application.
|
|
8
11
|
|
|
9
12
|
## Installation
|
|
10
13
|
|
|
@@ -66,7 +66,7 @@ class ApiStatus {
|
|
|
66
66
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
67
67
|
url: (_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production,
|
|
68
68
|
method: "GET",
|
|
69
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
69
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
70
70
|
contentType: "application/json",
|
|
71
71
|
requestType: "json",
|
|
72
72
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../environments";
|
|
5
|
+
import * as core from "../../../../core";
|
|
6
|
+
import * as Cartesia from "../../../index";
|
|
7
|
+
export declare namespace Auth {
|
|
8
|
+
interface Options {
|
|
9
|
+
environment?: core.Supplier<environments.CartesiaEnvironment | string>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
12
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
13
|
+
/** Override the Cartesia-Version header */
|
|
14
|
+
cartesiaVersion?: "2024-06-10";
|
|
15
|
+
fetcher?: core.FetchFunction;
|
|
16
|
+
}
|
|
17
|
+
interface RequestOptions {
|
|
18
|
+
/** The maximum time to wait for a response in seconds. */
|
|
19
|
+
timeoutInSeconds?: number;
|
|
20
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
21
|
+
maxRetries?: number;
|
|
22
|
+
/** A hook to abort the request. */
|
|
23
|
+
abortSignal?: AbortSignal;
|
|
24
|
+
/** Override the Cartesia-Version header */
|
|
25
|
+
cartesiaVersion?: "2024-06-10";
|
|
26
|
+
/** Additional headers to include in the request. */
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare class Auth {
|
|
31
|
+
protected readonly _options: Auth.Options;
|
|
32
|
+
constructor(_options?: Auth.Options);
|
|
33
|
+
/**
|
|
34
|
+
* Generates a new Access Token for the client. These tokens are short-lived and should be used to make requests to the API from authenticated clients.
|
|
35
|
+
*
|
|
36
|
+
* @param {Cartesia.TokenRequest} request
|
|
37
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* await client.auth.accessToken({
|
|
41
|
+
* grants: {
|
|
42
|
+
* tts: true
|
|
43
|
+
* },
|
|
44
|
+
* expiresIn: 60
|
|
45
|
+
* })
|
|
46
|
+
*/
|
|
47
|
+
accessToken(request: Cartesia.TokenRequest, requestOptions?: Auth.RequestOptions): Promise<Cartesia.TokenResponse>;
|
|
48
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
49
|
+
"X-API-Key": string | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.Auth = void 0;
|
|
52
|
+
const environments = __importStar(require("../../../../environments"));
|
|
53
|
+
const core = __importStar(require("../../../../core"));
|
|
54
|
+
const serializers = __importStar(require("../../../../serialization/index"));
|
|
55
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
56
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
57
|
+
class Auth {
|
|
58
|
+
constructor(_options = {}) {
|
|
59
|
+
this._options = _options;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Generates a new Access Token for the client. These tokens are short-lived and should be used to make requests to the API from authenticated clients.
|
|
63
|
+
*
|
|
64
|
+
* @param {Cartesia.TokenRequest} request
|
|
65
|
+
* @param {Auth.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.auth.accessToken({
|
|
69
|
+
* grants: {
|
|
70
|
+
* tts: true
|
|
71
|
+
* },
|
|
72
|
+
* expiresIn: 60
|
|
73
|
+
* })
|
|
74
|
+
*/
|
|
75
|
+
accessToken(request, requestOptions) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
var _a, _b, _c, _d, _e, _f;
|
|
78
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
79
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "access-token"),
|
|
80
|
+
method: "POST",
|
|
81
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
82
|
+
contentType: "application/json",
|
|
83
|
+
requestType: "json",
|
|
84
|
+
body: serializers.TokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
85
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
86
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
87
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
88
|
+
});
|
|
89
|
+
if (_response.ok) {
|
|
90
|
+
return serializers.TokenResponse.parseOrThrow(_response.body, {
|
|
91
|
+
unrecognizedObjectKeys: "passthrough",
|
|
92
|
+
allowUnrecognizedUnionMembers: true,
|
|
93
|
+
allowUnrecognizedEnumValues: true,
|
|
94
|
+
skipValidation: true,
|
|
95
|
+
breadcrumbsPrefix: ["response"],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (_response.error.reason === "status-code") {
|
|
99
|
+
throw new errors.CartesiaError({
|
|
100
|
+
statusCode: _response.error.statusCode,
|
|
101
|
+
body: _response.error.body,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
switch (_response.error.reason) {
|
|
105
|
+
case "non-json":
|
|
106
|
+
throw new errors.CartesiaError({
|
|
107
|
+
statusCode: _response.error.statusCode,
|
|
108
|
+
body: _response.error.rawBody,
|
|
109
|
+
});
|
|
110
|
+
case "timeout":
|
|
111
|
+
throw new errors.CartesiaTimeoutError("Timeout exceeded when calling POST /access-token.");
|
|
112
|
+
case "unknown":
|
|
113
|
+
throw new errors.CartesiaError({
|
|
114
|
+
message: _response.error.errorMessage,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
_getCustomAuthorizationHeaders() {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
122
|
+
return { "X-API-Key": apiKeyValue };
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.Auth = Auth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Cartesia from "../../../index";
|
|
5
|
+
export interface TokenRequest {
|
|
6
|
+
/** The permissions to be granted via the token. */
|
|
7
|
+
grants: Cartesia.TokenGrant;
|
|
8
|
+
/** The number of seconds the token will be valid for since the time of generation. The maximum is 1 hour (3600 seconds). */
|
|
9
|
+
expiresIn?: number;
|
|
10
|
+
}
|
|
@@ -14,4 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./TokenGrant"), exports);
|
|
18
|
+
__exportStar(require("./TokenRequest"), exports);
|
|
19
|
+
__exportStar(require("./TokenResponse"), exports);
|
package/api/resources/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as apiStatus from "./apiStatus";
|
|
2
2
|
export * from "./apiStatus/types";
|
|
3
|
-
export * as
|
|
4
|
-
export * from "./
|
|
3
|
+
export * as auth from "./auth";
|
|
4
|
+
export * from "./auth/types";
|
|
5
5
|
export * as embedding from "./embedding";
|
|
6
6
|
export * from "./embedding/types";
|
|
7
7
|
export * as tts from "./tts";
|
|
@@ -11,7 +11,6 @@ export * from "./voiceChanger/types";
|
|
|
11
11
|
export * as voices from "./voices";
|
|
12
12
|
export * from "./voices/types";
|
|
13
13
|
export * as infill from "./infill";
|
|
14
|
-
export * from "./datasets/client/requests";
|
|
15
14
|
export * from "./infill/client/requests";
|
|
16
15
|
export * from "./voiceChanger/client/requests";
|
|
17
16
|
export * from "./voices/client/requests";
|
package/api/resources/index.js
CHANGED
|
@@ -36,11 +36,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.
|
|
39
|
+
exports.infill = exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
40
40
|
exports.apiStatus = __importStar(require("./apiStatus"));
|
|
41
41
|
__exportStar(require("./apiStatus/types"), exports);
|
|
42
|
-
exports.
|
|
43
|
-
__exportStar(require("./
|
|
42
|
+
exports.auth = __importStar(require("./auth"));
|
|
43
|
+
__exportStar(require("./auth/types"), exports);
|
|
44
44
|
exports.embedding = __importStar(require("./embedding"));
|
|
45
45
|
__exportStar(require("./embedding/types"), exports);
|
|
46
46
|
exports.tts = __importStar(require("./tts"));
|
|
@@ -50,7 +50,6 @@ __exportStar(require("./voiceChanger/types"), exports);
|
|
|
50
50
|
exports.voices = __importStar(require("./voices"));
|
|
51
51
|
__exportStar(require("./voices/types"), exports);
|
|
52
52
|
exports.infill = __importStar(require("./infill"));
|
|
53
|
-
__exportStar(require("./datasets/client/requests"), exports);
|
|
54
53
|
__exportStar(require("./infill/client/requests"), exports);
|
|
55
54
|
__exportStar(require("./voiceChanger/client/requests"), exports);
|
|
56
55
|
__exportStar(require("./voices/client/requests"), exports);
|
|
@@ -113,7 +113,7 @@ class Infill {
|
|
|
113
113
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
114
114
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/infill/bytes"),
|
|
115
115
|
method: "POST",
|
|
116
|
-
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
116
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
117
117
|
requestType: "file",
|
|
118
118
|
duplex: _maybeEncodedRequest.duplex,
|
|
119
119
|
body: _maybeEncodedRequest.body,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* An identifier corresponding to the number of flush commands that have been sent for this context. Starts at 1.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* This can be used to map chunks of audio to certain transcript submissions.
|
|
8
8
|
*/
|
|
9
9
|
export type FlushId = number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export interface GenerationRequest {
|
|
6
|
-
/** The ID of the model to use for the generation. See [Models](/build-with-
|
|
6
|
+
/** The ID of the model to use for the generation. See [Models](/build-with-cartesia/models) for available models. */
|
|
7
7
|
modelId: string;
|
|
8
8
|
/** The transcript to generate speech for. This can be a string or an iterator over strings. */
|
|
9
9
|
transcript?: unknown;
|
|
@@ -15,6 +15,14 @@ export interface GenerationRequest {
|
|
|
15
15
|
* If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
|
|
16
16
|
*/
|
|
17
17
|
duration?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The text [classifier-free guidance](https://arxiv.org/abs/2207.12598) value for the request.
|
|
20
|
+
*
|
|
21
|
+
* Higher values causes the model to attend more to the text but speed up the generation. Lower values reduce the speaking rate but can increase the risk of hallucinations. The default value is `3.0`. For a slower speaking rate, we recommend values between `2.0` and `3.0`. Values are supported between `1.5` and `3.0`.
|
|
22
|
+
*
|
|
23
|
+
* This parameter is only supported for `sonic-2` models.
|
|
24
|
+
*/
|
|
25
|
+
textCfg?: number;
|
|
18
26
|
contextId?: Cartesia.ContextId;
|
|
19
27
|
/**
|
|
20
28
|
* Whether this input may be followed by more inputs.
|
|
@@ -27,4 +35,6 @@ export interface GenerationRequest {
|
|
|
27
35
|
addTimestamps?: boolean;
|
|
28
36
|
/** Whether to return phoneme-level timestamps. */
|
|
29
37
|
addPhonemeTimestamps?: boolean;
|
|
38
|
+
/** Whether to use the original transcript for timestamps. */
|
|
39
|
+
useOriginalTimestamps?: boolean;
|
|
30
40
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export interface TtsRequest {
|
|
6
|
-
/** The ID of the model to use for the generation. See [Models](/build-with-
|
|
6
|
+
/** The ID of the model to use for the generation. See [Models](/build-with-cartesia/models) for available models. */
|
|
7
7
|
modelId: string;
|
|
8
8
|
transcript: string;
|
|
9
9
|
voice: Cartesia.TtsRequestVoiceSpecifier;
|
|
@@ -14,4 +14,12 @@ export interface TtsRequest {
|
|
|
14
14
|
* If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
|
|
15
15
|
*/
|
|
16
16
|
duration?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The text [classifier-free guidance](https://arxiv.org/abs/2207.12598) value for the request.
|
|
19
|
+
*
|
|
20
|
+
* Higher values causes the model to attend more to the text but speed up the generation. Lower values reduce the speaking rate but can increase the risk of hallucinations. The default value is `3.0`. For a slower speaking rate, we recommend values between `2.0` and `3.0`. Values are supported between `1.5` and `3.0`.
|
|
21
|
+
*
|
|
22
|
+
* This parameter is only supported for `sonic-2` models.
|
|
23
|
+
*/
|
|
24
|
+
textCfg?: number;
|
|
17
25
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Cartesia from "../../../index";
|
|
5
5
|
export interface WebSocketTtsRequest {
|
|
6
|
-
/** The ID of the model to use for the generation. See [Models](/build-with-
|
|
6
|
+
/** The ID of the model to use for the generation. See [Models](/build-with-cartesia/models) for available models. */
|
|
7
7
|
modelId: string;
|
|
8
8
|
outputFormat?: Cartesia.OutputFormat;
|
|
9
9
|
transcript?: string;
|
|
@@ -12,6 +12,8 @@ export interface WebSocketTtsRequest {
|
|
|
12
12
|
language?: string;
|
|
13
13
|
addTimestamps?: boolean;
|
|
14
14
|
addPhonemeTimestamps?: boolean;
|
|
15
|
+
useOriginalTimestamps?: boolean;
|
|
15
16
|
continue?: boolean;
|
|
16
17
|
contextId?: string;
|
|
18
|
+
textCfg?: number;
|
|
17
19
|
}
|
|
@@ -70,7 +70,7 @@ class Voices {
|
|
|
70
70
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
71
71
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
|
|
72
72
|
method: "GET",
|
|
73
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
73
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
74
74
|
contentType: "application/json",
|
|
75
75
|
requestType: "json",
|
|
76
76
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -148,7 +148,9 @@ class Voices {
|
|
|
148
148
|
}
|
|
149
149
|
_request.append("language", serializers.SupportedLanguage.jsonOrThrow(request.language, { unrecognizedObjectKeys: "strip" }));
|
|
150
150
|
_request.append("mode", serializers.CloneMode.jsonOrThrow(request.mode, { unrecognizedObjectKeys: "strip" }));
|
|
151
|
-
|
|
151
|
+
if (request.enhance != null) {
|
|
152
|
+
_request.append("enhance", request.enhance.toString());
|
|
153
|
+
}
|
|
152
154
|
if (request.transcript != null) {
|
|
153
155
|
_request.append("transcript", request.transcript);
|
|
154
156
|
}
|
|
@@ -156,7 +158,7 @@ class Voices {
|
|
|
156
158
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
157
159
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/clone"),
|
|
158
160
|
method: "POST",
|
|
159
|
-
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
161
|
+
headers: Object.assign(Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
160
162
|
requestType: "file",
|
|
161
163
|
duplex: _maybeEncodedRequest.duplex,
|
|
162
164
|
body: _maybeEncodedRequest.body,
|
|
@@ -207,7 +209,7 @@ class Voices {
|
|
|
207
209
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
208
210
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
|
|
209
211
|
method: "DELETE",
|
|
210
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
212
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
211
213
|
contentType: "application/json",
|
|
212
214
|
requestType: "json",
|
|
213
215
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -255,7 +257,7 @@ class Voices {
|
|
|
255
257
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
256
258
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
|
|
257
259
|
method: "PATCH",
|
|
258
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
260
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
259
261
|
contentType: "application/json",
|
|
260
262
|
requestType: "json",
|
|
261
263
|
body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -306,7 +308,7 @@ class Voices {
|
|
|
306
308
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
307
309
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, `/voices/${encodeURIComponent(serializers.VoiceId.jsonOrThrow(id))}`),
|
|
308
310
|
method: "GET",
|
|
309
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
311
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
310
312
|
contentType: "application/json",
|
|
311
313
|
requestType: "json",
|
|
312
314
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -365,7 +367,7 @@ class Voices {
|
|
|
365
367
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
366
368
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/localize"),
|
|
367
369
|
method: "POST",
|
|
368
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
370
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
369
371
|
contentType: "application/json",
|
|
370
372
|
requestType: "json",
|
|
371
373
|
body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -424,7 +426,7 @@ class Voices {
|
|
|
424
426
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
425
427
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/mix"),
|
|
426
428
|
method: "POST",
|
|
427
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
429
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
428
430
|
contentType: "application/json",
|
|
429
431
|
requestType: "json",
|
|
430
432
|
body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -483,7 +485,7 @@ class Voices {
|
|
|
483
485
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
484
486
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CartesiaEnvironment.Production, "/voices/"),
|
|
485
487
|
method: "POST",
|
|
486
|
-
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.1
|
|
488
|
+
headers: Object.assign(Object.assign({ "Cartesia-Version": (_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.cartesiaVersion) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.cartesiaVersion) !== null && _f !== void 0 ? _f : "2024-06-10", "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@cartesia/cartesia-js", "X-Fern-SDK-Version": "2.2.1", "User-Agent": "@cartesia/cartesia-js/2.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
487
489
|
contentType: "application/json",
|
|
488
490
|
requestType: "json",
|
|
489
491
|
body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -47,7 +47,7 @@ export interface CloneVoiceRequest {
|
|
|
47
47
|
* Whether to enhance the clip to improve its quality before cloning. Useful if the clip has background noise.
|
|
48
48
|
*
|
|
49
49
|
*/
|
|
50
|
-
enhance
|
|
50
|
+
enhance?: boolean;
|
|
51
51
|
/**
|
|
52
52
|
* Optional transcript of the words spoken in the audio clip. Only used for similarity mode.
|
|
53
53
|
*
|
package/core/websocket/ws.d.ts
CHANGED
package/core/websocket/ws.js
CHANGED
package/dist/Client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as environments from "./environments";
|
|
5
5
|
import * as core from "./core";
|
|
6
6
|
import { ApiStatus } from "./api/resources/apiStatus/client/Client";
|
|
7
|
-
import {
|
|
7
|
+
import { Auth } from "./api/resources/auth/client/Client";
|
|
8
8
|
import { Infill } from "./api/resources/infill/client/Client";
|
|
9
9
|
import { Tts } from "./api/resources/tts/client/Client";
|
|
10
10
|
import { VoiceChanger } from "./api/resources/voiceChanger/client/Client";
|
|
@@ -35,14 +35,14 @@ export declare namespace CartesiaClient {
|
|
|
35
35
|
export declare class CartesiaClient {
|
|
36
36
|
protected readonly _options: CartesiaClient.Options;
|
|
37
37
|
protected _apiStatus: ApiStatus | undefined;
|
|
38
|
-
protected
|
|
38
|
+
protected _auth: Auth | undefined;
|
|
39
39
|
protected _infill: Infill | undefined;
|
|
40
40
|
protected _tts: Tts | undefined;
|
|
41
41
|
protected _voiceChanger: VoiceChanger | undefined;
|
|
42
42
|
protected _voices: Voices | undefined;
|
|
43
43
|
constructor(_options?: CartesiaClient.Options);
|
|
44
44
|
get apiStatus(): ApiStatus;
|
|
45
|
-
get
|
|
45
|
+
get auth(): Auth;
|
|
46
46
|
get infill(): Infill;
|
|
47
47
|
get tts(): Tts;
|
|
48
48
|
get voiceChanger(): VoiceChanger;
|