spitch 1.20.0 → 1.22.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 +20 -23
- package/README.md +40 -7
- package/client.d.mts +13 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +13 -4
- package/client.d.ts.map +1 -1
- package/client.js +11 -2
- package/client.js.map +1 -1
- package/client.mjs +13 -4
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +54 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +54 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/utils/values.js +3 -3
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +3 -3
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +14 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/files.d.mts +74 -0
- package/resources/files.d.mts.map +1 -0
- package/resources/files.d.ts +74 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +48 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +44 -0
- package/resources/files.mjs.map +1 -0
- package/resources/index.d.mts +3 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/speech.d.mts +7 -6
- package/resources/speech.d.mts.map +1 -1
- package/resources/speech.d.ts +7 -6
- package/resources/speech.d.ts.map +1 -1
- package/resources/text.d.mts +5 -5
- package/resources/text.d.mts.map +1 -1
- package/resources/text.d.ts +5 -5
- package/resources/text.d.ts.map +1 -1
- package/src/client.ts +56 -17
- package/src/core/pagination.ts +157 -0
- package/src/index.ts +1 -0
- package/src/internal/to-file.ts +1 -1
- package/src/internal/utils/values.ts +3 -3
- package/src/pagination.ts +2 -0
- package/src/resources/files.ts +136 -0
- package/src/resources/index.ts +13 -7
- package/src/resources/speech.ts +8 -6
- package/src/resources/text.ts +6 -6
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { FilesCursor, type FilesCursorParams, PagePromise } from "../core/pagination.mjs";
|
|
4
|
+
import { type Uploadable } from "../core/uploads.mjs";
|
|
5
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
6
|
+
export declare class Files extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Get Files
|
|
9
|
+
*/
|
|
10
|
+
list(query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FilesFilesCursor, File>;
|
|
11
|
+
/**
|
|
12
|
+
* Delete File
|
|
13
|
+
*/
|
|
14
|
+
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Download File
|
|
17
|
+
*/
|
|
18
|
+
download(fileID: string, query?: FileDownloadParams | null | undefined, options?: RequestOptions): APIPromise<FileDownloadResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Get File
|
|
21
|
+
*/
|
|
22
|
+
get(fileID: string, options?: RequestOptions): APIPromise<File>;
|
|
23
|
+
/**
|
|
24
|
+
* Upload File
|
|
25
|
+
*/
|
|
26
|
+
upload(body: FileUploadParams, options?: RequestOptions): APIPromise<File>;
|
|
27
|
+
/**
|
|
28
|
+
* Get Usage
|
|
29
|
+
*/
|
|
30
|
+
usage(options?: RequestOptions): APIPromise<FileUsage>;
|
|
31
|
+
}
|
|
32
|
+
export type FilesFilesCursor = FilesCursor<File>;
|
|
33
|
+
export interface File {
|
|
34
|
+
category: string | null;
|
|
35
|
+
content_type: string | null;
|
|
36
|
+
created_at: string;
|
|
37
|
+
file_id: string;
|
|
38
|
+
original_name: string | null;
|
|
39
|
+
size_bytes: number | null;
|
|
40
|
+
status: string;
|
|
41
|
+
uploaded_by: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface FileUsage {
|
|
44
|
+
num_files: number;
|
|
45
|
+
total: string;
|
|
46
|
+
total_bytes: number;
|
|
47
|
+
used: string;
|
|
48
|
+
used_bytes: number;
|
|
49
|
+
}
|
|
50
|
+
export interface Files {
|
|
51
|
+
items: Array<File>;
|
|
52
|
+
next_cursor?: string | null;
|
|
53
|
+
}
|
|
54
|
+
export interface FileDeleteResponse {
|
|
55
|
+
status?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface FileDownloadResponse {
|
|
58
|
+
expires_at: string;
|
|
59
|
+
file_id: string;
|
|
60
|
+
url: string;
|
|
61
|
+
}
|
|
62
|
+
export interface FileListParams extends FilesCursorParams {
|
|
63
|
+
status?: 'uploading' | 'ready' | null;
|
|
64
|
+
}
|
|
65
|
+
export interface FileDownloadParams {
|
|
66
|
+
ttl?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface FileUploadParams {
|
|
69
|
+
file: Uploadable;
|
|
70
|
+
}
|
|
71
|
+
export declare namespace Files {
|
|
72
|
+
export { type File as File, type FileUsage as FileUsage, type Files as Files, type FileDeleteResponse as FileDeleteResponse, type FileDownloadResponse as FileDownloadResponse, type FilesFilesCursor as FilesFilesCursor, type FileListParams as FileListParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=files.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,EAAE,KAAK,UAAU,EAAE;OACnB,EAAE,cAAc,EAAE;AAIzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,IAAI,CACF,KAAK,GAAE,cAAc,GAAG,IAAI,GAAG,SAAc,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC;IAItC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAIhF;;OAEG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,kBAAkB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAInC;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAI/D;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAI1E;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;CAGvD;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,IAAI,C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,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { FilesCursor, type FilesCursorParams, PagePromise } from "../core/pagination.js";
|
|
4
|
+
import { type Uploadable } from "../core/uploads.js";
|
|
5
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
6
|
+
export declare class Files extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Get Files
|
|
9
|
+
*/
|
|
10
|
+
list(query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FilesFilesCursor, File>;
|
|
11
|
+
/**
|
|
12
|
+
* Delete File
|
|
13
|
+
*/
|
|
14
|
+
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Download File
|
|
17
|
+
*/
|
|
18
|
+
download(fileID: string, query?: FileDownloadParams | null | undefined, options?: RequestOptions): APIPromise<FileDownloadResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Get File
|
|
21
|
+
*/
|
|
22
|
+
get(fileID: string, options?: RequestOptions): APIPromise<File>;
|
|
23
|
+
/**
|
|
24
|
+
* Upload File
|
|
25
|
+
*/
|
|
26
|
+
upload(body: FileUploadParams, options?: RequestOptions): APIPromise<File>;
|
|
27
|
+
/**
|
|
28
|
+
* Get Usage
|
|
29
|
+
*/
|
|
30
|
+
usage(options?: RequestOptions): APIPromise<FileUsage>;
|
|
31
|
+
}
|
|
32
|
+
export type FilesFilesCursor = FilesCursor<File>;
|
|
33
|
+
export interface File {
|
|
34
|
+
category: string | null;
|
|
35
|
+
content_type: string | null;
|
|
36
|
+
created_at: string;
|
|
37
|
+
file_id: string;
|
|
38
|
+
original_name: string | null;
|
|
39
|
+
size_bytes: number | null;
|
|
40
|
+
status: string;
|
|
41
|
+
uploaded_by: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface FileUsage {
|
|
44
|
+
num_files: number;
|
|
45
|
+
total: string;
|
|
46
|
+
total_bytes: number;
|
|
47
|
+
used: string;
|
|
48
|
+
used_bytes: number;
|
|
49
|
+
}
|
|
50
|
+
export interface Files {
|
|
51
|
+
items: Array<File>;
|
|
52
|
+
next_cursor?: string | null;
|
|
53
|
+
}
|
|
54
|
+
export interface FileDeleteResponse {
|
|
55
|
+
status?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface FileDownloadResponse {
|
|
58
|
+
expires_at: string;
|
|
59
|
+
file_id: string;
|
|
60
|
+
url: string;
|
|
61
|
+
}
|
|
62
|
+
export interface FileListParams extends FilesCursorParams {
|
|
63
|
+
status?: 'uploading' | 'ready' | null;
|
|
64
|
+
}
|
|
65
|
+
export interface FileDownloadParams {
|
|
66
|
+
ttl?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface FileUploadParams {
|
|
69
|
+
file: Uploadable;
|
|
70
|
+
}
|
|
71
|
+
export declare namespace Files {
|
|
72
|
+
export { type File as File, type FileUsage as FileUsage, type Files as Files, type FileDeleteResponse as FileDeleteResponse, type FileDownloadResponse as FileDownloadResponse, type FilesFilesCursor as FilesFilesCursor, type FileListParams as FileListParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,E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AAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IAEnB,OAAO,EAAE,MAAM,CAAC;IAEhB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,IAAI,IAAI,IAAI,EACjB,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Files = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../core/pagination.js");
|
|
7
|
+
const uploads_1 = require("../internal/uploads.js");
|
|
8
|
+
const path_1 = require("../internal/utils/path.js");
|
|
9
|
+
class Files extends resource_1.APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Get Files
|
|
12
|
+
*/
|
|
13
|
+
list(query = {}, options) {
|
|
14
|
+
return this._client.getAPIList('/v1/files', (pagination_1.FilesCursor), { query, ...options });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Delete File
|
|
18
|
+
*/
|
|
19
|
+
delete(fileID, options) {
|
|
20
|
+
return this._client.delete((0, path_1.path) `/v1/files/${fileID}`, options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Download File
|
|
24
|
+
*/
|
|
25
|
+
download(fileID, query = {}, options) {
|
|
26
|
+
return this._client.get((0, path_1.path) `/v1/files/${fileID}/url`, { query, ...options });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get File
|
|
30
|
+
*/
|
|
31
|
+
get(fileID, options) {
|
|
32
|
+
return this._client.get((0, path_1.path) `/v1/files/${fileID}`, options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Upload File
|
|
36
|
+
*/
|
|
37
|
+
upload(body, options) {
|
|
38
|
+
return this._client.post('/v1/files', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get Usage
|
|
42
|
+
*/
|
|
43
|
+
usage(options) {
|
|
44
|
+
return this._client.get('/v1/files:usage', options);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Files = Files;
|
|
48
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,sF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C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { FilesCursor } from "../core/pagination.mjs";
|
|
4
|
+
import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
5
|
+
import { path } from "../internal/utils/path.mjs";
|
|
6
|
+
export class Files extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Get Files
|
|
9
|
+
*/
|
|
10
|
+
list(query = {}, options) {
|
|
11
|
+
return this._client.getAPIList('/v1/files', (FilesCursor), { query, ...options });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Delete File
|
|
15
|
+
*/
|
|
16
|
+
delete(fileID, options) {
|
|
17
|
+
return this._client.delete(path `/v1/files/${fileID}`, options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Download File
|
|
21
|
+
*/
|
|
22
|
+
download(fileID, query = {}, options) {
|
|
23
|
+
return this._client.get(path `/v1/files/${fileID}/url`, { query, ...options });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get File
|
|
27
|
+
*/
|
|
28
|
+
get(fileID, options) {
|
|
29
|
+
return this._client.get(path `/v1/files/${fileID}`, options);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Upload File
|
|
33
|
+
*/
|
|
34
|
+
upload(body, options) {
|
|
35
|
+
return this._client.post('/v1/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get Usage
|
|
39
|
+
*/
|
|
40
|
+
usage(options) {
|
|
41
|
+
return this._client.get('/v1/files:usage', options);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=files.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"m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;IACtD,CAAC;CACF"}
|
package/resources/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { Files, type File, type FileUsage, type FileDeleteResponse, type FileDownloadResponse, type FileListParams, type FileDownloadParams, type FileUploadParams, type FilesFilesCursor, } from "./files.mjs";
|
|
2
|
+
export { Speech, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams } from "./speech.mjs";
|
|
3
|
+
export { Text, type Diacritics, type Translation, type TextToneMarkParams, type TextTranslateParams, } from "./text.mjs";
|
|
3
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB;OACM,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,sBAAsB,EAAE;OACtF,EACL,IAAI,EACJ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { Files, type File, type FileUsage, type FileDeleteResponse, type FileDownloadResponse, type FileListParams, type FileDownloadParams, type FileUploadParams, type FilesFilesCursor, } from "./files.js";
|
|
2
|
+
export { Speech, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams } from "./speech.js";
|
|
3
|
+
export { Text, type Diacritics, type Translation, type TextToneMarkParams, type TextTranslateParams, } from "./text.js";
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB;OACM,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,sBAAsB,EAAE;OACtF,EACL,IAAI,EACJ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB"}
|
package/resources/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Text = exports.Speech = void 0;
|
|
4
|
+
exports.Text = exports.Speech = exports.Files = void 0;
|
|
5
|
+
var files_1 = require("./files.js");
|
|
6
|
+
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
|
|
5
7
|
var speech_1 = require("./speech.js");
|
|
6
8
|
Object.defineProperty(exports, "Speech", { enumerable: true, get: function () { return speech_1.Speech; } });
|
|
7
9
|
var text_1 = require("./text.js");
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAUiB;AATf,8FAAA,KAAK,OAAA;AAUP,sCAA8G;AAArG,gGAAA,MAAM,OAAA;AACf,kCAMgB;AALd,4FAAA,IAAI,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
export {
|
|
2
|
+
export { Files, } from "./files.mjs";
|
|
3
|
+
export { Speech } from "./speech.mjs";
|
|
3
4
|
export { Text, } from "./text.mjs";
|
|
4
5
|
//# sourceMappingURL=index.mjs.map
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,KAAK,GASN;OACM,EAAE,MAAM,EAA8E;OACtF,EACL,IAAI,GAKL"}
|
package/resources/speech.d.mts
CHANGED
|
@@ -10,14 +10,14 @@ export declare class Speech extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Transcribe
|
|
12
12
|
*/
|
|
13
|
-
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<
|
|
13
|
+
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<Transcription>;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface Transcription {
|
|
16
16
|
request_id: string;
|
|
17
17
|
text: string;
|
|
18
|
-
timestamps?: Array<
|
|
18
|
+
timestamps?: Array<Transcription.Timestamp> | null;
|
|
19
19
|
}
|
|
20
|
-
export declare namespace
|
|
20
|
+
export declare namespace Transcription {
|
|
21
21
|
interface Timestamp {
|
|
22
22
|
end: number;
|
|
23
23
|
start: number;
|
|
@@ -28,17 +28,18 @@ export interface SpeechGenerateParams {
|
|
|
28
28
|
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
29
29
|
text: string;
|
|
30
30
|
voice: 'sade' | 'segun' | 'femi' | 'funmi' | 'amina' | 'aliyu' | 'hasan' | 'zainab' | 'john' | 'jude' | 'lina' | 'lucy' | 'henry' | 'kani' | 'ngozi' | 'amara' | 'obinna' | 'ebuka' | 'hana' | 'selam' | 'tena' | 'tesfaye';
|
|
31
|
+
format?: 'wav' | 'mp3' | 'ogg_opus' | 'webm_opus' | 'flac' | 'pcm_s16le' | 'mulaw' | 'alaw';
|
|
31
32
|
model?: 'legacy' | null;
|
|
32
33
|
}
|
|
33
34
|
export interface SpeechTranscribeParams {
|
|
34
35
|
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
35
36
|
content?: Uploadable | null;
|
|
36
|
-
model?: 'mansa_v1' | 'legacy' | null;
|
|
37
|
+
model?: 'mansa_v1' | 'legacy' | 'human' | null;
|
|
37
38
|
special_words?: string | null;
|
|
38
39
|
timestamp?: 'sentence' | 'word' | 'none' | null;
|
|
39
40
|
url?: string | null;
|
|
40
41
|
}
|
|
41
42
|
export declare namespace Speech {
|
|
42
|
-
export { type
|
|
43
|
+
export { type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=speech.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.d.mts","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAo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AO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,CAAC;IAEd,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IAE5F,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3C,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAE5B,KAAK,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;IAE/C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEhD,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/speech.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export declare class Speech extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Transcribe
|
|
12
12
|
*/
|
|
13
|
-
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<
|
|
13
|
+
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<Transcription>;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface Transcription {
|
|
16
16
|
request_id: string;
|
|
17
17
|
text: string;
|
|
18
|
-
timestamps?: Array<
|
|
18
|
+
timestamps?: Array<Transcription.Timestamp> | null;
|
|
19
19
|
}
|
|
20
|
-
export declare namespace
|
|
20
|
+
export declare namespace Transcription {
|
|
21
21
|
interface Timestamp {
|
|
22
22
|
end: number;
|
|
23
23
|
start: number;
|
|
@@ -28,17 +28,18 @@ export interface SpeechGenerateParams {
|
|
|
28
28
|
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
29
29
|
text: string;
|
|
30
30
|
voice: 'sade' | 'segun' | 'femi' | 'funmi' | 'amina' | 'aliyu' | 'hasan' | 'zainab' | 'john' | 'jude' | 'lina' | 'lucy' | 'henry' | 'kani' | 'ngozi' | 'amara' | 'obinna' | 'ebuka' | 'hana' | 'selam' | 'tena' | 'tesfaye';
|
|
31
|
+
format?: 'wav' | 'mp3' | 'ogg_opus' | 'webm_opus' | 'flac' | 'pcm_s16le' | 'mulaw' | 'alaw';
|
|
31
32
|
model?: 'legacy' | null;
|
|
32
33
|
}
|
|
33
34
|
export interface SpeechTranscribeParams {
|
|
34
35
|
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
35
36
|
content?: Uploadable | null;
|
|
36
|
-
model?: 'mansa_v1' | 'legacy' | null;
|
|
37
|
+
model?: 'mansa_v1' | 'legacy' | 'human' | null;
|
|
37
38
|
special_words?: string | null;
|
|
38
39
|
timestamp?: 'sentence' | 'word' | 'none' | null;
|
|
39
40
|
url?: string | null;
|
|
40
41
|
}
|
|
41
42
|
export declare namespace Speech {
|
|
42
|
-
export { type
|
|
43
|
+
export { type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=speech.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,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AAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,CAAC;IAEd,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IAE5F,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3C,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAE5B,KAAK,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;IAE/C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEhD,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/text.d.mts
CHANGED
|
@@ -5,17 +5,17 @@ export declare class Text extends APIResource {
|
|
|
5
5
|
/**
|
|
6
6
|
* Tone Mark
|
|
7
7
|
*/
|
|
8
|
-
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<
|
|
8
|
+
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics>;
|
|
9
9
|
/**
|
|
10
10
|
* Translate
|
|
11
11
|
*/
|
|
12
|
-
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<
|
|
12
|
+
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation>;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface Diacritics {
|
|
15
15
|
request_id: string;
|
|
16
16
|
text: string;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface Translation {
|
|
19
19
|
request_id: string;
|
|
20
20
|
text: string;
|
|
21
21
|
}
|
|
@@ -29,6 +29,6 @@ export interface TextTranslateParams {
|
|
|
29
29
|
text: string;
|
|
30
30
|
}
|
|
31
31
|
export declare namespace Text {
|
|
32
|
-
export { type
|
|
32
|
+
export { type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=text.d.mts.map
|
package/resources/text.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.mts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"text.d.mts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAGxF;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/text.d.ts
CHANGED
|
@@ -5,17 +5,17 @@ export declare class Text extends APIResource {
|
|
|
5
5
|
/**
|
|
6
6
|
* Tone Mark
|
|
7
7
|
*/
|
|
8
|
-
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<
|
|
8
|
+
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics>;
|
|
9
9
|
/**
|
|
10
10
|
* Translate
|
|
11
11
|
*/
|
|
12
|
-
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<
|
|
12
|
+
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation>;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface Diacritics {
|
|
15
15
|
request_id: string;
|
|
16
16
|
text: string;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface Translation {
|
|
19
19
|
request_id: string;
|
|
20
20
|
text: string;
|
|
21
21
|
}
|
|
@@ -29,6 +29,6 @@ export interface TextTranslateParams {
|
|
|
29
29
|
text: string;
|
|
30
30
|
}
|
|
31
31
|
export declare namespace Text {
|
|
32
|
-
export { type
|
|
32
|
+
export { type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=text.d.ts.map
|
package/resources/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAGxF;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/src/client.ts
CHANGED
|
@@ -13,22 +13,24 @@ import * as Shims from './internal/shims';
|
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
14
|
import { VERSION } from './version';
|
|
15
15
|
import * as Errors from './core/error';
|
|
16
|
+
import * as Pagination from './core/pagination';
|
|
17
|
+
import { AbstractPage, type FilesCursorParams, FilesCursorResponse } from './core/pagination';
|
|
16
18
|
import * as Uploads from './core/uploads';
|
|
17
19
|
import * as API from './resources/index';
|
|
18
20
|
import { APIPromise } from './core/api-promise';
|
|
19
21
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from './resources/text';
|
|
22
|
+
File,
|
|
23
|
+
FileDeleteResponse,
|
|
24
|
+
FileDownloadParams,
|
|
25
|
+
FileDownloadResponse,
|
|
26
|
+
FileListParams,
|
|
27
|
+
FileUploadParams,
|
|
28
|
+
FileUsage,
|
|
29
|
+
Files,
|
|
30
|
+
FilesFilesCursor,
|
|
31
|
+
} from './resources/files';
|
|
32
|
+
import { Speech, SpeechGenerateParams, SpeechTranscribeParams, Transcription } from './resources/speech';
|
|
33
|
+
import { Diacritics, Text, TextToneMarkParams, TextTranslateParams, Translation } from './resources/text';
|
|
32
34
|
import { type Fetch } from './internal/builtin-types';
|
|
33
35
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
34
36
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -380,7 +382,7 @@ export class Spitch {
|
|
|
380
382
|
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
381
383
|
const headersTime = Date.now();
|
|
382
384
|
|
|
383
|
-
if (response instanceof Error) {
|
|
385
|
+
if (response instanceof globalThis.Error) {
|
|
384
386
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
385
387
|
if (options.signal?.aborted) {
|
|
386
388
|
throw new Errors.APIUserAbortError();
|
|
@@ -494,6 +496,25 @@ export class Spitch {
|
|
|
494
496
|
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
|
|
495
497
|
}
|
|
496
498
|
|
|
499
|
+
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
500
|
+
path: string,
|
|
501
|
+
Page: new (...args: any[]) => PageClass,
|
|
502
|
+
opts?: RequestOptions,
|
|
503
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
504
|
+
return this.requestAPIList(Page, { method: 'get', path, ...opts });
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
requestAPIList<
|
|
508
|
+
Item = unknown,
|
|
509
|
+
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
510
|
+
>(
|
|
511
|
+
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
512
|
+
options: FinalRequestOptions,
|
|
513
|
+
): Pagination.PagePromise<PageClass, Item> {
|
|
514
|
+
const request = this.makeRequest(options, null, undefined);
|
|
515
|
+
return new Pagination.PagePromise<PageClass, Item>(this as any as Spitch, request, Page);
|
|
516
|
+
}
|
|
517
|
+
|
|
497
518
|
async fetchWithTimeout(
|
|
498
519
|
url: RequestInfo,
|
|
499
520
|
init: RequestInit | undefined,
|
|
@@ -687,7 +708,7 @@ export class Spitch {
|
|
|
687
708
|
// Preserve legacy string encoding behavior for now
|
|
688
709
|
headers.values.has('content-type')) ||
|
|
689
710
|
// `Blob` is superset of `File`
|
|
690
|
-
body instanceof Blob ||
|
|
711
|
+
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
|
|
691
712
|
// `FormData` -> `multipart/form-data`
|
|
692
713
|
body instanceof FormData ||
|
|
693
714
|
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
@@ -728,24 +749,42 @@ export class Spitch {
|
|
|
728
749
|
|
|
729
750
|
speech: API.Speech = new API.Speech(this);
|
|
730
751
|
text: API.Text = new API.Text(this);
|
|
752
|
+
files: API.Files = new API.Files(this);
|
|
731
753
|
}
|
|
754
|
+
|
|
732
755
|
Spitch.Speech = Speech;
|
|
733
756
|
Spitch.Text = Text;
|
|
757
|
+
|
|
734
758
|
export declare namespace Spitch {
|
|
735
759
|
export type RequestOptions = Opts.RequestOptions;
|
|
736
760
|
|
|
761
|
+
export import FilesCursor = Pagination.FilesCursor;
|
|
762
|
+
export { type FilesCursorParams as FilesCursorParams, type FilesCursorResponse as FilesCursorResponse };
|
|
763
|
+
|
|
737
764
|
export {
|
|
738
765
|
Speech as Speech,
|
|
739
|
-
type
|
|
766
|
+
type Transcription as Transcription,
|
|
740
767
|
type SpeechGenerateParams as SpeechGenerateParams,
|
|
741
768
|
type SpeechTranscribeParams as SpeechTranscribeParams,
|
|
742
769
|
};
|
|
743
770
|
|
|
744
771
|
export {
|
|
745
772
|
Text as Text,
|
|
746
|
-
type
|
|
747
|
-
type
|
|
773
|
+
type Diacritics as Diacritics,
|
|
774
|
+
type Translation as Translation,
|
|
748
775
|
type TextToneMarkParams as TextToneMarkParams,
|
|
749
776
|
type TextTranslateParams as TextTranslateParams,
|
|
750
777
|
};
|
|
778
|
+
|
|
779
|
+
export {
|
|
780
|
+
type Files as Files,
|
|
781
|
+
type File as File,
|
|
782
|
+
type FileUsage as FileUsage,
|
|
783
|
+
type FileDeleteResponse as FileDeleteResponse,
|
|
784
|
+
type FileDownloadResponse as FileDownloadResponse,
|
|
785
|
+
type FilesFilesCursor as FilesFilesCursor,
|
|
786
|
+
type FileListParams as FileListParams,
|
|
787
|
+
type FileDownloadParams as FileDownloadParams,
|
|
788
|
+
type FileUploadParams as FileUploadParams,
|
|
789
|
+
};
|
|
751
790
|
}
|