spitch 1.48.0 → 1.50.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.
- package/CHANGELOG.md +40 -0
- package/README.md +16 -50
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +2 -1
- package/api-promise.d.ts.map +1 -1
- package/api-promise.js +15 -2
- package/api-promise.js.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/client.d.mts +4 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -19
- package/client.d.ts.map +1 -1
- package/client.js +94 -29
- package/client.js.map +1 -1
- package/client.mjs +37 -5
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts +3 -3
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js +15 -5
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs +11 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.js +1 -1
- package/core/error.js.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +4 -4
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +17 -7
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +11 -1
- package/core/pagination.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts +2 -2
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.js +1 -1
- package/core/uploads.js.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +2 -1
- package/error.d.ts.map +1 -1
- package/error.js +15 -2
- package/error.js.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +6 -6
- package/index.d.ts.map +1 -1
- package/index.js +6 -6
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/detect-platform.js +1 -1
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.js +1 -1
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts +2 -2
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +1 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +4 -4
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +8 -2
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.js +2 -2
- package/internal/to-file.js.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +6 -6
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -6
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts +3 -3
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.js +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.js.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts +2 -2
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +3 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/query.js +1 -1
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/values.js +1 -1
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts +7 -7
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.js +21 -8
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs.map +1 -1
- package/package.json +1 -1
- package/pagination.d.mts +1 -0
- package/pagination.d.mts.map +1 -1
- package/pagination.d.ts +2 -1
- package/pagination.d.ts.map +1 -1
- package/pagination.js +15 -2
- package/pagination.js.map +1 -1
- package/pagination.mjs +1 -0
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +2 -1
- package/resource.d.ts.map +1 -1
- package/resource.js +15 -2
- package/resource.js.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/balance.d.mts +13 -0
- package/resources/balance.d.mts.map +1 -0
- package/resources/balance.d.ts +13 -0
- package/resources/balance.d.ts.map +1 -0
- package/resources/balance.js +12 -0
- package/resources/balance.js.map +1 -0
- package/resources/balance.mjs +8 -0
- package/resources/balance.mjs.map +1 -0
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +5 -5
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +4 -4
- package/resources/files.js.map +1 -1
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +6 -4
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/speech.d.mts +37 -22
- package/resources/speech.d.mts.map +1 -1
- package/resources/speech.d.ts +41 -26
- package/resources/speech.d.ts.map +1 -1
- package/resources/speech.js +4 -5
- package/resources/speech.js.map +1 -1
- package/resources/speech.mjs +1 -2
- package/resources/speech.mjs.map +1 -1
- package/resources/text.d.mts +24 -4
- package/resources/text.d.mts.map +1 -1
- package/resources/text.d.ts +27 -7
- package/resources/text.d.ts.map +1 -1
- package/resources/text.js +2 -2
- package/resources/text.js.map +1 -1
- package/resources/text.mjs +1 -1
- package/resources/text.mjs.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.js +15 -2
- package/resources.js.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/client.ts +29 -4
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/balance.ts +16 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/speech.ts +45 -26
- package/src/resources/text.ts +27 -5
- package/src/version.ts +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +2 -1
- package/uploads.d.ts.map +1 -1
- package/uploads.js +15 -2
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/internal/tslib.js +0 -81
- package/internal/tslib.mjs +0 -17
package/resources.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./resources/index.js"), exports);
|
|
17
|
+
__exportStar(require("./resources/index"), exports);
|
|
5
18
|
//# sourceMappingURL=resources.js.map
|
package/resources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
package/resources.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
|
package/src/client.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { stringifyQuery } from './internal/utils/query';
|
|
|
15
15
|
import { VERSION } from './version';
|
|
16
16
|
import * as Errors from './core/error';
|
|
17
17
|
import * as Pagination from './core/pagination';
|
|
18
|
+
import { Balance, type BalanceResponse } from './resources/balance';
|
|
18
19
|
import { AbstractPage, type FilesCursorParams, FilesCursorResponse } from './core/pagination';
|
|
19
20
|
import * as Uploads from './core/uploads';
|
|
20
21
|
import * as API from './resources/index';
|
|
@@ -152,7 +153,7 @@ export class Spitch {
|
|
|
152
153
|
*
|
|
153
154
|
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
154
155
|
* @param {boolean | null | undefined} [opts.dataRetention=true]
|
|
155
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.
|
|
156
|
+
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spitch.app] - Override the default base URL for the API.
|
|
156
157
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
157
158
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
158
159
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -176,7 +177,7 @@ export class Spitch {
|
|
|
176
177
|
apiKey,
|
|
177
178
|
dataRetention,
|
|
178
179
|
...opts,
|
|
179
|
-
baseURL: baseURL || `https://api.
|
|
180
|
+
baseURL: baseURL || `https://api.spitch.app`,
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
this.baseURL = options.baseURL!;
|
|
@@ -194,6 +195,18 @@ export class Spitch {
|
|
|
194
195
|
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
195
196
|
this.#encoder = Opts.FallbackEncoder;
|
|
196
197
|
|
|
198
|
+
const customHeadersEnv = readEnv('SPITCH_CUSTOM_HEADERS');
|
|
199
|
+
if (customHeadersEnv) {
|
|
200
|
+
const parsed: Record<string, string> = {};
|
|
201
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
202
|
+
const colon = line.indexOf(':');
|
|
203
|
+
if (colon >= 0) {
|
|
204
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
208
|
+
}
|
|
209
|
+
|
|
197
210
|
this._options = options;
|
|
198
211
|
|
|
199
212
|
this.apiKey = apiKey;
|
|
@@ -224,7 +237,7 @@ export class Spitch {
|
|
|
224
237
|
* Check whether the base URL is set to its default.
|
|
225
238
|
*/
|
|
226
239
|
#baseURLOverridden(): boolean {
|
|
227
|
-
return this.baseURL !== 'https://api.
|
|
240
|
+
return this.baseURL !== 'https://api.spitch.app';
|
|
228
241
|
}
|
|
229
242
|
|
|
230
243
|
protected defaultQuery(): Record<string, string | undefined> | undefined {
|
|
@@ -707,11 +720,19 @@ export class Spitch {
|
|
|
707
720
|
return () => controller.abort();
|
|
708
721
|
}
|
|
709
722
|
|
|
710
|
-
private buildBody({ options
|
|
723
|
+
private buildBody({ options }: { options: FinalRequestOptions }): {
|
|
711
724
|
bodyHeaders: HeadersLike;
|
|
712
725
|
body: BodyInit | undefined;
|
|
713
726
|
} {
|
|
727
|
+
const { body, headers: rawHeaders } = options;
|
|
714
728
|
if (!body) {
|
|
729
|
+
// A resource method always passes a `body` key when its operation defines a
|
|
730
|
+
// request body, even if the caller omitted an optional body param. Keep the
|
|
731
|
+
// content-type for those, and only elide it for operations with no body at
|
|
732
|
+
// all (e.g. GET/DELETE).
|
|
733
|
+
if (body == null && 'body' in options) {
|
|
734
|
+
return this.#encoder({ body, headers: buildHeaders([rawHeaders]) });
|
|
735
|
+
}
|
|
715
736
|
return { bodyHeaders: undefined, body: undefined };
|
|
716
737
|
}
|
|
717
738
|
const headers = buildHeaders([rawHeaders]);
|
|
@@ -776,11 +797,13 @@ export class Spitch {
|
|
|
776
797
|
*/
|
|
777
798
|
speech: API.Speech = new API.Speech(this);
|
|
778
799
|
text: API.Text = new API.Text(this);
|
|
800
|
+
balance: API.Balance = new API.Balance(this);
|
|
779
801
|
files: API.Files = new API.Files(this);
|
|
780
802
|
}
|
|
781
803
|
|
|
782
804
|
Spitch.Speech = Speech;
|
|
783
805
|
Spitch.Text = Text;
|
|
806
|
+
Spitch.Balance = Balance;
|
|
784
807
|
Spitch.Files = Files;
|
|
785
808
|
|
|
786
809
|
export declare namespace Spitch {
|
|
@@ -806,6 +829,8 @@ export declare namespace Spitch {
|
|
|
806
829
|
};
|
|
807
830
|
|
|
808
831
|
export {
|
|
832
|
+
Balance as Balance,
|
|
833
|
+
type BalanceResponse as BalanceResponse,
|
|
809
834
|
Files as Files,
|
|
810
835
|
type FileMeta as FileMeta,
|
|
811
836
|
type FileUsage as FileUsage,
|
package/src/internal/types.ts
CHANGED
|
@@ -40,7 +40,6 @@ type OverloadedParameters<T> =
|
|
|
40
40
|
: T extends (...args: infer A) => unknown ? A
|
|
41
41
|
: never;
|
|
42
42
|
|
|
43
|
-
/* eslint-disable */
|
|
44
43
|
/**
|
|
45
44
|
* These imports attempt to get types from a parent package's dependencies.
|
|
46
45
|
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
|
|
@@ -63,19 +62,18 @@ type OverloadedParameters<T> =
|
|
|
63
62
|
*
|
|
64
63
|
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
|
|
65
64
|
*/
|
|
66
|
-
/** @ts-ignore For users with \@types/node */
|
|
65
|
+
/** @ts-ignore For users with \@types/node */ /* prettier-ignore */
|
|
67
66
|
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
|
|
68
|
-
/** @ts-ignore For users with undici */
|
|
67
|
+
/** @ts-ignore For users with undici */ /* prettier-ignore */
|
|
69
68
|
type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
|
|
70
|
-
/** @ts-ignore For users with \@types/bun */
|
|
69
|
+
/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
|
|
71
70
|
type BunRequestInit = globalThis.FetchRequestInit;
|
|
72
|
-
/** @ts-ignore For users with node-fetch@2 */
|
|
71
|
+
/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
|
|
73
72
|
type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
|
|
74
|
-
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
|
|
73
|
+
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
|
|
75
74
|
type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
76
|
-
/** @ts-ignore For users who use Deno */
|
|
75
|
+
/** @ts-ignore For users who use Deno */ /* prettier-ignore */
|
|
77
76
|
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
78
|
-
/* eslint-enable */
|
|
79
77
|
|
|
80
78
|
type RequestInits =
|
|
81
79
|
| NotAny<UndiciTypesRequestInit>
|
|
@@ -107,6 +107,8 @@ export const formatRequestDetails = (details: {
|
|
|
107
107
|
name,
|
|
108
108
|
(
|
|
109
109
|
name.toLowerCase() === 'authorization' ||
|
|
110
|
+
name.toLowerCase() === 'api-key' ||
|
|
111
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
110
112
|
name.toLowerCase() === 'cookie' ||
|
|
111
113
|
name.toLowerCase() === 'set-cookie'
|
|
112
114
|
) ?
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { APIResource } from '../core/resource';
|
|
2
|
+
import { APIPromise } from '../core/api-promise';
|
|
3
|
+
import { RequestOptions } from '../internal/request-options';
|
|
4
|
+
|
|
5
|
+
export class Balance extends APIResource {
|
|
6
|
+
/** Read the prepaid balance for the account that owns the API key. */
|
|
7
|
+
get(options?: RequestOptions): APIPromise<BalanceResponse> {
|
|
8
|
+
return this._client.get('/v1/balance', options);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface BalanceResponse {
|
|
13
|
+
/** Available prepaid credit as an exact decimal string. */
|
|
14
|
+
amount: string;
|
|
15
|
+
currency: 'USD';
|
|
16
|
+
}
|
package/src/resources/index.ts
CHANGED
package/src/resources/speech.ts
CHANGED
|
@@ -12,8 +12,7 @@ import { multipartFormRequestOptions } from '../internal/uploads';
|
|
|
12
12
|
*/
|
|
13
13
|
export class Speech extends APIResource {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* format. Audio is retured in chunks.
|
|
15
|
+
* Generate audio
|
|
17
16
|
*/
|
|
18
17
|
generate(body: SpeechGenerateParams, options?: RequestOptions): APIPromise<Response> {
|
|
19
18
|
return this._client.post('/v1/speech', {
|
|
@@ -64,28 +63,26 @@ export interface Transcription {
|
|
|
64
63
|
/**
|
|
65
64
|
* for audit purposes.
|
|
66
65
|
*/
|
|
67
|
-
request_id
|
|
68
|
-
|
|
69
|
-
text: string;
|
|
66
|
+
request_id?: string;
|
|
70
67
|
|
|
71
68
|
/**
|
|
72
|
-
* sentence-level or word-level groupings of your transcript. Each
|
|
73
|
-
* word) will fall within a time range.
|
|
69
|
+
* Either `sentence-level` or `word-level` groupings of your transcript. Each
|
|
70
|
+
* sentence (or word) will fall within a time range.
|
|
74
71
|
*/
|
|
75
72
|
segments?: Array<Segment> | null;
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
* @deprecated sentence-level or word-level groupings of your transcript. Each
|
|
79
|
-
* sentence (or word) will fall within a time range.
|
|
80
|
-
*/
|
|
81
|
-
timestamps?: Array<Segment> | null;
|
|
74
|
+
text?: string;
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
export interface SpeechGenerateParams {
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The text for which you want to generate audio.
|
|
80
|
+
*/
|
|
87
81
|
text: string;
|
|
88
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The voice you want to be used for audio generation.
|
|
85
|
+
*/
|
|
89
86
|
voice:
|
|
90
87
|
| 'sade'
|
|
91
88
|
| 'segun'
|
|
@@ -101,38 +98,60 @@ export interface SpeechGenerateParams {
|
|
|
101
98
|
| 'lucy'
|
|
102
99
|
| 'henry'
|
|
103
100
|
| 'kani'
|
|
101
|
+
| 'remi'
|
|
102
|
+
| 'kingsley'
|
|
104
103
|
| 'ngozi'
|
|
105
104
|
| 'amara'
|
|
106
105
|
| 'obinna'
|
|
107
106
|
| 'ebuka'
|
|
108
107
|
| 'hana'
|
|
109
|
-
| '
|
|
108
|
+
| 'haile'
|
|
110
109
|
| 'tena'
|
|
111
|
-
| 'tesfaye'
|
|
110
|
+
| 'tesfaye'
|
|
111
|
+
| 'ufoma'
|
|
112
|
+
| 'tega'
|
|
113
|
+
| 'justice'
|
|
114
|
+
| 'boma';
|
|
112
115
|
|
|
113
116
|
/**
|
|
114
|
-
*
|
|
117
|
+
* The audio format for the returned audio data, defaults to `wav`.
|
|
115
118
|
*/
|
|
116
119
|
format?: 'mp3' | 'wav' | 'ogg_opus' | 'webm_opus' | 'mulaw' | 'alaw' | 'flac' | 'pcm_s16le';
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
/**
|
|
122
|
+
* This is optional; an ISO 639 language code to be used for the generation.
|
|
123
|
+
*/
|
|
124
|
+
language?: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The speed of the voice, defaults to `1.0`
|
|
128
|
+
*/
|
|
129
|
+
speed?: number;
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
export interface SpeechTranscribeParams {
|
|
122
|
-
|
|
133
|
+
/**
|
|
134
|
+
* The audio file or content that you want to transcribe. This could be;
|
|
135
|
+
* `file bytes`, a `url to an audio file` (ensure the link does not require
|
|
136
|
+
* authentication to access the file) or a `file UUID`.
|
|
137
|
+
*/
|
|
138
|
+
content: Uploadable | string;
|
|
123
139
|
|
|
124
|
-
|
|
140
|
+
/**
|
|
141
|
+
* This is optional, an ISO-639 language code that corresponds to the language in
|
|
142
|
+
* the `content`.
|
|
143
|
+
*/
|
|
144
|
+
language?: string | null;
|
|
125
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated Select the model to be used to perform the transcription, this param
|
|
148
|
+
* has been deprecated.
|
|
149
|
+
*/
|
|
126
150
|
model?: 'mansa_v1' | 'legacy' | null;
|
|
127
151
|
|
|
128
152
|
special_words?: string | null;
|
|
129
153
|
|
|
130
|
-
timestamp?: 'sentence' | 'word' |
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated
|
|
134
|
-
*/
|
|
135
|
-
url?: string | null;
|
|
154
|
+
timestamp?: 'sentence' | 'word' | null;
|
|
136
155
|
}
|
|
137
156
|
|
|
138
157
|
export declare namespace Speech {
|
package/src/resources/text.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
|
|
7
7
|
export class Text extends APIResource {
|
|
8
8
|
/**
|
|
9
|
-
* Add
|
|
9
|
+
* Add appropriate tone marks to text.
|
|
10
10
|
*/
|
|
11
11
|
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics> {
|
|
12
12
|
return this._client.post('/v1/diacritics', { body, ...options });
|
|
@@ -34,17 +34,39 @@ export interface Translation {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface TextToneMarkParams {
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Only Yoruba is supported at the moment.
|
|
39
|
+
*/
|
|
40
|
+
language: string;
|
|
38
41
|
|
|
39
42
|
text: string;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export interface TextTranslateParams {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
/**
|
|
47
|
+
* An ISO 639 code of the language you want to translate to.
|
|
48
|
+
*/
|
|
49
|
+
target: string;
|
|
46
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The text to be translated.
|
|
53
|
+
*/
|
|
47
54
|
text: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether to be `formal` or `casual`.
|
|
58
|
+
*/
|
|
59
|
+
formality?: 'casual' | 'formal';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An ISO 639 code of the language you're translating from
|
|
63
|
+
*/
|
|
64
|
+
source?: string | null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The tone of the translated text.
|
|
68
|
+
*/
|
|
69
|
+
tone?: 'neutral' | 'warm' | 'professional' | 'narration';
|
|
48
70
|
}
|
|
49
71
|
|
|
50
72
|
export declare namespace Text {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.50.0';
|
package/uploads.d.mts
CHANGED
package/uploads.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,mCAA+B"}
|
package/uploads.d.ts
CHANGED
package/uploads.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,cAAc,gBAAgB,CAAC"}
|
package/uploads.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("./internal/tslib.js");
|
|
4
17
|
/** @deprecated Import from ./core/uploads instead */
|
|
5
|
-
|
|
18
|
+
__exportStar(require("./core/uploads"), exports);
|
|
6
19
|
//# sourceMappingURL=uploads.js.map
|
package/uploads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,iDAA+B"}
|
package/uploads.mjs
CHANGED
package/uploads.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,mCAA+B"}
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.50.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.50.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC"}
|
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.50.0';
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
|
package/internal/tslib.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.__setModuleDefault = exports.__createBinding = void 0;
|
|
4
|
-
exports.__classPrivateFieldSet = __classPrivateFieldSet;
|
|
5
|
-
exports.__classPrivateFieldGet = __classPrivateFieldGet;
|
|
6
|
-
exports.__importStar = __importStar;
|
|
7
|
-
exports.__exportStar = __exportStar;
|
|
8
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
9
|
-
if (kind === "m")
|
|
10
|
-
throw new TypeError("Private method is not writable");
|
|
11
|
-
if (kind === "a" && !f)
|
|
12
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
14
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
15
|
-
return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
|
|
16
|
-
}
|
|
17
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
18
|
-
if (kind === "a" && !f)
|
|
19
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
20
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
21
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
23
|
-
}
|
|
24
|
-
var __createBinding = Object.create
|
|
25
|
-
? function (o, m, k, k2) {
|
|
26
|
-
if (k2 === void 0)
|
|
27
|
-
k2 = k;
|
|
28
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
-
desc = {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return m[k];
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
Object.defineProperty(o, k2, desc);
|
|
38
|
-
}
|
|
39
|
-
: function (o, m, k, k2) {
|
|
40
|
-
if (k2 === void 0)
|
|
41
|
-
k2 = k;
|
|
42
|
-
o[k2] = m[k];
|
|
43
|
-
};
|
|
44
|
-
exports.__createBinding = __createBinding;
|
|
45
|
-
var __setModuleDefault = Object.create
|
|
46
|
-
? function (o, v) {
|
|
47
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
48
|
-
}
|
|
49
|
-
: function (o, v) {
|
|
50
|
-
o["default"] = v;
|
|
51
|
-
};
|
|
52
|
-
exports.__setModuleDefault = __setModuleDefault;
|
|
53
|
-
var ownKeys = function (o) {
|
|
54
|
-
ownKeys =
|
|
55
|
-
Object.getOwnPropertyNames ||
|
|
56
|
-
function (o2) {
|
|
57
|
-
var ar = [];
|
|
58
|
-
for (var k in o2)
|
|
59
|
-
if (Object.prototype.hasOwnProperty.call(o2, k))
|
|
60
|
-
ar[ar.length] = k;
|
|
61
|
-
return ar;
|
|
62
|
-
};
|
|
63
|
-
return ownKeys(o);
|
|
64
|
-
};
|
|
65
|
-
function __importStar(mod) {
|
|
66
|
-
if (mod && mod.__esModule)
|
|
67
|
-
return mod;
|
|
68
|
-
var result = {};
|
|
69
|
-
if (mod != null) {
|
|
70
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
71
|
-
if (k[i] !== "default")
|
|
72
|
-
__createBinding(result, mod, k[i]);
|
|
73
|
-
}
|
|
74
|
-
__setModuleDefault(result, mod);
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
function __exportStar(m, o) {
|
|
78
|
-
for (var p in m)
|
|
79
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
80
|
-
__createBinding(o, m, p);
|
|
81
|
-
}
|
package/internal/tslib.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m")
|
|
3
|
-
throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f)
|
|
5
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
6
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
7
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
8
|
-
return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
|
|
9
|
-
}
|
|
10
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
11
|
-
if (kind === "a" && !f)
|
|
12
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
14
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
15
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
16
|
-
}
|
|
17
|
-
export { __classPrivateFieldSet, __classPrivateFieldGet };
|