@cartesia/cartesia-js 2.1.10 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/Client.d.ts +3 -3
  2. package/Client.js +3 -3
  3. package/api/resources/apiStatus/client/Client.js +1 -1
  4. package/api/resources/auth/client/Client.d.ts +51 -0
  5. package/api/resources/auth/client/Client.js +126 -0
  6. package/api/resources/auth/client/index.d.ts +1 -0
  7. package/api/resources/auth/types/TokenGrant.d.ts +7 -0
  8. package/api/resources/auth/types/TokenRequest.d.ts +10 -0
  9. package/api/resources/auth/types/TokenResponse.d.ts +7 -0
  10. package/api/resources/auth/types/index.d.ts +3 -0
  11. package/{dist/api/resources/datasets/client → api/resources/auth/types}/index.js +3 -1
  12. package/api/resources/index.d.ts +2 -3
  13. package/api/resources/index.js +3 -4
  14. package/api/resources/infill/client/Client.js +1 -1
  15. package/api/resources/tts/types/FlushId.d.ts +2 -2
  16. package/api/resources/tts/types/GenerationRequest.d.ts +3 -1
  17. package/api/resources/tts/types/TtsRequest.d.ts +1 -1
  18. package/api/resources/tts/types/WebSocketTtsRequest.d.ts +2 -1
  19. package/api/resources/voices/client/Client.js +8 -8
  20. package/core/websocket/ws.d.ts +1 -0
  21. package/core/websocket/ws.js +1 -1
  22. package/dist/Client.d.ts +3 -3
  23. package/dist/Client.js +3 -3
  24. package/dist/api/resources/apiStatus/client/Client.js +1 -1
  25. package/dist/api/resources/auth/client/Client.d.ts +51 -0
  26. package/dist/api/resources/auth/client/Client.js +126 -0
  27. package/dist/api/resources/auth/client/index.d.ts +1 -0
  28. package/dist/api/resources/auth/types/TokenGrant.d.ts +7 -0
  29. package/dist/api/resources/auth/types/TokenRequest.d.ts +10 -0
  30. package/dist/api/resources/auth/types/TokenResponse.d.ts +7 -0
  31. package/dist/api/resources/auth/types/index.d.ts +3 -0
  32. package/{api/resources/datasets/client → dist/api/resources/auth/types}/index.js +3 -1
  33. package/dist/api/resources/index.d.ts +2 -3
  34. package/dist/api/resources/index.js +3 -4
  35. package/dist/api/resources/infill/client/Client.js +1 -1
  36. package/dist/api/resources/tts/types/FlushId.d.ts +2 -2
  37. package/dist/api/resources/tts/types/GenerationRequest.d.ts +3 -1
  38. package/dist/api/resources/tts/types/TtsRequest.d.ts +1 -1
  39. package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +2 -1
  40. package/dist/api/resources/voices/client/Client.js +8 -8
  41. package/dist/core/websocket/ws.d.ts +1 -0
  42. package/dist/core/websocket/ws.js +1 -1
  43. package/dist/serialization/resources/{datasets/types/Dataset.d.ts → auth/types/TokenGrant.d.ts} +3 -5
  44. package/{serialization/resources/datasets/types/FilePurpose.js → dist/serialization/resources/auth/types/TokenGrant.js} +4 -2
  45. package/dist/serialization/resources/auth/types/TokenRequest.d.ts +14 -0
  46. package/dist/serialization/resources/{datasets/types/DatasetFile.js → auth/types/TokenRequest.js} +5 -5
  47. package/{serialization/resources/datasets/types/Dataset.d.ts → dist/serialization/resources/auth/types/TokenResponse.d.ts} +3 -5
  48. package/dist/serialization/resources/{datasets/types/CreateDatasetRequest.js → auth/types/TokenResponse.js} +3 -3
  49. package/dist/serialization/resources/auth/types/index.d.ts +3 -0
  50. package/dist/serialization/resources/auth/types/index.js +19 -0
  51. package/dist/serialization/resources/index.d.ts +2 -2
  52. package/dist/serialization/resources/index.js +3 -3
  53. package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +1 -0
  54. package/dist/serialization/resources/tts/types/GenerationRequest.js +1 -0
  55. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
  56. package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +1 -0
  57. package/dist/version.d.ts +1 -1
  58. package/dist/version.js +1 -1
  59. package/dist/wrapper/Websocket.js +8 -2
  60. package/package.json +1 -1
  61. package/reference.md +11 -81
  62. package/{dist/serialization/resources/datasets/types/CreateDatasetRequest.d.ts → serialization/resources/auth/types/TokenGrant.d.ts} +3 -3
  63. package/{dist/serialization/resources/datasets/types/FilePurpose.js → serialization/resources/auth/types/TokenGrant.js} +4 -2
  64. package/serialization/resources/auth/types/TokenRequest.d.ts +14 -0
  65. package/{dist/serialization/resources/datasets/types/Dataset.js → serialization/resources/auth/types/TokenRequest.js} +5 -5
  66. package/serialization/resources/{datasets/types/CreateDatasetRequest.d.ts → auth/types/TokenResponse.d.ts} +3 -3
  67. package/serialization/resources/{datasets/types/CreateDatasetRequest.js → auth/types/TokenResponse.js} +3 -3
  68. package/serialization/resources/auth/types/index.d.ts +3 -0
  69. package/serialization/resources/auth/types/index.js +19 -0
  70. package/serialization/resources/index.d.ts +2 -2
  71. package/serialization/resources/index.js +3 -3
  72. package/serialization/resources/tts/types/GenerationRequest.d.ts +1 -0
  73. package/serialization/resources/tts/types/GenerationRequest.js +1 -0
  74. package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +1 -0
  75. package/serialization/resources/tts/types/WebSocketTtsRequest.js +1 -0
  76. package/version.d.ts +1 -1
  77. package/version.js +1 -1
  78. package/wrapper/Websocket.js +8 -2
  79. package/api/resources/datasets/client/Client.d.ts +0 -70
  80. package/api/resources/datasets/client/Client.js +0 -268
  81. package/api/resources/datasets/client/index.d.ts +0 -1
  82. package/api/resources/datasets/client/requests/UploadDatasetFileRequest.d.ts +0 -7
  83. package/api/resources/datasets/client/requests/index.d.ts +0 -1
  84. package/api/resources/datasets/types/CreateDatasetRequest.d.ts +0 -6
  85. package/api/resources/datasets/types/Dataset.d.ts +0 -8
  86. package/api/resources/datasets/types/DatasetFile.d.ts +0 -8
  87. package/api/resources/datasets/types/FilePurpose.d.ts +0 -7
  88. package/api/resources/datasets/types/FilePurpose.js +0 -9
  89. package/api/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -8
  90. package/api/resources/datasets/types/PaginatedDatasets.d.ts +0 -8
  91. package/api/resources/datasets/types/index.d.ts +0 -6
  92. package/api/resources/datasets/types/index.js +0 -22
  93. package/dist/api/resources/datasets/client/Client.d.ts +0 -70
  94. package/dist/api/resources/datasets/client/Client.js +0 -268
  95. package/dist/api/resources/datasets/client/index.d.ts +0 -1
  96. package/dist/api/resources/datasets/client/requests/UploadDatasetFileRequest.d.ts +0 -7
  97. package/dist/api/resources/datasets/client/requests/UploadDatasetFileRequest.js +0 -5
  98. package/dist/api/resources/datasets/client/requests/index.d.ts +0 -1
  99. package/dist/api/resources/datasets/types/CreateDatasetRequest.d.ts +0 -6
  100. package/dist/api/resources/datasets/types/CreateDatasetRequest.js +0 -5
  101. package/dist/api/resources/datasets/types/Dataset.d.ts +0 -8
  102. package/dist/api/resources/datasets/types/Dataset.js +0 -5
  103. package/dist/api/resources/datasets/types/DatasetFile.d.ts +0 -8
  104. package/dist/api/resources/datasets/types/DatasetFile.js +0 -5
  105. package/dist/api/resources/datasets/types/FilePurpose.d.ts +0 -7
  106. package/dist/api/resources/datasets/types/FilePurpose.js +0 -9
  107. package/dist/api/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -8
  108. package/dist/api/resources/datasets/types/PaginatedDatasetFiles.js +0 -5
  109. package/dist/api/resources/datasets/types/PaginatedDatasets.d.ts +0 -8
  110. package/dist/api/resources/datasets/types/PaginatedDatasets.js +0 -5
  111. package/dist/api/resources/datasets/types/index.d.ts +0 -6
  112. package/dist/api/resources/datasets/types/index.js +0 -22
  113. package/dist/serialization/resources/datasets/types/DatasetFile.d.ts +0 -14
  114. package/dist/serialization/resources/datasets/types/FilePurpose.d.ts +0 -10
  115. package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -14
  116. package/dist/serialization/resources/datasets/types/PaginatedDatasetFiles.js +0 -45
  117. package/dist/serialization/resources/datasets/types/PaginatedDatasets.d.ts +0 -14
  118. package/dist/serialization/resources/datasets/types/PaginatedDatasets.js +0 -45
  119. package/dist/serialization/resources/datasets/types/index.d.ts +0 -6
  120. package/dist/serialization/resources/datasets/types/index.js +0 -22
  121. package/serialization/resources/datasets/types/Dataset.js +0 -45
  122. package/serialization/resources/datasets/types/DatasetFile.d.ts +0 -14
  123. package/serialization/resources/datasets/types/DatasetFile.js +0 -45
  124. package/serialization/resources/datasets/types/FilePurpose.d.ts +0 -10
  125. package/serialization/resources/datasets/types/PaginatedDatasetFiles.d.ts +0 -14
  126. package/serialization/resources/datasets/types/PaginatedDatasetFiles.js +0 -45
  127. package/serialization/resources/datasets/types/PaginatedDatasets.d.ts +0 -14
  128. package/serialization/resources/datasets/types/PaginatedDatasets.js +0 -45
  129. package/serialization/resources/datasets/types/index.d.ts +0 -6
  130. package/serialization/resources/datasets/types/index.js +0 -22
  131. /package/api/resources/{datasets/client/requests → auth/client}/index.js +0 -0
  132. /package/api/resources/{datasets → auth}/index.d.ts +0 -0
  133. /package/api/resources/{datasets → auth}/index.js +0 -0
  134. /package/api/resources/{datasets/client/requests/UploadDatasetFileRequest.js → auth/types/TokenGrant.js} +0 -0
  135. /package/api/resources/{datasets/types/CreateDatasetRequest.js → auth/types/TokenRequest.js} +0 -0
  136. /package/api/resources/{datasets/types/Dataset.js → auth/types/TokenResponse.js} +0 -0
  137. /package/dist/api/resources/{datasets/client/requests → auth/client}/index.js +0 -0
  138. /package/dist/api/resources/{datasets → auth}/index.d.ts +0 -0
  139. /package/dist/api/resources/{datasets → auth}/index.js +0 -0
  140. /package/{api/resources/datasets/types/DatasetFile.js → dist/api/resources/auth/types/TokenGrant.js} +0 -0
  141. /package/{api/resources/datasets/types/PaginatedDatasetFiles.js → dist/api/resources/auth/types/TokenRequest.js} +0 -0
  142. /package/{api/resources/datasets/types/PaginatedDatasets.js → dist/api/resources/auth/types/TokenResponse.js} +0 -0
  143. /package/dist/serialization/resources/{datasets → auth}/index.d.ts +0 -0
  144. /package/dist/serialization/resources/{datasets → auth}/index.js +0 -0
  145. /package/serialization/resources/{datasets → auth}/index.d.ts +0 -0
  146. /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 { Datasets } from "./api/resources/datasets/client/Client";
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 _datasets: Datasets | undefined;
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 datasets(): Datasets;
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/datasets/client/Client");
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 datasets() {
21
+ get auth() {
22
22
  var _a;
23
- return ((_a = this._datasets) !== null && _a !== void 0 ? _a : (this._datasets = new Client_2.Datasets(this._options)));
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;
@@ -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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TokenGrant {
5
+ /** The `tts` grant allows the token to be used to access any TTS endpoint. */
6
+ tts: boolean;
7
+ }
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TokenResponse {
5
+ /** The generated Access Token. */
6
+ token: string;
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./TokenGrant";
2
+ export * from "./TokenRequest";
3
+ export * from "./TokenResponse";
@@ -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("./requests"), exports);
17
+ __exportStar(require("./TokenGrant"), exports);
18
+ __exportStar(require("./TokenRequest"), exports);
19
+ __exportStar(require("./TokenResponse"), exports);
@@ -1,7 +1,7 @@
1
1
  export * as apiStatus from "./apiStatus";
2
2
  export * from "./apiStatus/types";
3
- export * as datasets from "./datasets";
4
- export * from "./datasets/types";
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";
@@ -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.datasets = exports.apiStatus = void 0;
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.datasets = __importStar(require("./datasets"));
43
- __exportStar(require("./datasets/types"), exports);
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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
- * A unique identifier for the flush. You can use any unique identifier, like a UUID or human ID.
5
+ * An identifier corresponding to the number of flush commands that have been sent for this context. Starts at 1.
6
6
  *
7
- * Some customers use unique identifiers from their own systems (such as conversation IDs) as flush IDs.
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-sonic/models) for available models. */
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;
@@ -27,4 +27,6 @@ export interface GenerationRequest {
27
27
  addTimestamps?: boolean;
28
28
  /** Whether to return phoneme-level timestamps. */
29
29
  addPhonemeTimestamps?: boolean;
30
+ /** Whether to use the original transcript for timestamps. */
31
+ useOriginalTimestamps?: boolean;
30
32
  }
@@ -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-sonic/models) for available models. */
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;
@@ -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-sonic/models) for available models. */
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,7 @@ 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;
17
18
  }
