@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.
Files changed (106) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -3
  9. package/client.mjs.map +1 -1
  10. package/index.d.mts +1 -0
  11. package/index.d.mts.map +1 -1
  12. package/index.d.ts +1 -0
  13. package/index.d.ts.map +1 -1
  14. package/index.js +3 -1
  15. package/index.js.map +1 -1
  16. package/index.mjs +1 -0
  17. package/index.mjs.map +1 -1
  18. package/internal/tslib.js +17 -17
  19. package/internal/utils/query.d.mts +2 -0
  20. package/internal/utils/query.d.mts.map +1 -0
  21. package/internal/utils/query.d.ts +2 -0
  22. package/internal/utils/query.d.ts.map +1 -0
  23. package/internal/utils/query.js +10 -0
  24. package/internal/utils/query.js.map +1 -0
  25. package/internal/utils/query.mjs +6 -0
  26. package/internal/utils/query.mjs.map +1 -0
  27. package/internal/utils.d.mts +1 -0
  28. package/internal/utils.d.ts +1 -0
  29. package/internal/utils.js +1 -0
  30. package/internal/utils.js.map +1 -1
  31. package/internal/utils.mjs +1 -0
  32. package/lib/upload-file.d.mts +34 -0
  33. package/lib/upload-file.d.mts.map +1 -0
  34. package/lib/upload-file.d.ts +34 -0
  35. package/lib/upload-file.d.ts.map +1 -0
  36. package/lib/upload-file.js +146 -0
  37. package/lib/upload-file.js.map +1 -0
  38. package/lib/upload-file.mjs +141 -0
  39. package/lib/upload-file.mjs.map +1 -0
  40. package/package.json +1 -1
  41. package/resources/files/files.d.mts +156 -0
  42. package/resources/files/files.d.mts.map +1 -0
  43. package/resources/files/files.d.ts +156 -0
  44. package/resources/files/files.d.ts.map +1 -0
  45. package/resources/files/files.js +86 -0
  46. package/resources/files/files.js.map +1 -0
  47. package/resources/files/files.mjs +81 -0
  48. package/resources/files/files.mjs.map +1 -0
  49. package/resources/files/index.d.mts +3 -0
  50. package/resources/files/index.d.mts.map +1 -0
  51. package/resources/files/index.d.ts +3 -0
  52. package/resources/files/index.d.ts.map +1 -0
  53. package/resources/files/index.js +9 -0
  54. package/resources/files/index.js.map +1 -0
  55. package/resources/files/index.mjs +4 -0
  56. package/resources/files/index.mjs.map +1 -0
  57. package/resources/files/uploads.d.mts +169 -0
  58. package/resources/files/uploads.d.mts.map +1 -0
  59. package/resources/files/uploads.d.ts +169 -0
  60. package/resources/files/uploads.d.ts.map +1 -0
  61. package/resources/files/uploads.js +43 -0
  62. package/resources/files/uploads.js.map +1 -0
  63. package/resources/files/uploads.mjs +39 -0
  64. package/resources/files/uploads.mjs.map +1 -0
  65. package/resources/files.d.mts +1 -144
  66. package/resources/files.d.mts.map +1 -1
  67. package/resources/files.d.ts +1 -144
  68. package/resources/files.d.ts.map +1 -1
  69. package/resources/files.js +2 -73
  70. package/resources/files.js.map +1 -1
  71. package/resources/files.mjs +1 -71
  72. package/resources/files.mjs.map +1 -1
  73. package/resources/index.d.mts +1 -1
  74. package/resources/index.d.ts +1 -1
  75. package/resources/index.js +1 -1
  76. package/resources/index.js.map +1 -1
  77. package/resources/index.mjs +1 -1
  78. package/resources/stores/files.d.mts +10 -7
  79. package/resources/stores/files.d.mts.map +1 -1
  80. package/resources/stores/files.d.ts +10 -7
  81. package/resources/stores/files.d.ts.map +1 -1
  82. package/resources/stores/files.js +15 -4
  83. package/resources/stores/files.js.map +1 -1
  84. package/resources/stores/files.mjs +15 -4
  85. package/resources/stores/files.mjs.map +1 -1
  86. package/resources/stores/stores.d.mts +4 -4
  87. package/resources/stores/stores.d.mts.map +1 -1
  88. package/resources/stores/stores.d.ts +4 -4
  89. package/resources/stores/stores.d.ts.map +1 -1
  90. package/src/client.ts +15 -15
  91. package/src/index.ts +1 -0
  92. package/src/internal/utils/query.ts +7 -0
  93. package/src/internal/utils.ts +1 -0
  94. package/src/lib/upload-file.ts +233 -0
  95. package/src/resources/files/files.ts +239 -0
  96. package/src/resources/files/index.ts +23 -0
  97. package/src/resources/files/uploads.ts +229 -0
  98. package/src/resources/files.ts +1 -201
  99. package/src/resources/index.ts +1 -1
  100. package/src/resources/stores/files.ts +28 -7
  101. package/src/resources/stores/stores.ts +4 -4
  102. package/src/version.ts +1 -1
  103. package/version.d.mts +1 -1
  104. package/version.d.ts +1 -1
  105. package/version.js +1 -1
  106. package/version.mjs +1 -1
