@mixedbread/sdk 0.55.0 → 0.57.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 +35 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js +3 -3
- package/client.js.map +1 -1
- package/client.mjs +3 -3
- 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/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- 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 +1 -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 +10 -7
- package/resources/stores/files.d.mts.map +1 -1
- package/resources/stores/files.d.ts +10 -7
- 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 +15 -15
- package/src/index.ts +1 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.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 +28 -7
- 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
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import * as FilesAPI from "./files.js";
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
5
|
+
export declare class Uploads extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Initiate a multipart upload and receive presigned URLs for uploading parts
|
|
8
|
+
* directly to storage.
|
|
9
|
+
*/
|
|
10
|
+
create(body: UploadCreateParams, options?: RequestOptions): APIPromise<UploadCreateResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Get a multipart upload's details with fresh presigned URLs for any parts not yet
|
|
13
|
+
* uploaded.
|
|
14
|
+
*/
|
|
15
|
+
retrieve(uploadID: string, options?: RequestOptions): APIPromise<UploadRetrieveResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* List all in-progress multipart uploads for the authenticated organization.
|
|
18
|
+
*/
|
|
19
|
+
list(options?: RequestOptions): APIPromise<UploadListResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Abort a multipart upload and clean up any uploaded parts.
|
|
22
|
+
*/
|
|
23
|
+
abort(uploadID: string, options?: RequestOptions): APIPromise<UploadAbortResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Complete a multipart upload after all parts have been uploaded. Creates the file
|
|
26
|
+
* object and returns it.
|
|
27
|
+
*/
|
|
28
|
+
complete(uploadID: string, body: UploadCompleteParams, options?: RequestOptions): APIPromise<FilesAPI.FileObject>;
|
|
29
|
+
}
|
|
30
|
+
export interface MultipartUploadPart {
|
|
31
|
+
/**
|
|
32
|
+
* 1-based part number
|
|
33
|
+
*/
|
|
34
|
+
part_number: number;
|
|
35
|
+
/**
|
|
36
|
+
* ETag returned by the storage backend after uploading the part
|
|
37
|
+
*/
|
|
38
|
+
etag: string;
|
|
39
|
+
}
|
|
40
|
+
export interface MultipartUploadPartURL {
|
|
41
|
+
/**
|
|
42
|
+
* 1-based part number
|
|
43
|
+
*/
|
|
44
|
+
part_number: number;
|
|
45
|
+
/**
|
|
46
|
+
* Presigned URL for uploading this part
|
|
47
|
+
*/
|
|
48
|
+
url: string;
|
|
49
|
+
}
|
|
50
|
+
export interface UploadCreateResponse {
|
|
51
|
+
/**
|
|
52
|
+
* The multipart upload ID (use this to complete or abort)
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
/**
|
|
56
|
+
* Presigned URLs for uploading parts
|
|
57
|
+
*/
|
|
58
|
+
part_urls: Array<MultipartUploadPartURL>;
|
|
59
|
+
}
|
|
60
|
+
export interface UploadRetrieveResponse {
|
|
61
|
+
/**
|
|
62
|
+
* The multipart upload record ID
|
|
63
|
+
*/
|
|
64
|
+
id: string;
|
|
65
|
+
/**
|
|
66
|
+
* Original filename
|
|
67
|
+
*/
|
|
68
|
+
filename: string;
|
|
69
|
+
/**
|
|
70
|
+
* Total file size in bytes
|
|
71
|
+
*/
|
|
72
|
+
file_size: number;
|
|
73
|
+
/**
|
|
74
|
+
* MIME type of the file
|
|
75
|
+
*/
|
|
76
|
+
mime_type: string;
|
|
77
|
+
/**
|
|
78
|
+
* Number of parts the file was split into
|
|
79
|
+
*/
|
|
80
|
+
part_count: number;
|
|
81
|
+
/**
|
|
82
|
+
* When the upload was initiated
|
|
83
|
+
*/
|
|
84
|
+
created_at: string;
|
|
85
|
+
/**
|
|
86
|
+
* Parts that have already been uploaded
|
|
87
|
+
*/
|
|
88
|
+
completed_parts: Array<MultipartUploadPart>;
|
|
89
|
+
/**
|
|
90
|
+
* Presigned URLs for the parts that still need to be uploaded
|
|
91
|
+
*/
|
|
92
|
+
part_urls: Array<MultipartUploadPartURL>;
|
|
93
|
+
}
|
|
94
|
+
export interface UploadListResponse {
|
|
95
|
+
/**
|
|
96
|
+
* List of in-progress multipart uploads
|
|
97
|
+
*/
|
|
98
|
+
data: Array<UploadListResponse.Data>;
|
|
99
|
+
}
|
|
100
|
+
export declare namespace UploadListResponse {
|
|
101
|
+
interface Data {
|
|
102
|
+
/**
|
|
103
|
+
* The multipart upload record ID
|
|
104
|
+
*/
|
|
105
|
+
id: string;
|
|
106
|
+
/**
|
|
107
|
+
* Original filename
|
|
108
|
+
*/
|
|
109
|
+
filename: string;
|
|
110
|
+
/**
|
|
111
|
+
* Total file size in bytes
|
|
112
|
+
*/
|
|
113
|
+
file_size: number;
|
|
114
|
+
/**
|
|
115
|
+
* MIME type of the file
|
|
116
|
+
*/
|
|
117
|
+
mime_type: string;
|
|
118
|
+
/**
|
|
119
|
+
* Number of parts the file was split into
|
|
120
|
+
*/
|
|
121
|
+
part_count: number;
|
|
122
|
+
/**
|
|
123
|
+
* When the upload was initiated
|
|
124
|
+
*/
|
|
125
|
+
created_at: string;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export interface UploadAbortResponse {
|
|
129
|
+
/**
|
|
130
|
+
* The ID of the deleted file
|
|
131
|
+
*/
|
|
132
|
+
id: string;
|
|
133
|
+
/**
|
|
134
|
+
* Whether the file was deleted
|
|
135
|
+
*/
|
|
136
|
+
deleted?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* The type of the deleted object
|
|
139
|
+
*/
|
|
140
|
+
object?: 'file';
|
|
141
|
+
}
|
|
142
|
+
export interface UploadCreateParams {
|
|
143
|
+
/**
|
|
144
|
+
* Name of the file including extension
|
|
145
|
+
*/
|
|
146
|
+
filename: string;
|
|
147
|
+
/**
|
|
148
|
+
* Total size of the file in bytes
|
|
149
|
+
*/
|
|
150
|
+
file_size: number;
|
|
151
|
+
/**
|
|
152
|
+
* MIME type of the file
|
|
153
|
+
*/
|
|
154
|
+
mime_type: string;
|
|
155
|
+
/**
|
|
156
|
+
* Number of parts to split the upload into
|
|
157
|
+
*/
|
|
158
|
+
part_count?: number;
|
|
159
|
+
}
|
|
160
|
+
export interface UploadCompleteParams {
|
|
161
|
+
/**
|
|
162
|
+
* List of completed parts with their ETags
|
|
163
|
+
*/
|
|
164
|
+
parts: Array<MultipartUploadPart>;
|
|
165
|
+
}
|
|
166
|
+
export declare namespace Uploads {
|
|
167
|
+
export { type MultipartUploadPart as MultipartUploadPart, type MultipartUploadPartURL as MultipartUploadPartURL, type UploadCreateResponse as UploadCreateResponse, type UploadRetrieveResponse as UploadRetrieveResponse, type UploadListResponse as UploadListResponse, type UploadAbortResponse as UploadAbortResponse, type UploadCreateParams as UploadCreateParams, type UploadCompleteParams as UploadCompleteParams, };
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=uploads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/resources/files/uploads.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.Uploads = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
7
|
+
class Uploads extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Initiate a multipart upload and receive presigned URLs for uploading parts
|
|
10
|
+
* directly to storage.
|
|
11
|
+
*/
|
|
12
|
+
create(body, options) {
|
|
13
|
+
return this._client.post('/v1/files/uploads', { body, ...options });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get a multipart upload's details with fresh presigned URLs for any parts not yet
|
|
17
|
+
* uploaded.
|
|
18
|
+
*/
|
|
19
|
+
retrieve(uploadID, options) {
|
|
20
|
+
return this._client.get((0, path_1.path) `/v1/files/uploads/${uploadID}`, options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* List all in-progress multipart uploads for the authenticated organization.
|
|
24
|
+
*/
|
|
25
|
+
list(options) {
|
|
26
|
+
return this._client.get('/v1/files/uploads', options);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Abort a multipart upload and clean up any uploaded parts.
|
|
30
|
+
*/
|
|
31
|
+
abort(uploadID, options) {
|
|
32
|
+
return this._client.post((0, path_1.path) `/v1/files/uploads/${uploadID}/abort`, options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Complete a multipart upload after all parts have been uploaded. Creates the file
|
|
36
|
+
* object and returns it.
|
|
37
|
+
*/
|
|
38
|
+
complete(uploadID, body, options) {
|
|
39
|
+
return this._client.post((0, path_1.path) `/v1/files/uploads/${uploadID}/complete`, { body, ...options });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.Uploads = Uploads;
|
|
43
|
+
//# sourceMappingURL=uploads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/resources/files/uploads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAIlD,uDAAiD;AAEjD,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;OAGG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,qBAAqB,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAgB,EAAE,OAAwB;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,qBAAqB,QAAQ,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;OAGG;IACH,QAAQ,CACN,QAAgB,EAChB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,qBAAqB,QAAQ,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;CACF;AA1CD,0BA0CC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
4
|
+
export class Uploads extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Initiate a multipart upload and receive presigned URLs for uploading parts
|
|
7
|
+
* directly to storage.
|
|
8
|
+
*/
|
|
9
|
+
create(body, options) {
|
|
10
|
+
return this._client.post('/v1/files/uploads', { body, ...options });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get a multipart upload's details with fresh presigned URLs for any parts not yet
|
|
14
|
+
* uploaded.
|
|
15
|
+
*/
|
|
16
|
+
retrieve(uploadID, options) {
|
|
17
|
+
return this._client.get(path `/v1/files/uploads/${uploadID}`, options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* List all in-progress multipart uploads for the authenticated organization.
|
|
21
|
+
*/
|
|
22
|
+
list(options) {
|
|
23
|
+
return this._client.get('/v1/files/uploads', options);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Abort a multipart upload and clean up any uploaded parts.
|
|
27
|
+
*/
|
|
28
|
+
abort(uploadID, options) {
|
|
29
|
+
return this._client.post(path `/v1/files/uploads/${uploadID}/abort`, options);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Complete a multipart upload after all parts have been uploaded. Creates the file
|
|
33
|
+
* object and returns it.
|
|
34
|
+
*/
|
|
35
|
+
complete(uploadID, body, options) {
|
|
36
|
+
return this._client.post(path `/v1/files/uploads/${uploadID}/complete`, { body, ...options });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=uploads.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["../../src/resources/files/uploads.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;OAGG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,qBAAqB,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAgB,EAAE,OAAwB;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,qBAAqB,QAAQ,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;OAGG;IACH,QAAQ,CACN,QAAgB,EAChB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,qBAAqB,QAAQ,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;CACF"}
|
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"}
|