@@ -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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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,
@@ -156,7 +156,7 @@ class Voices {
156
156
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
157
157
  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
158
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
160
  requestType: "file",
161
161
  duplex: _maybeEncodedRequest.duplex,
162
162
  body: _maybeEncodedRequest.body,
@@ -207,7 +207,7 @@ class Voices {
207
207
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
208
208
  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
209
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
211
  contentType: "application/json",
212
212
  requestType: "json",
213
213
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -255,7 +255,7 @@ class Voices {
255
255
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
256
256
  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
257
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
259
  contentType: "application/json",
260
260
  requestType: "json",
261
261
  body: serializers.UpdateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -306,7 +306,7 @@ class Voices {
306
306
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
307
307
  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
308
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
310
  contentType: "application/json",
311
311
  requestType: "json",
312
312
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -365,7 +365,7 @@ class Voices {
365
365
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
366
366
  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
367
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
369
  contentType: "application/json",
370
370
  requestType: "json",
371
371
  body: serializers.LocalizeVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -424,7 +424,7 @@ class Voices {
424
424
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
425
425
  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
426
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
428
  contentType: "application/json",
429
429
  requestType: "json",
430
430
  body: serializers.MixVoicesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -483,7 +483,7 @@ class Voices {
483
483
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
484
484
  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
485
  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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.2.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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
487
  contentType: "application/json",
488
488
  requestType: "json",
489
489
  body: serializers.CreateVoiceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -3,6 +3,7 @@ export type Event = Events.Event;
3
3
  export type ErrorEvent = Events.ErrorEvent;
4
4
  export type CloseEvent = Events.CloseEvent;
5
5
  export type Options = {
6
+ accessToken?: string;
6
7
  WebSocket?: any;
7
8
  maxReconnectionDelay?: number;
8
9
  minReconnectionDelay?: number;
@@ -42,7 +42,7 @@ const getGlobalWebSocket = () => {
42
42
  // @ts-ignore
43
43
  return WebSocket;
44
44
  }
45
- else if (runtime_1.RUNTIME.type === "node") {
45
+ if (runtime_1.RUNTIME.type === "node") {
46
46
  return ws_1.WebSocket;
47
47
  }
48
48
  return undefined;
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 { Datasets } from "./api/resources/datasets/client/Client";
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 _datasets: Datasets | undefined;
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 datasets(): Datasets;
45
+ get auth(): Auth;
46
46
  get infill(): Infill;
47
47
  get tts(): Tts;
48
48
  get voiceChanger(): VoiceChanger;
package/dist/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/datasets/client/Client");
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 datasets() {
21
+ get auth() {
22
22
  var _a;
23
- return ((_a = this._datasets) !== null && _a !== void 0 ? _a : (this._datasets = new Client_2.Datasets(this._options)));
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;
@@ -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.10", "User-Agent": "@cartesia/cartesia-js/2.1.10", "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),
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.0", "User-Agent": "@cartesia/cartesia-js/2.2.0", "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,