@@ -0,0 +1,156 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as UploadsAPI from "./uploads.js";
3
+ import { MultipartUploadPart, MultipartUploadPartURL, UploadAbortResponse, UploadCompleteParams, UploadCreateParams, UploadCreateResponse, UploadListResponse, UploadRetrieveResponse, Uploads } from "./uploads.js";
4
+ import { APIPromise } from "../../core/api-promise.js";
5
+ import { Cursor, type CursorParams, PagePromise } from "../../core/pagination.js";
6
+ import { type Uploadable } from "../../core/uploads.js";
7
+ import { RequestOptions } from "../../internal/request-options.js";
8
+ import { type MultipartUploadConfig } from "../../lib/upload-file.js";
9
+ export declare class Files extends APIResource {
10
+ uploads: UploadsAPI.Uploads;
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: FileCreateParams, options?: RequestOptions): APIPromise<FileObject>;
19
+ /**
20
+ * Retrieve details of a specific file by its ID.
21
+ *
22
+ * Args: file_id: The ID of the file to retrieve.
23
+ *
24
+ * Returns: FileResponse: The response containing the file details.
25
+ */
26
+ retrieve(fileID: string, options?: RequestOptions): APIPromise<FileObject>;
27
+ /**
28
+ * Update the details of a specific file.
29
+ *
30
+ * Args: file_id: The ID of the file to update. file: The new details for the file.
31
+ *
32
+ * Returns: FileObject: The updated file details.
33
+ */
34
+ update(fileID: string, body: FileUpdateParams, options?: RequestOptions): APIPromise<FileObject>;
35
+ /**
36
+ * List all files for the authenticated user.
37
+ *
38
+ * Args: pagination: The pagination options
39
+ *
40
+ * Returns: A list of files belonging to the user.
41
+ */
42
+ list(query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FileObjectsCursor, FileObject>;
43
+ /**
44
+ * Delete a specific file by its ID.
45
+ *
46
+ * Args: file_id: The ID of the file to delete.
47
+ *
48
+ * Returns: FileDeleted: The response containing the details of the deleted file.
49
+ */
50
+ delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse>;
51
+ /**
52
+ * Download a specific file by its ID.
53
+ *
54
+ * Args: file_id: The ID of the file to download.
55
+ *
56
+ * Returns: FileStreamResponse: The response containing the file to be downloaded.
57
+ */
58
+ content(fileID: string, options?: RequestOptions): APIPromise<Response>;
59
+ }
60
+ export type FileObjectsCursor = Cursor<FileObject>;
61
+ /**
62
+ * A model representing a file object in the system.
63
+ *
64
+ * This model contains metadata about files stored in the system, including
65
+ * identifiers, size information, and timestamps.
66
+ */
67
+ export interface FileObject {
68
+ /**
69
+ * Unique identifier for the file
70
+ */
71
+ id: string;
72
+ /**
73
+ * Name of the file including extension
74
+ */
75
+ filename: string;
76
+ /**
77
+ * Size of the file in bytes
78
+ */
79
+ bytes: number;
80
+ /**
81
+ * MIME type of the file
82
+ */
83
+ mime_type: string;
84
+ /**
85
+ * Version of the file
86
+ */
87
+ version: number;
88
+ /**
89
+ * Timestamp when the file was created
90
+ */
91
+ created_at: string;
92
+ /**
93
+ * Timestamp when the file was last updated
94
+ */
95
+ updated_at: string;
96
+ }
97
+ /**
98
+ * Pagination model that includes total count of items.
99
+ */
100
+ export interface PaginationWithTotal {
101
+ /**
102
+ * Maximum number of items to return per page
103
+ */
104
+ limit?: number;
105
+ /**
106
+ * Offset of the first item to return
107
+ */
108
+ offset?: number;
109
+ /**
110
+ * Total number of items available
111
+ */
112
+ total?: number;
113
+ }
114
+ export interface FileDeleteResponse {
115
+ /**
116
+ * The ID of the deleted file
117
+ */
118
+ id: string;
119
+ /**
120
+ * Whether the file was deleted
121
+ */
122
+ deleted?: boolean;
123
+ /**
124
+ * The type of the deleted object
125
+ */
126
+ object?: 'file';
127
+ }
128
+ export interface FileCreateParams {
129
+ /**
130
+ * The file to upload
131
+ */
132
+ file: Uploadable;
133
+ /**
134
+ * Optional configuration for automatic multipart uploads.
135
+ * When the file size exceeds the threshold (default 100MB), the SDK
136
+ * will automatically use multipart upload with presigned URLs.
137
+ */
138
+ multipartUpload?: MultipartUploadConfig;
139
+ }
140
+ export interface FileUpdateParams {
141
+ /**
142
+ * The file to update
143
+ */
144
+ file: Uploadable;
145
+ }
146
+ export interface FileListParams extends CursorParams {
147
+ /**
148
+ * Search query for fuzzy matching over name and description fields
149
+ */
150
+ q?: string | null;
151
+ }
152
+ export declare namespace Files {
153
+ 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, };
154
+ export { Uploads as Uploads, 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, };
155
+ }
156
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,EACR;OACM,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,YAAY,E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oB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
@@ -0,0 +1,86 @@
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 tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const UploadsAPI = tslib_1.__importStar(require("./uploads.js"));
8
+ const uploads_1 = require("./uploads.js");
9
+ const pagination_1 = require("../../core/pagination.js");
10
+ const headers_1 = require("../../internal/headers.js");
11
+ const uploads_2 = require("../../internal/uploads.js");
12
+ const path_1 = require("../../internal/utils/path.js");
13
+ const upload_file_1 = require("../../lib/upload-file.js");
14
+ class Files extends resource_1.APIResource {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.uploads = new UploadsAPI.Uploads(this._client);
18
+ }
19
+ /**
20
+ * Upload a new file.
21
+ *
22
+ * Args: file: The file to upload.
23
+ *
24
+ * Returns: FileResponse: The response containing the details of the uploaded file.
25
+ */
26
+ create(body, options) {
27
+ return (0, upload_file_1.handleFileCreate)(this._client, body, options);
28
+ }
29
+ /**
30
+ * Retrieve details of a specific file by its ID.
31
+ *
32
+ * Args: file_id: The ID of the file to retrieve.
33
+ *
34
+ * Returns: FileResponse: The response containing the file details.
35
+ */
36
+ retrieve(fileID, options) {
37
+ return this._client.get((0, path_1.path) `/v1/files/${fileID}`, options);
38
+ }
39
+ /**
40
+ * Update the details of a specific file.
41
+ *
42
+ * Args: file_id: The ID of the file to update. file: The new details for the file.
43
+ *
44
+ * Returns: FileObject: The updated file details.
45
+ */
46
+ update(fileID, body, options) {
47
+ return this._client.post((0, path_1.path) `/v1/files/${fileID}`, (0, uploads_2.multipartFormRequestOptions)({ body, ...options }, this._client));
48
+ }
49
+ /**
50
+ * List all files for the authenticated user.
51
+ *
52
+ * Args: pagination: The pagination options
53
+ *
54
+ * Returns: A list of files belonging to the user.
55
+ */
56
+ list(query = {}, options) {
57
+ return this._client.getAPIList('/v1/files', (pagination_1.Cursor), { query, ...options });
58
+ }
59
+ /**
60
+ * Delete a specific file by its ID.
61
+ *
62
+ * Args: file_id: The ID of the file to delete.
63
+ *
64
+ * Returns: FileDeleted: The response containing the details of the deleted file.
65
+ */
66
+ delete(fileID, options) {
67
+ return this._client.delete((0, path_1.path) `/v1/files/${fileID}`, options);
68
+ }
69
+ /**
70
+ * Download a specific file by its ID.
71
+ *
72
+ * Args: file_id: The ID of the file to download.
73
+ *
74
+ * Returns: FileStreamResponse: The response containing the file to be downloaded.
75
+ */
76
+ content(fileID, options) {
77
+ return this._client.get((0, path_1.path) `/v1/files/${fileID}/content`, {
78
+ ...options,
79
+ headers: (0, headers_1.buildHeaders)([{ Accept: 'application/octet-stream' }, options?.headers]),
80
+ __binaryResponse: true,
81
+ });
82
+ }
83
+ }
84
+ exports.Files = Files;
85
+ Files.Uploads = uploads_1.Uploads;
86
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/resources/files/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,iEAAwC;AACxC,0CAUmB;AAEnB,yDAA+E;AAE/E,uDAAsD;AAEtD,uDAAqE;AACrE,uDAAiD;AACjD,0DAAqF;AAErF,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6ErE,CAAC;IA3EC;;;;;;OAMG;IACH,MAAM,CAAC,IAAsB,EAAE,OAAwB;QACrD,OAAO,IAAA,8BAAgB,EAAC,IAAI,CAAC,OAAO,EAAE,IA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,OAAO,GAAG,iBAAO,CAAC"}
@@ -0,0 +1,81 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as UploadsAPI from "./uploads.mjs";
4
+ import { Uploads, } from "./uploads.mjs";
5
+ import { Cursor } from "../../core/pagination.mjs";
6
+ import { buildHeaders } from "../../internal/headers.mjs";
7
+ import { multipartFormRequestOptions } from "../../internal/uploads.mjs";
8
+ import { path } from "../../internal/utils/path.mjs";
9
+ import { handleFileCreate } from "../../lib/upload-file.mjs";
10
+ export class Files extends APIResource {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.uploads = new UploadsAPI.Uploads(this._client);
14
+ }
15
+ /**
16
+ * Upload a new file.
17
+ *
18
+ * Args: file: The file to upload.
19
+ *
20
+ * Returns: FileResponse: The response containing the details of the uploaded file.
21
+ */
22
+ create(body, options) {
23
+ return handleFileCreate(this._client, body, options);
24
+ }
25
+ /**
26
+ * Retrieve details of a specific file by its ID.
27
+ *
28
+ * Args: file_id: The ID of the file to retrieve.
29
+ *
30
+ * Returns: FileResponse: The response containing the file details.
31
+ */
32
+ retrieve(fileID, options) {
33
+ return this._client.get(path `/v1/files/${fileID}`, options);
34
+ }
35
+ /**
36
+ * Update the details of a specific file.
37
+ *
38
+ * Args: file_id: The ID of the file to update. file: The new details for the file.
39
+ *
40
+ * Returns: FileObject: The updated file details.
41
+ */
42
+ update(fileID, body, options) {
43
+ return this._client.post(path `/v1/files/${fileID}`, multipartFormRequestOptions({ body, ...options }, this._client));
44
+ }
45
+ /**
46
+ * List all files for the authenticated user.
47
+ *
48
+ * Args: pagination: The pagination options
49
+ *
50
+ * Returns: A list of files belonging to the user.
51
+ */
52
+ list(query = {}, options) {
53
+ return this._client.getAPIList('/v1/files', (Cursor), { query, ...options });
54
+ }
55
+ /**
56
+ * Delete a specific file by its ID.
57
+ *
58
+ * Args: file_id: The ID of the file to delete.
59
+ *
60
+ * Returns: FileDeleted: The response containing the details of the deleted file.
61
+ */
62
+ delete(fileID, options) {
63
+ return this._client.delete(path `/v1/files/${fileID}`, options);
64
+ }
65
+ /**
66
+ * Download a specific file by its ID.
67
+ *
68
+ * Args: file_id: The ID of the file to download.
69
+ *
70
+ * Returns: FileStreamResponse: The response containing the file to be downloaded.
71
+ */
72
+ content(fileID, options) {
73
+ return this._client.get(path `/v1/files/${fileID}/content`, {
74
+ ...options,
75
+ headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
76
+ __binaryResponse: true,
77
+ });
78
+ }
79
+ }
80
+ Files.Uploads = Uploads;
81
+ //# sourceMappingURL=files.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.mjs","sourceRoot":"","sources":["../../src/resources/files/files.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EASL,OAAO,GACR;OAEM,EAAE,MAAM,EAAkC;OAE1C,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;OACR,EAAE,gBAAgB,EAA8B;AAEvD,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6ErE,CAAC;IA3EC;;;;;;OAMG;IACH,MAAM,CAAC,IAAsB,EAAE,OAAwB;QACrD,OAAO,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,MAAc,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAc,EAAE,IAAsB,EAAE,OAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAI,CAAA,aAAa,MAAM,EAAE,EACzB,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CACF,QAA2C,EAAE,EAC7C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,MAAkB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAc,EAAE,OAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,aAAa,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,MAAc,EAAE,OAAwB;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,MAAM,UAAU,EAAE;YACzD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YACjF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AAgHD,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Files, type FileObject, type PaginationWithTotal, type FileDeleteResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, type FileObjectsCursor, } from "./files.mjs";
2
+ export { Uploads, type MultipartUploadPart, type MultipartUploadPartURL, type UploadCreateResponse, type UploadRetrieveResponse, type UploadListResponse, type UploadAbortResponse, type UploadCreateParams, type UploadCompleteParams, } from "./uploads.mjs";
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/files/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB;OACM,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B"}
@@ -0,0 +1,3 @@
1
+ export { Files, type FileObject, type PaginationWithTotal, type FileDeleteResponse, type FileCreateParams, type FileUpdateParams, type FileListParams, type FileObjectsCursor, } from "./files.js";
2
+ export { Uploads, type MultipartUploadPart, type MultipartUploadPartURL, type UploadCreateResponse, type UploadRetrieveResponse, type UploadListResponse, type UploadAbortResponse, type UploadCreateParams, type UploadCompleteParams, } from "./uploads.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/files/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB;OACM,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B"}
@@ -0,0 +1,9 @@
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 = exports.Files = void 0;
5
+ var files_1 = require("./files.js");
6
+ Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
7
+ var uploads_1 = require("./uploads.js");
8
+ Object.defineProperty(exports, "Uploads", { enumerable: true, get: function () { return uploads_1.Uploads; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/files/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCASiB;AARf,8FAAA,KAAK,OAAA;AASP,wCAUmB;AATjB,kGAAA,OAAO,OAAA"}
@@ -0,0 +1,4 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export { Files, } from "./files.mjs";
3
+ export { Uploads, } from "./uploads.mjs";
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/files/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,KAAK,GAQN;OACM,EACL,OAAO,GASR"}
@@ -0,0 +1,169 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import * as FilesAPI from "./files.mjs";
3
+ import { APIPromise } from "../../core/api-promise.mjs";
4
+ import { RequestOptions } from "../../internal/request-options.mjs";
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.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["../../src/resources/files/uploads.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;OAGG;IACH,MAA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