@mixedbread/sdk 0.56.0 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/client.d.mts +1 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +7 -6
- package/client.js.map +1 -1
- package/client.mjs +7 -6
- package/client.mjs.map +1 -1
- 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/lib/upload-file.d.mts +34 -0
- package/lib/upload-file.d.mts.map +1 -0
- package/lib/upload-file.d.ts +34 -0
- package/lib/upload-file.d.ts.map +1 -0
- package/lib/upload-file.js +146 -0
- package/lib/upload-file.js.map +1 -0
- package/lib/upload-file.mjs +141 -0
- package/lib/upload-file.mjs.map +1 -0
- package/package.json +12 -1
- package/resources/files/files.d.mts +156 -0
- package/resources/files/files.d.mts.map +1 -0
- package/resources/files/files.d.ts +156 -0
- package/resources/files/files.d.ts.map +1 -0
- package/resources/files/files.js +86 -0
- package/resources/files/files.js.map +1 -0
- package/resources/files/files.mjs +81 -0
- package/resources/files/files.mjs.map +1 -0
- package/resources/files/index.d.mts +3 -0
- package/resources/files/index.d.mts.map +1 -0
- package/resources/files/index.d.ts +3 -0
- package/resources/files/index.d.ts.map +1 -0
- package/resources/files/index.js +9 -0
- package/resources/files/index.js.map +1 -0
- package/resources/files/index.mjs +4 -0
- package/resources/files/index.mjs.map +1 -0
- package/resources/files/uploads.d.mts +169 -0
- package/resources/files/uploads.d.mts.map +1 -0
- package/resources/files/uploads.d.ts +169 -0
- package/resources/files/uploads.d.ts.map +1 -0
- package/resources/files/uploads.js +43 -0
- package/resources/files/uploads.js.map +1 -0
- package/resources/files/uploads.mjs +39 -0
- package/resources/files/uploads.mjs.map +1 -0
- package/resources/files.d.mts +1 -144
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +1 -144
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +2 -73
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +1 -71
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.js +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/stores/files.d.mts +9 -6
- package/resources/stores/files.d.mts.map +1 -1
- package/resources/stores/files.d.ts +9 -6
- package/resources/stores/files.d.ts.map +1 -1
- package/resources/stores/files.js +15 -4
- package/resources/stores/files.js.map +1 -1
- package/resources/stores/files.mjs +15 -4
- package/resources/stores/files.mjs.map +1 -1
- package/resources/stores/stores.d.mts +4 -4
- package/resources/stores/stores.d.mts.map +1 -1
- package/resources/stores/stores.d.ts +4 -4
- package/resources/stores/stores.d.ts.map +1 -1
- package/src/client.ts +16 -15
- package/src/index.ts +1 -0
- package/src/lib/upload-file.ts +233 -0
- package/src/resources/files/files.ts +239 -0
- package/src/resources/files/index.ts +23 -0
- package/src/resources/files/uploads.ts +229 -0
- package/src/resources/files.ts +1 -201
- package/src/resources/index.ts +1 -1
- package/src/resources/stores/files.ts +27 -6
- package/src/resources/stores/stores.ts +4 -4
- 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
package/resources/files.d.mts
CHANGED
|
@@ -1,145 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
-
import { Cursor, type CursorParams, 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
|
-
* Upload a new file.
|
|
9
|
-
*
|
|
10
|
-
* Args: file: The file to upload.
|
|
11
|
-
*
|
|
12
|
-
* Returns: FileResponse: The response containing the details of the uploaded file.
|
|
13
|
-
*/
|
|
14
|
-
create(body: FileCreateParams, options?: RequestOptions): APIPromise<FileObject>;
|
|
15
|
-
/**
|
|
16
|
-
* Retrieve details of a specific file by its ID.
|
|
17
|
-
*
|
|
18
|
-
* Args: file_id: The ID of the file to retrieve.
|
|
19
|
-
*
|
|
20
|
-
* Returns: FileResponse: The response containing the file details.
|
|
21
|
-
*/
|
|
22
|
-
retrieve(fileID: string, options?: RequestOptions): APIPromise<FileObject>;
|
|
23
|
-
/**
|
|
24
|
-
* Update the details of a specific file.
|
|
25
|
-
*
|
|
26
|
-
* Args: file_id: The ID of the file to update. file: The new details for the file.
|
|
27
|
-
*
|
|
28
|
-
* Returns: FileObject: The updated file details.
|
|
29
|
-
*/
|
|
30
|
-
update(fileID: string, body: FileUpdateParams, options?: RequestOptions): APIPromise<FileObject>;
|
|
31
|
-
/**
|
|
32
|
-
* List all files for the authenticated user.
|
|
33
|
-
*
|
|
34
|
-
* Args: pagination: The pagination options
|
|
35
|
-
*
|
|
36
|
-
* Returns: A list of files belonging to the user.
|
|
37
|
-
*/
|
|
38
|
-
list(query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FileObjectsCursor, FileObject>;
|
|
39
|
-
/**
|
|
40
|
-
* Delete a specific file by its ID.
|
|
41
|
-
*
|
|
42
|
-
* Args: file_id: The ID of the file to delete.
|
|
43
|
-
*
|
|
44
|
-
* Returns: FileDeleted: The response containing the details of the deleted file.
|
|
45
|
-
*/
|
|
46
|
-
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse>;
|
|
47
|
-
/**
|
|
48
|
-
* Download a specific file by its ID.
|
|
49
|
-
*
|
|
50
|
-
* Args: file_id: The ID of the file to download.
|
|
51
|
-
*
|
|
52
|
-
* Returns: FileStreamResponse: The response containing the file to be downloaded.
|
|
53
|
-
*/
|
|
54
|
-
content(fileID: string, options?: RequestOptions): APIPromise<Response>;
|
|
55
|
-
}
|
|
56
|
-
export type FileObjectsCursor = Cursor<FileObject>;
|
|
57
|
-
/**
|
|
58
|
-
* A model representing a file object in the system.
|
|
59
|
-
*
|
|
60
|
-
* This model contains metadata about files stored in the system, including
|
|
61
|
-
* identifiers, size information, and timestamps.
|
|
62
|
-
*/
|
|
63
|
-
export interface FileObject {
|
|
64
|
-
/**
|
|
65
|
-
* Unique identifier for the file
|
|
66
|
-
*/
|
|
67
|
-
id: string;
|
|
68
|
-
/**
|
|
69
|
-
* Name of the file including extension
|
|
70
|
-
*/
|
|
71
|
-
filename: string;
|
|
72
|
-
/**
|
|
73
|
-
* Size of the file in bytes
|
|
74
|
-
*/
|
|
75
|
-
bytes: number;
|
|
76
|
-
/**
|
|
77
|
-
* MIME type of the file
|
|
78
|
-
*/
|
|
79
|
-
mime_type: string;
|
|
80
|
-
/**
|
|
81
|
-
* Version of the file
|
|
82
|
-
*/
|
|
83
|
-
version: number;
|
|
84
|
-
/**
|
|
85
|
-
* Timestamp when the file was created
|
|
86
|
-
*/
|
|
87
|
-
created_at: string;
|
|
88
|
-
/**
|
|
89
|
-
* Timestamp when the file was last updated
|
|
90
|
-
*/
|
|
91
|
-
updated_at: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Pagination model that includes total count of items.
|
|
95
|
-
*/
|
|
96
|
-
export interface PaginationWithTotal {
|
|
97
|
-
/**
|
|
98
|
-
* Maximum number of items to return per page
|
|
99
|
-
*/
|
|
100
|
-
limit?: number;
|
|
101
|
-
/**
|
|
102
|
-
* Offset of the first item to return
|
|
103
|
-
*/
|
|
104
|
-
offset?: number;
|
|
105
|
-
/**
|
|
106
|
-
* Total number of items available
|
|
107
|
-
*/
|
|
108
|
-
total?: number;
|
|
109
|
-
}
|
|
110
|
-
export interface FileDeleteResponse {
|
|
111
|
-
/**
|
|
112
|
-
* The ID of the deleted file
|
|
113
|
-
*/
|
|
114
|
-
id: string;
|
|
115
|
-
/**
|
|
116
|
-
* Whether the file was deleted
|
|
117
|
-
*/
|
|
118
|
-
deleted?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* The type of the deleted object
|
|
121
|
-
*/
|
|
122
|
-
object?: 'file';
|
|
123
|
-
}
|
|
124
|
-
export interface FileCreateParams {
|
|
125
|
-
/**
|
|
126
|
-
* The file to upload
|
|
127
|
-
*/
|
|
128
|
-
file: Uploadable;
|
|
129
|
-
}
|
|
130
|
-
export interface FileUpdateParams {
|
|
131
|
-
/**
|
|
132
|
-
* The file to update
|
|
133
|
-
*/
|
|
134
|
-
file: Uploadable;
|
|
135
|
-
}
|
|
136
|
-
export interface FileListParams extends CursorParams {
|
|
137
|
-
/**
|
|
138
|
-
* Search query for fuzzy matching over name and description fields
|
|
139
|
-
*/
|
|
140
|
-
q?: string | null;
|
|
141
|
-
}
|
|
142
|
-
export declare namespace Files {
|
|
143
|
-
export { type FileObject as FileObject, type PaginationWithTotal as PaginationWithTotal, type FileDeleteResponse as FileDeleteResponse, type FileObjectsCursor as FileObjectsCursor, type FileCreateParams as FileCreateParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, };
|
|
144
|
-
}
|
|
1
|
+
export * from "./files/index.mjs";
|
|
145
2
|
//# sourceMappingURL=files.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":""}
|
package/resources/files.d.ts
CHANGED
|
@@ -1,145 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
-
import { Cursor, type CursorParams, 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
|
-
* Upload a new file.
|
|
9
|
-
*
|
|
10
|
-
* Args: file: The file to upload.
|
|
11
|
-
*
|
|
12
|
-
* Returns: FileResponse: The response containing the details of the uploaded file.
|
|
13
|
-
*/
|
|
14
|
-
create(body: FileCreateParams, options?: RequestOptions): APIPromise<FileObject>;
|
|
15
|
-
/**
|
|
16
|
-
* Retrieve details of a specific file by its ID.
|
|
17
|
-
*
|
|
18
|
-
* Args: file_id: The ID of the file to retrieve.
|
|
19
|
-
*
|
|
20
|
-
* Returns: FileResponse: The response containing the file details.
|
|
21
|
-
*/
|
|
22
|
-
retrieve(fileID: string, options?: RequestOptions): APIPromise<FileObject>;
|
|
23
|
-
/**
|
|
24
|
-
* Update the details of a specific file.
|
|
25
|
-
*
|
|
26
|
-
* Args: file_id: The ID of the file to update. file: The new details for the file.
|
|
27
|
-
*
|
|
28
|
-
* Returns: FileObject: The updated file details.
|
|
29
|
-
*/
|
|
30
|
-
update(fileID: string, body: FileUpdateParams, options?: RequestOptions): APIPromise<FileObject>;
|
|
31
|
-
/**
|
|
32
|
-
* List all files for the authenticated user.
|
|
33
|
-
*
|
|
34
|
-
* Args: pagination: The pagination options
|
|
35
|
-
*
|
|
36
|
-
* Returns: A list of files belonging to the user.
|
|
37
|
-
*/
|
|
38
|
-
list(query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FileObjectsCursor, FileObject>;
|
|
39
|
-
/**
|
|
40
|
-
* Delete a specific file by its ID.
|
|
41
|
-
*
|
|
42
|
-
* Args: file_id: The ID of the file to delete.
|
|
43
|
-
*
|
|
44
|
-
* Returns: FileDeleted: The response containing the details of the deleted file.
|
|
45
|
-
*/
|
|
46
|
-
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse>;
|
|
47
|
-
/**
|
|
48
|
-
* Download a specific file by its ID.
|
|
49
|
-
*
|
|
50
|
-
* Args: file_id: The ID of the file to download.
|
|
51
|
-
*
|
|
52
|
-
* Returns: FileStreamResponse: The response containing the file to be downloaded.
|
|
53
|
-
*/
|
|
54
|
-
content(fileID: string, options?: RequestOptions): APIPromise<Response>;
|
|
55
|
-
}
|
|
56
|
-
export type FileObjectsCursor = Cursor<FileObject>;
|
|
57
|
-
/**
|
|
58
|
-
* A model representing a file object in the system.
|
|
59
|
-
*
|
|
60
|
-
* This model contains metadata about files stored in the system, including
|
|
61
|
-
* identifiers, size information, and timestamps.
|
|
62
|
-
*/
|
|
63
|
-
export interface FileObject {
|
|
64
|
-
/**
|
|
65
|
-
* Unique identifier for the file
|
|
66
|
-
*/
|
|
67
|
-
id: string;
|
|
68
|
-
/**
|
|
69
|
-
* Name of the file including extension
|
|
70
|
-
*/
|
|
71
|
-
filename: string;
|
|
72
|
-
/**
|
|
73
|
-
* Size of the file in bytes
|
|
74
|
-
*/
|
|
75
|
-
bytes: number;
|
|
76
|
-
/**
|
|
77
|
-
* MIME type of the file
|
|
78
|
-
*/
|
|
79
|
-
mime_type: string;
|
|
80
|
-
/**
|
|
81
|
-
* Version of the file
|
|
82
|
-
*/
|
|
83
|
-
version: number;
|
|
84
|
-
/**
|
|
85
|
-
* Timestamp when the file was created
|
|
86
|
-
*/
|
|
87
|
-
created_at: string;
|
|
88
|
-
/**
|
|
89
|
-
* Timestamp when the file was last updated
|
|
90
|
-
*/
|
|
91
|
-
updated_at: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Pagination model that includes total count of items.
|
|
95
|
-
*/
|
|
96
|
-
export interface PaginationWithTotal {
|
|
97
|
-
/**
|
|
98
|
-
* Maximum number of items to return per page
|
|
99
|
-
*/
|
|
100
|
-
limit?: number;
|
|
101
|
-
/**
|
|
102
|
-
* Offset of the first item to return
|
|
103
|
-
*/
|
|
104
|
-
offset?: number;
|
|
105
|
-
/**
|
|
106
|
-
* Total number of items available
|
|
107
|
-
*/
|
|
108
|
-
total?: number;
|
|
109
|
-
}
|
|
110
|
-
export interface FileDeleteResponse {
|
|
111
|
-
/**
|
|
112
|
-
* The ID of the deleted file
|
|
113
|
-
*/
|
|
114
|
-
id: string;
|
|
115
|
-
/**
|
|
116
|
-
* Whether the file was deleted
|
|
117
|
-
*/
|
|
118
|
-
deleted?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* The type of the deleted object
|
|
121
|
-
*/
|
|
122
|
-
object?: 'file';
|
|
123
|
-
}
|
|
124
|
-
export interface FileCreateParams {
|
|
125
|
-
/**
|
|
126
|
-
* The file to upload
|
|
127
|
-
*/
|
|
128
|
-
file: Uploadable;
|
|
129
|
-
}
|
|
130
|
-
export interface FileUpdateParams {
|
|
131
|
-
/**
|
|
132
|
-
* The file to update
|
|
133
|
-
*/
|
|
134
|
-
file: Uploadable;
|
|
135
|
-
}
|
|
136
|
-
export interface FileListParams extends CursorParams {
|
|
137
|
-
/**
|
|
138
|
-
* Search query for fuzzy matching over name and description fields
|
|
139
|
-
*/
|
|
140
|
-
q?: string | null;
|
|
141
|
-
}
|
|
142
|
-
export declare namespace Files {
|
|
143
|
-
export { type FileObject as FileObject, type PaginationWithTotal as PaginationWithTotal, type FileDeleteResponse as FileDeleteResponse, type FileObjectsCursor as FileObjectsCursor, type FileCreateParams as FileCreateParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, };
|
|
144
|
-
}
|
|
1
|
+
export * from "./files/index.js";
|
|
145
2
|
//# sourceMappingURL=files.d.ts.map
|
package/resources/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":""}
|
package/resources/files.js
CHANGED
|
@@ -1,77 +1,6 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
const pagination_1 = require("../core/pagination.js");
|
|
7
|
-
const headers_1 = require("../internal/headers.js");
|
|
8
|
-
const uploads_1 = require("../internal/uploads.js");
|
|
9
|
-
const path_1 = require("../internal/utils/path.js");
|
|
10
|
-
class Files extends resource_1.APIResource {
|
|
11
|
-
/**
|
|
12
|
-
* Upload a new file.
|
|
13
|
-
*
|
|
14
|
-
* Args: file: The file to upload.
|
|
15
|
-
*
|
|
16
|
-
* Returns: FileResponse: The response containing the details of the uploaded file.
|
|
17
|
-
*/
|
|
18
|
-
create(body, options) {
|
|
19
|
-
return this._client.post('/v1/files', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Retrieve details of a specific file by its ID.
|
|
23
|
-
*
|
|
24
|
-
* Args: file_id: The ID of the file to retrieve.
|
|
25
|
-
*
|
|
26
|
-
* Returns: FileResponse: The response containing the file details.
|
|
27
|
-
*/
|
|
28
|
-
retrieve(fileID, options) {
|
|
29
|
-
return this._client.get((0, path_1.path) `/v1/files/${fileID}`, options);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Update the details of a specific file.
|
|
33
|
-
*
|
|
34
|
-
* Args: file_id: The ID of the file to update. file: The new details for the file.
|
|
35
|
-
*
|
|
36
|
-
* Returns: FileObject: The updated file details.
|
|
37
|
-
*/
|
|
38
|
-
update(fileID, body, options) {
|
|
39
|
-
return this._client.post((0, path_1.path) `/v1/files/${fileID}`, (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* List all files for the authenticated user.
|
|
43
|
-
*
|
|
44
|
-
* Args: pagination: The pagination options
|
|
45
|
-
*
|
|
46
|
-
* Returns: A list of files belonging to the user.
|
|
47
|
-
*/
|
|
48
|
-
list(query = {}, options) {
|
|
49
|
-
return this._client.getAPIList('/v1/files', (pagination_1.Cursor), { query, ...options });
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Delete a specific file by its ID.
|
|
53
|
-
*
|
|
54
|
-
* Args: file_id: The ID of the file to delete.
|
|
55
|
-
*
|
|
56
|
-
* Returns: FileDeleted: The response containing the details of the deleted file.
|
|
57
|
-
*/
|
|
58
|
-
delete(fileID, options) {
|
|
59
|
-
return this._client.delete((0, path_1.path) `/v1/files/${fileID}`, options);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Download a specific file by its ID.
|
|
63
|
-
*
|
|
64
|
-
* Args: file_id: The ID of the file to download.
|
|
65
|
-
*
|
|
66
|
-
* Returns: FileStreamResponse: The response containing the file to be downloaded.
|
|
67
|
-
*/
|
|
68
|
-
content(fileID, options) {
|
|
69
|
-
return this._client.get((0, path_1.path) `/v1/files/${fileID}/content`, {
|
|
70
|
-
...options,
|
|
71
|
-
headers: (0, headers_1.buildHeaders)([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
72
|
-
__binaryResponse: true,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.Files = Files;
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./files/index.js"), exports);
|
|
77
6
|
//# sourceMappingURL=files.js.map
|
package/resources/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAA8B"}
|
package/resources/files.mjs
CHANGED
|
@@ -1,73 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Cursor } from "../core/pagination.mjs";
|
|
4
|
-
import { buildHeaders } from "../internal/headers.mjs";
|
|
5
|
-
import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
6
|
-
import { path } from "../internal/utils/path.mjs";
|
|
7
|
-
export class Files extends APIResource {
|
|
8
|
-
/**
|
|
9
|
-
* Upload a new file.
|
|
10
|
-
*
|
|
11
|
-
* Args: file: The file to upload.
|
|
12
|
-
*
|
|
13
|
-
* Returns: FileResponse: The response containing the details of the uploaded file.
|
|
14
|
-
*/
|
|
15
|
-
create(body, options) {
|
|
16
|
-
return this._client.post('/v1/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Retrieve details of a specific file by its ID.
|
|
20
|
-
*
|
|
21
|
-
* Args: file_id: The ID of the file to retrieve.
|
|
22
|
-
*
|
|
23
|
-
* Returns: FileResponse: The response containing the file details.
|
|
24
|
-
*/
|
|
25
|
-
retrieve(fileID, options) {
|
|
26
|
-
return this._client.get(path `/v1/files/${fileID}`, options);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Update the details of a specific file.
|
|
30
|
-
*
|
|
31
|
-
* Args: file_id: The ID of the file to update. file: The new details for the file.
|
|
32
|
-
*
|
|
33
|
-
* Returns: FileObject: The updated file details.
|
|
34
|
-
*/
|
|
35
|
-
update(fileID, body, options) {
|
|
36
|
-
return this._client.post(path `/v1/files/${fileID}`, multipartFormRequestOptions({ body, ...options }, this._client));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* List all files for the authenticated user.
|
|
40
|
-
*
|
|
41
|
-
* Args: pagination: The pagination options
|
|
42
|
-
*
|
|
43
|
-
* Returns: A list of files belonging to the user.
|
|
44
|
-
*/
|
|
45
|
-
list(query = {}, options) {
|
|
46
|
-
return this._client.getAPIList('/v1/files', (Cursor), { query, ...options });
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Delete a specific file by its ID.
|
|
50
|
-
*
|
|
51
|
-
* Args: file_id: The ID of the file to delete.
|
|
52
|
-
*
|
|
53
|
-
* Returns: FileDeleted: The response containing the details of the deleted file.
|
|
54
|
-
*/
|
|
55
|
-
delete(fileID, options) {
|
|
56
|
-
return this._client.delete(path `/v1/files/${fileID}`, options);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Download a specific file by its ID.
|
|
60
|
-
*
|
|
61
|
-
* Args: file_id: The ID of the file to download.
|
|
62
|
-
*
|
|
63
|
-
* Returns: FileStreamResponse: The response containing the file to be downloaded.
|
|
64
|
-
*/
|
|
65
|
-
content(fileID, options) {
|
|
66
|
-
return this._client.get(path `/v1/files/${fileID}/content`, {
|
|
67
|
-
...options,
|
|
68
|
-
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
69
|
-
__binaryResponse: true,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
2
|
+
export * from "./files/index.mjs";
|
|
73
3
|
//# sourceMappingURL=files.mjs.map
|
package/resources/files.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/resources/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ export { Chat, type ChatCreateCompletionResponse } from "./chat.mjs";
|
|
|
4
4
|
export { DataSources, type DataSource, type DataSourceOauth2Params, type DataSourceType, type LinearDataSource, type NotionDataSource, type Oauth2Params, type DataSourceDeleteResponse, type DataSourceCreateParams, type DataSourceUpdateParams, type DataSourceListParams, type DataSourcesCursor, } from "./data-sources/data-sources.mjs";
|
|
5
5
|
export { Embeddings, type EncodingFormat, type EmbeddingCreateParams } from "./embeddings.mjs";
|
|
6
6
|
export { Extractions } from "./extractions/extractions.mjs";
|
|
7
|
-
export { Files, type FileObject, type PaginationWithTotal, type FileDeleteResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, type FileObjectsCursor, } from "./files.mjs";
|
|
7
|
+
export { Files, type FileObject, type PaginationWithTotal, type FileDeleteResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, type FileObjectsCursor, } from "./files/files.mjs";
|
|
8
8
|
export { Parsing } from "./parsing/parsing.mjs";
|
|
9
9
|
export { Stores, type ExpiresAfter, type ScoredAudioURLInputChunk, type ScoredImageURLInputChunk, type ScoredTextInputChunk, type ScoredVideoURLInputChunk, type Store, type StoreChunkSearchOptions, type StoreDeleteResponse, type StoreMetadataFacetsResponse, type StoreQuestionAnsweringResponse, type StoreSearchResponse, type StoreCreateParams, type StoreUpdateParams, type StoreListParams, type StoreMetadataFacetsParams, type StoreQuestionAnsweringParams, type StoreSearchParams, type StoresCursor, } from "./stores/stores.mjs";
|
|
10
10
|
export { type Embedding, type EmbeddingCreateResponse, type MultiEncodingEmbedding, type InfoResponse, type RerankResponse, type EmbedParams, type RerankParams, } from "./top-level.mjs";
|
package/resources/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Chat, type ChatCreateCompletionResponse } from "./chat.js";
|
|
|
4
4
|
export { DataSources, type DataSource, type DataSourceOauth2Params, type DataSourceType, type LinearDataSource, type NotionDataSource, type Oauth2Params, type DataSourceDeleteResponse, type DataSourceCreateParams, type DataSourceUpdateParams, type DataSourceListParams, type DataSourcesCursor, } from "./data-sources/data-sources.js";
|
|
5
5
|
export { Embeddings, type EncodingFormat, type EmbeddingCreateParams } from "./embeddings.js";
|
|
6
6
|
export { Extractions } from "./extractions/extractions.js";
|
|
7
|
-
export { Files, type FileObject, type PaginationWithTotal, type FileDeleteResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, type FileObjectsCursor, } from "./files.js";
|
|
7
|
+
export { Files, type FileObject, type PaginationWithTotal, type FileDeleteResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, type FileObjectsCursor, } from "./files/files.js";
|
|
8
8
|
export { Parsing } from "./parsing/parsing.js";
|
|
9
9
|
export { Stores, type ExpiresAfter, type ScoredAudioURLInputChunk, type ScoredImageURLInputChunk, type ScoredTextInputChunk, type ScoredVideoURLInputChunk, type Store, type StoreChunkSearchOptions, type StoreDeleteResponse, type StoreMetadataFacetsResponse, type StoreQuestionAnsweringResponse, type StoreSearchResponse, type StoreCreateParams, type StoreUpdateParams, type StoreListParams, type StoreMetadataFacetsParams, type StoreQuestionAnsweringParams, type StoreSearchParams, type StoresCursor, } from "./stores/stores.js";
|
|
10
10
|
export { type Embedding, type EmbeddingCreateResponse, type MultiEncodingEmbedding, type InfoResponse, type RerankResponse, type EmbedParams, type RerankParams, } from "./top-level.js";
|
package/resources/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var embeddings_1 = require("./embeddings.js");
|
|
|
14
14
|
Object.defineProperty(exports, "Embeddings", { enumerable: true, get: function () { return embeddings_1.Embeddings; } });
|
|
15
15
|
var extractions_1 = require("./extractions/extractions.js");
|
|
16
16
|
Object.defineProperty(exports, "Extractions", { enumerable: true, get: function () { return extractions_1.Extractions; } });
|
|
17
|
-
var files_1 = require("./files.js");
|
|
17
|
+
var files_1 = require("./files/files.js");
|
|
18
18
|
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
|
|
19
19
|
var parsing_1 = require("./parsing/parsing.js");
|
|
20
20
|
Object.defineProperty(exports, "Parsing", { enumerable: true, get: function () { return parsing_1.Parsing; } });
|
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,sDAAyB;AACzB,0CAQoB;AAPlB,mGAAA,OAAO,OAAA;AAQT,kCAAiE;AAAxD,4FAAA,IAAI,OAAA;AACb,+DAaqC;AAZnC,2GAAA,WAAW,OAAA;AAab,8CAA2F;AAAlF,wGAAA,UAAU,OAAA;AACnB,4DAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,0CAQoB;AAPlB,mGAAA,OAAO,OAAA;AAQT,kCAAiE;AAAxD,4FAAA,IAAI,OAAA;AACb,+DAaqC;AAZnC,2GAAA,WAAW,OAAA;AAab,8CAA2F;AAAlF,wGAAA,UAAU,OAAA;AACnB,4DAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,0CASuB;AARrB,8FAAA,KAAK,OAAA;AASP,gDAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,6CAoByB;AAnBvB,gGAAA,MAAM,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ export { Chat } from "./chat.mjs";
|
|
|
5
5
|
export { DataSources, } from "./data-sources/data-sources.mjs";
|
|
6
6
|
export { Embeddings } from "./embeddings.mjs";
|
|
7
7
|
export { Extractions } from "./extractions/extractions.mjs";
|
|
8
|
-
export { Files, } from "./files.mjs";
|
|
8
|
+
export { Files, } from "./files/files.mjs";
|
|
9
9
|
export { Parsing } from "./parsing/parsing.mjs";
|
|
10
10
|
export { Stores, } from "./stores/stores.mjs";
|
|
11
11
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -4,6 +4,7 @@ import * as ContentAPI from "../extractions/content.mjs";
|
|
|
4
4
|
import * as StoresAPI from "./stores.mjs";
|
|
5
5
|
import { APIPromise } from "../../core/api-promise.mjs";
|
|
6
6
|
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
7
|
+
import { type MultipartUploadConfig } from "../../lib/upload-file.mjs";
|
|
7
8
|
import { Uploadable } from "../../uploads.mjs";
|
|
8
9
|
export declare class Files extends APIResource {
|
|
9
10
|
/**
|
|
@@ -107,7 +108,7 @@ export declare class Files extends APIResource {
|
|
|
107
108
|
* @param params - Upload configuration when using named parameters
|
|
108
109
|
* @returns The created vector store file
|
|
109
110
|
*/
|
|
110
|
-
upload(storeIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, options?: RequestOptions): Promise<StoreFile>;
|
|
111
|
+
upload(storeIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, options?: RequestOptions, multipartUpload?: MultipartUploadConfig): Promise<StoreFile>;
|
|
111
112
|
upload(params: FileUploadHelperParams): Promise<StoreFile>;
|
|
112
113
|
/**
|
|
113
114
|
* Upload a file to files API, create a file in a vector store, and poll until processing is complete.
|
|
@@ -124,7 +125,7 @@ export declare class Files extends APIResource {
|
|
|
124
125
|
* @param params - Upload and poll configuration when using named parameters
|
|
125
126
|
* @returns The vector store file object once it reaches a terminal state
|
|
126
127
|
*/
|
|
127
|
-
uploadAndPoll(storeIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions): Promise<StoreFile>;
|
|
128
|
+
uploadAndPoll(storeIdentifier: string, file: Uploadable, body?: Omit<FileCreateParams, 'file_id'>, pollIntervalMs?: number, pollTimeoutMs?: number, options?: RequestOptions, multipartUpload?: MultipartUploadConfig): Promise<StoreFile>;
|
|
128
129
|
uploadAndPoll(params: FileUploadAndPollHelperParams): Promise<StoreFile>;
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
@@ -157,6 +158,7 @@ export interface FileUploadHelperParams {
|
|
|
157
158
|
file: Uploadable;
|
|
158
159
|
body?: Omit<FileCreateParams, 'file_id'> | undefined;
|
|
159
160
|
options?: RequestOptions | undefined;
|
|
161
|
+
multipartUpload?: MultipartUploadConfig | undefined;
|
|
160
162
|
}
|
|
161
163
|
/**
|
|
162
164
|
* Parameters for uploading and polling a store file.
|
|
@@ -169,6 +171,7 @@ export interface FileUploadAndPollHelperParams {
|
|
|
169
171
|
pollTimeoutMs?: number | undefined;
|
|
170
172
|
options?: RequestOptions | undefined;
|
|
171
173
|
returnChunks?: boolean | undefined;
|
|
174
|
+
multipartUpload?: MultipartUploadConfig | undefined;
|
|
172
175
|
}
|
|
173
176
|
/**
|
|
174
177
|
* Represents a scored store file.
|
|
@@ -419,7 +422,7 @@ export declare namespace StoreFile {
|
|
|
419
422
|
interface VideoChunkGeneratedMetadata {
|
|
420
423
|
type?: 'video';
|
|
421
424
|
file_type: string;
|
|
422
|
-
file_size
|
|
425
|
+
file_size?: number | null;
|
|
423
426
|
total_duration_seconds: number;
|
|
424
427
|
fps: number;
|
|
425
428
|
width: number;
|
|
@@ -544,7 +547,7 @@ export declare namespace StoreFile {
|
|
|
544
547
|
interface VideoChunkGeneratedMetadata {
|
|
545
548
|
type?: 'video';
|
|
546
549
|
file_type: string;
|
|
547
|
-
file_size
|
|
550
|
+
file_size?: number | null;
|
|
548
551
|
total_duration_seconds: number;
|
|
549
552
|
fps: number;
|
|
550
553
|
width: number;
|
|
@@ -686,7 +689,7 @@ export declare namespace StoreFile {
|
|
|
686
689
|
interface VideoChunkGeneratedMetadata {
|
|
687
690
|
type?: 'video';
|
|
688
691
|
file_type: string;
|
|
689
|
-
file_size
|
|
692
|
+
file_size?: number | null;
|
|
690
693
|
total_duration_seconds: number;
|
|
691
694
|
fps: number;
|
|
692
695
|
width: number;
|
|
@@ -820,7 +823,7 @@ export declare namespace StoreFile {
|
|
|
820
823
|
interface VideoChunkGeneratedMetadata {
|
|
821
824
|
type?: 'video';
|
|
822
825
|
file_type: string;
|
|
823
|
-
file_size
|
|
826
|
+
file_size?: number | null;
|
|
824
827
|
total_duration_seconds: number;
|
|
825
828
|
fps: number;
|
|
826
829
|
width: number;
|