@internxt/sdk 1.15.14 → 1.16.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/dist/auth/index.js +180 -262
- package/dist/auth/types.js +2 -22
- package/dist/drive/backups/index.js +34 -32
- package/dist/drive/payments/index.d.ts +2 -32
- package/dist/drive/payments/index.js +75 -179
- package/dist/drive/payments/object-storage.js +34 -36
- package/dist/drive/payments/types/types.d.ts +6 -0
- package/dist/drive/referrals/index.js +19 -17
- package/dist/drive/share/index.js +168 -235
- package/dist/drive/storage/index.js +213 -302
- package/dist/drive/trash/index.js +40 -84
- package/dist/drive/users/index.js +95 -140
- package/dist/mail/index.d.ts +124 -2
- package/dist/mail/index.js +170 -16
- package/dist/mail/types.d.ts +50 -0
- package/dist/mail/types.js +6 -0
- package/dist/meet/index.js +31 -99
- package/dist/misc/location/index.js +10 -50
- package/dist/network/download.js +38 -107
- package/dist/network/errors/codes.js +8 -24
- package/dist/network/errors/context.js +9 -26
- package/dist/network/errors/download.js +6 -24
- package/dist/network/errors/upload.js +21 -48
- package/dist/network/index.js +120 -277
- package/dist/network/types.js +3 -4
- package/dist/network/upload.js +63 -133
- package/dist/payments/checkout.d.ts +1 -1
- package/dist/payments/checkout.js +56 -69
- package/dist/payments/types/index.d.ts +0 -3
- package/dist/send/send.js +17 -27
- package/dist/shared/headers/index.js +56 -42
- package/dist/shared/http/client.js +95 -207
- package/dist/shared/http/retryWithBackoff.js +36 -110
- package/dist/shared/types/errors.js +37 -51
- package/dist/workspaces/index.js +224 -264
- package/package.json +14 -15
- package/dist/mail/api.d.ts +0 -126
- package/dist/mail/api.js +0 -288
- package/dist/mail/crypto.d.ts +0 -66
- package/dist/mail/crypto.js +0 -156
- package/dist/mail/mail.d.ts +0 -162
- package/dist/mail/mail.js +0 -382
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -43,122 +32,72 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
43
32
|
return result;
|
|
44
33
|
};
|
|
45
34
|
})();
|
|
46
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
56
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
|
-
function step(op) {
|
|
60
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
62
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64
|
-
switch (op[0]) {
|
|
65
|
-
case 0: case 1: t = op; break;
|
|
66
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
67
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
68
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
69
|
-
default:
|
|
70
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
71
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
72
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
73
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
74
|
-
if (t[2]) _.ops.pop();
|
|
75
|
-
_.trys.pop(); continue;
|
|
76
|
-
}
|
|
77
|
-
op = body.call(thisArg, _);
|
|
78
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
36
|
exports.Storage = exports.StorageTypes = void 0;
|
|
84
|
-
|
|
85
|
-
|
|
37
|
+
const headers_1 = require("../../shared/headers");
|
|
38
|
+
const client_1 = require("../../shared/http/client");
|
|
86
39
|
exports.StorageTypes = __importStar(require("./types"));
|
|
87
|
-
|
|
88
|
-
|
|
40
|
+
class Storage {
|
|
41
|
+
client;
|
|
42
|
+
appDetails;
|
|
43
|
+
apiSecurity;
|
|
44
|
+
static client(apiUrl, appDetails, apiSecurity) {
|
|
45
|
+
return new Storage(apiUrl, appDetails, apiSecurity);
|
|
46
|
+
}
|
|
47
|
+
constructor(apiUrl, appDetails, apiSecurity) {
|
|
89
48
|
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback, apiSecurity.retryOptions);
|
|
90
49
|
this.appDetails = appDetails;
|
|
91
50
|
this.apiSecurity = apiSecurity;
|
|
92
51
|
}
|
|
93
|
-
Storage.client = function (apiUrl, appDetails, apiSecurity) {
|
|
94
|
-
return new Storage(apiUrl, appDetails, apiSecurity);
|
|
95
|
-
};
|
|
96
52
|
/**
|
|
97
53
|
* Creates a new folder
|
|
98
54
|
* @param payload
|
|
99
55
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
56
|
+
createFolder(payload) {
|
|
57
|
+
const { promise, requestCanceler } = this.client.postCancellable('/storage/folder', {
|
|
102
58
|
parentFolderId: payload.parentFolderId,
|
|
103
59
|
folderName: payload.folderName,
|
|
104
|
-
}, this.headers())
|
|
60
|
+
}, this.headers());
|
|
105
61
|
return [promise, requestCanceler];
|
|
106
|
-
}
|
|
62
|
+
}
|
|
107
63
|
/**
|
|
108
64
|
* Creates a new folder
|
|
109
65
|
* @param payload
|
|
110
66
|
*/
|
|
111
|
-
|
|
112
|
-
|
|
67
|
+
createFolderByUuid(payload) {
|
|
68
|
+
const { promise, requestCanceler } = this.client.postCancellable('/folders', {
|
|
113
69
|
plainName: payload.plainName,
|
|
114
70
|
parentFolderUuid: payload.parentFolderUuid,
|
|
115
|
-
}, this.headers())
|
|
71
|
+
}, this.headers());
|
|
116
72
|
return [promise, requestCanceler];
|
|
117
|
-
}
|
|
73
|
+
}
|
|
118
74
|
/**
|
|
119
75
|
* Moves a specific folder to a new location
|
|
120
76
|
* @param payload
|
|
121
77
|
* @deprecated Use `moveFolderByUuid` instead.
|
|
122
78
|
*/
|
|
123
|
-
|
|
124
|
-
return
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}, this.headers())];
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
};
|
|
79
|
+
async moveFolder(payload) {
|
|
80
|
+
return this.client.post('/storage/move/folder', {
|
|
81
|
+
folderId: payload.folderId,
|
|
82
|
+
destination: payload.destinationFolderId,
|
|
83
|
+
}, this.headers());
|
|
84
|
+
}
|
|
133
85
|
/**
|
|
134
86
|
* Moves a specific folder to a new location
|
|
135
87
|
* @param payload
|
|
136
88
|
*/
|
|
137
|
-
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
return [2 /*return*/, this.client.patch("/folders/".concat(uuid), payload, this.headers())];
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
};
|
|
89
|
+
async moveFolderByUuid(uuid, payload) {
|
|
90
|
+
return this.client.patch(`/folders/${uuid}`, payload, this.headers());
|
|
91
|
+
}
|
|
144
92
|
/**
|
|
145
93
|
* Updates the metadata of a folder
|
|
146
94
|
* @param payload
|
|
147
95
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
metadata: payload.changes,
|
|
154
|
-
}, this.headers())];
|
|
155
|
-
case 1:
|
|
156
|
-
_a.sent();
|
|
157
|
-
return [2 /*return*/];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
};
|
|
96
|
+
async updateFolder(payload) {
|
|
97
|
+
await this.client.post(`/storage/folder/${payload.folderId}/meta`, {
|
|
98
|
+
metadata: payload.changes,
|
|
99
|
+
}, this.headers());
|
|
100
|
+
}
|
|
162
101
|
/**
|
|
163
102
|
* Updates the name of a folder with the given UUID.
|
|
164
103
|
*
|
|
@@ -168,22 +107,21 @@ var Storage = /** @class */ (function () {
|
|
|
168
107
|
* @param {Token} [resourcesToken] - An optional token for authentication.
|
|
169
108
|
* @return {Promise<void>} A promise that resolves when the folder name is successfully updated.
|
|
170
109
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return this.client.put(
|
|
110
|
+
updateFolderNameWithUUID(payload, resourcesToken) {
|
|
111
|
+
const { folderUuid, name } = payload;
|
|
112
|
+
return this.client.put(`/folders/${folderUuid}/meta`, {
|
|
174
113
|
plainName: name,
|
|
175
114
|
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
176
|
-
}
|
|
115
|
+
}
|
|
177
116
|
/**
|
|
178
117
|
* Fetches & returns the contents of a specific folder
|
|
179
118
|
* @param folderId
|
|
180
119
|
*/
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var _a = this.client.getCancellable("/storage/v2/folder/".concat(folderId).concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
120
|
+
getFolderContent(folderId, trash = false) {
|
|
121
|
+
const query = trash ? '/?trash=true' : '';
|
|
122
|
+
const { promise, requestCanceler } = this.client.getCancellable(`/storage/v2/folder/${folderId}${query}`, this.headers());
|
|
185
123
|
return [promise, requestCanceler];
|
|
186
|
-
}
|
|
124
|
+
}
|
|
187
125
|
/**
|
|
188
126
|
* Fetches and returns the contents of a specific folder by its UUID.
|
|
189
127
|
*
|
|
@@ -194,23 +132,22 @@ var Storage = /** @class */ (function () {
|
|
|
194
132
|
* @param {boolean} [workspacesToken] - Token for accessing workspaces.
|
|
195
133
|
* @return {[Promise<FetchFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
196
134
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
var query = new URLSearchParams();
|
|
135
|
+
getFolderContentByUuid({ folderUuid, trash = false, offset, limit, workspacesToken, }) {
|
|
136
|
+
const query = new URLSearchParams();
|
|
200
137
|
if (offset !== undefined)
|
|
201
138
|
query.set('offset', String(offset));
|
|
202
139
|
if (limit !== undefined)
|
|
203
140
|
query.set('limit', String(limit));
|
|
204
141
|
if (trash)
|
|
205
142
|
query.set('trash', 'true');
|
|
206
|
-
|
|
143
|
+
const customHeaders = workspacesToken
|
|
207
144
|
? {
|
|
208
145
|
'x-internxt-workspace': workspacesToken,
|
|
209
146
|
}
|
|
210
147
|
: undefined;
|
|
211
|
-
|
|
148
|
+
const { promise, requestCanceler } = this.client.getCancellable(`/folders/content/${folderUuid}?${query}`, this.headers(customHeaders));
|
|
212
149
|
return [promise, requestCanceler];
|
|
213
|
-
}
|
|
150
|
+
}
|
|
214
151
|
/**
|
|
215
152
|
* Retrieves a file with the specified fileId along with the associated workspacesToken.
|
|
216
153
|
*
|
|
@@ -218,15 +155,15 @@ var Storage = /** @class */ (function () {
|
|
|
218
155
|
* @param {string} [workspacesToken] - Token for accessing workspaces.
|
|
219
156
|
* @return {[Promise<FileMeta>, RequestCanceler]} A promise with FileMeta and a canceler for the request.
|
|
220
157
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
158
|
+
getFile(fileId, workspacesToken) {
|
|
159
|
+
const customHeaders = workspacesToken
|
|
223
160
|
? {
|
|
224
161
|
'x-internxt-workspace': workspacesToken,
|
|
225
162
|
}
|
|
226
163
|
: undefined;
|
|
227
|
-
|
|
164
|
+
const { promise, requestCanceler } = this.client.getCancellable(`/files/${fileId}/meta`, this.headers(customHeaders));
|
|
228
165
|
return [promise, requestCanceler];
|
|
229
|
-
}
|
|
166
|
+
}
|
|
230
167
|
/**
|
|
231
168
|
* Gets the files in a folder.
|
|
232
169
|
*
|
|
@@ -237,19 +174,15 @@ var Storage = /** @class */ (function () {
|
|
|
237
174
|
* @param {string} [order=ASC] - The order to be followed.
|
|
238
175
|
* @returns {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
239
176
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
248
|
-
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
249
|
-
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
250
|
-
var _a = this.client.getCancellable("folders/".concat(folderId, "/files/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
177
|
+
getFolderFiles(folderId, offset = 0, limit = 50, sort = '', order = '') {
|
|
178
|
+
const offsetQuery = `?offset=${offset}`;
|
|
179
|
+
const limitQuery = `&limit=${limit}`;
|
|
180
|
+
const sortQuery = sort !== '' ? `&sort=${sort}` : '';
|
|
181
|
+
const orderQuery = order !== '' ? `&order=${order}` : '';
|
|
182
|
+
const query = `${offsetQuery}${limitQuery}${sortQuery}${orderQuery}`;
|
|
183
|
+
const { promise, requestCanceler } = this.client.getCancellable(`folders/${folderId}/files/${query}`, this.headers());
|
|
251
184
|
return [promise, requestCanceler];
|
|
252
|
-
}
|
|
185
|
+
}
|
|
253
186
|
/**
|
|
254
187
|
* Gets the files in a folder by its UUID.
|
|
255
188
|
*
|
|
@@ -260,19 +193,15 @@ var Storage = /** @class */ (function () {
|
|
|
260
193
|
* @param {string} [order=ASC] - The order to be followed.
|
|
261
194
|
* @returns {[Promise<FetchPaginatedFilesContent>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
262
195
|
*/
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
271
|
-
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
272
|
-
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
273
|
-
var _a = this.client.getCancellable("folders/content/".concat(folderUuid, "/files/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
196
|
+
getFolderFilesByUuid(folderUuid, offset = 0, limit = 50, sort = '', order = '') {
|
|
197
|
+
const offsetQuery = `?offset=${offset}`;
|
|
198
|
+
const limitQuery = `&limit=${limit}`;
|
|
199
|
+
const sortQuery = sort !== '' ? `&sort=${sort}` : '';
|
|
200
|
+
const orderQuery = order !== '' ? `&order=${order}` : '';
|
|
201
|
+
const query = `${offsetQuery}${limitQuery}${sortQuery}${orderQuery}`;
|
|
202
|
+
const { promise, requestCanceler } = this.client.getCancellable(`folders/content/${folderUuid}/files/${query}`, this.headers());
|
|
274
203
|
return [promise, requestCanceler];
|
|
275
|
-
}
|
|
204
|
+
}
|
|
276
205
|
/**
|
|
277
206
|
* Gets the subfolders of a folder.
|
|
278
207
|
*
|
|
@@ -283,19 +212,15 @@ var Storage = /** @class */ (function () {
|
|
|
283
212
|
* @param {string} [order=ASC] - The order to be followed.
|
|
284
213
|
* @returns {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
285
214
|
*/
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
294
|
-
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
295
|
-
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
296
|
-
var _a = this.client.getCancellable("folders/".concat(folderId, "/folders/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
215
|
+
getFolderFolders(folderId, offset = 0, limit = 50, sort = '', order = '') {
|
|
216
|
+
const offsetQuery = `?offset=${offset}`;
|
|
217
|
+
const limitQuery = `&limit=${limit}`;
|
|
218
|
+
const sortQuery = sort !== '' ? `&sort=${sort}` : '';
|
|
219
|
+
const orderQuery = order !== '' ? `&order=${order}` : '';
|
|
220
|
+
const query = `${offsetQuery}${limitQuery}${sortQuery}${orderQuery}`;
|
|
221
|
+
const { promise, requestCanceler } = this.client.getCancellable(`folders/${folderId}/folders/${query}`, this.headers());
|
|
297
222
|
return [promise, requestCanceler];
|
|
298
|
-
}
|
|
223
|
+
}
|
|
299
224
|
/**
|
|
300
225
|
* Gets the subfolders of a folder by its UUID.
|
|
301
226
|
*
|
|
@@ -306,53 +231,49 @@ var Storage = /** @class */ (function () {
|
|
|
306
231
|
* @param {string} [order=ASC] - The order to be followed.
|
|
307
232
|
* @returns {[Promise<FetchPaginatedFoldersContent>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
308
233
|
*/
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
317
|
-
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
318
|
-
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
319
|
-
var _a = this.client.getCancellable("folders/content/".concat(folderUuid, "/folders/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
234
|
+
getFolderFoldersByUuid(folderUuid, offset = 0, limit = 50, sort = '', order = '') {
|
|
235
|
+
const offsetQuery = `?offset=${offset}`;
|
|
236
|
+
const limitQuery = `&limit=${limit}`;
|
|
237
|
+
const sortQuery = sort !== '' ? `&sort=${sort}` : '';
|
|
238
|
+
const orderQuery = order !== '' ? `&order=${order}` : '';
|
|
239
|
+
const query = `${offsetQuery}${limitQuery}${sortQuery}${orderQuery}`;
|
|
240
|
+
const { promise, requestCanceler } = this.client.getCancellable(`folders/content/${folderUuid}/folders/${query}`, this.headers());
|
|
320
241
|
return [promise, requestCanceler];
|
|
321
|
-
}
|
|
242
|
+
}
|
|
322
243
|
/**
|
|
323
244
|
* Removes a specific folder from the centralized persistence
|
|
324
245
|
* @param folderId
|
|
325
246
|
* @deprecated Use `deleteFolderByUuid` instead.
|
|
326
247
|
*/
|
|
327
|
-
|
|
328
|
-
return this.client.delete(
|
|
329
|
-
}
|
|
248
|
+
deleteFolder(folderId) {
|
|
249
|
+
return this.client.delete(`/storage/folder/${folderId}`, this.headers());
|
|
250
|
+
}
|
|
330
251
|
/**
|
|
331
252
|
* Deletes a folder from the storage system using its unique identifier (UUID).
|
|
332
253
|
*
|
|
333
254
|
* @param folderId - The UUID of the folder to be deleted.
|
|
334
255
|
* @returns A promise that resolves with the response of the delete operation.
|
|
335
256
|
*/
|
|
336
|
-
|
|
337
|
-
return this.client.delete(
|
|
338
|
-
}
|
|
257
|
+
deleteFolderByUuid(folderId) {
|
|
258
|
+
return this.client.delete(`/folders/${folderId}`, this.headers());
|
|
259
|
+
}
|
|
339
260
|
/**
|
|
340
261
|
* Returns the total size of a folder
|
|
341
262
|
* @param folderId
|
|
342
263
|
*/
|
|
343
|
-
|
|
264
|
+
getFolderSize(folderId) {
|
|
344
265
|
return this.client
|
|
345
|
-
.get(
|
|
346
|
-
.then(
|
|
266
|
+
.get(`/storage/folder/size/${folderId}`, this.headers())
|
|
267
|
+
.then((response) => {
|
|
347
268
|
return response.size;
|
|
348
269
|
});
|
|
349
|
-
}
|
|
270
|
+
}
|
|
350
271
|
/**
|
|
351
272
|
* Creates a new file entry
|
|
352
273
|
* @param fileEntry
|
|
353
274
|
* @deprecated Use `createFileEntryByUuid` instead.
|
|
354
275
|
*/
|
|
355
|
-
|
|
276
|
+
createFileEntry(fileEntry, resourcesToken) {
|
|
356
277
|
return this.client.post('/storage/file', {
|
|
357
278
|
file: {
|
|
358
279
|
fileId: fileEntry.id,
|
|
@@ -365,41 +286,43 @@ var Storage = /** @class */ (function () {
|
|
|
365
286
|
encrypt_version: fileEntry.encrypt_version,
|
|
366
287
|
},
|
|
367
288
|
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
368
|
-
}
|
|
289
|
+
}
|
|
369
290
|
/**
|
|
370
291
|
* Creates a new file entry
|
|
371
292
|
* @param fileEntry
|
|
372
293
|
*/
|
|
373
|
-
|
|
294
|
+
createFileEntryByUuid(fileEntry, resourcesToken) {
|
|
374
295
|
return this.client.post('/files', fileEntry, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
375
|
-
}
|
|
296
|
+
}
|
|
376
297
|
/**
|
|
377
298
|
* Creates a new thumbnail entry
|
|
378
299
|
* @param thumbnailEntry
|
|
379
300
|
*/
|
|
380
|
-
|
|
301
|
+
createThumbnailEntry(thumbnailEntry, resourcesToken) {
|
|
381
302
|
return this.client.post('/storage/thumbnail', {
|
|
382
303
|
thumbnail: thumbnailEntry,
|
|
383
304
|
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
384
|
-
}
|
|
305
|
+
}
|
|
385
306
|
/**
|
|
386
307
|
* Creates a new thumbnail entry using drive-server-wip
|
|
387
308
|
* @param CreateThumbnailEntryPayload
|
|
388
309
|
*/
|
|
389
|
-
|
|
390
|
-
return this.client.post('/files/thumbnail',
|
|
391
|
-
|
|
310
|
+
createThumbnailEntryWithUUID(thumbnailEntry, resourcesToken) {
|
|
311
|
+
return this.client.post('/files/thumbnail', {
|
|
312
|
+
...thumbnailEntry,
|
|
313
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
314
|
+
}
|
|
392
315
|
/**
|
|
393
316
|
* Updates the details of a file entry
|
|
394
317
|
* @param payload
|
|
395
318
|
*/
|
|
396
|
-
|
|
397
|
-
return this.client.post(
|
|
319
|
+
updateFile(payload, resourcesToken) {
|
|
320
|
+
return this.client.post(`/storage/file/${payload.fileId}/meta`, {
|
|
398
321
|
metadata: payload.metadata,
|
|
399
322
|
bucketId: payload.bucketId,
|
|
400
323
|
relativePath: payload.destinationPath,
|
|
401
324
|
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
402
|
-
}
|
|
325
|
+
}
|
|
403
326
|
/**
|
|
404
327
|
* Updates the name of a file with the given UUID.
|
|
405
328
|
*
|
|
@@ -409,12 +332,12 @@ var Storage = /** @class */ (function () {
|
|
|
409
332
|
* @param {string} [resourcesToken] - The token for accessing resources.
|
|
410
333
|
* @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
|
|
411
334
|
*/
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
return this.client.put(
|
|
335
|
+
updateFileNameWithUUID(payload, resourcesToken) {
|
|
336
|
+
const { fileUuid, name } = payload;
|
|
337
|
+
return this.client.put(`/files/${fileUuid}/meta`, {
|
|
415
338
|
plainName: name,
|
|
416
339
|
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
417
|
-
}
|
|
340
|
+
}
|
|
418
341
|
/**
|
|
419
342
|
* Updates the name and the type from a given file UUID.
|
|
420
343
|
*
|
|
@@ -425,124 +348,116 @@ var Storage = /** @class */ (function () {
|
|
|
425
348
|
* @param {string} [resourcesToken] - The token for accessing resources.
|
|
426
349
|
* @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
|
|
427
350
|
*/
|
|
428
|
-
|
|
429
|
-
return this.client.put(
|
|
430
|
-
}
|
|
351
|
+
updateFileMetaByUUID(fileUuid, payload, resourcesToken) {
|
|
352
|
+
return this.client.put(`/files/${fileUuid}/meta`, payload, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
353
|
+
}
|
|
431
354
|
/**
|
|
432
355
|
* Deletes a specific file entry
|
|
433
356
|
* @param payload
|
|
434
357
|
* @deprecated Use `deleteFileByUuid` instead.
|
|
435
358
|
*/
|
|
436
|
-
|
|
437
|
-
return this.client.delete(
|
|
438
|
-
}
|
|
359
|
+
deleteFile(payload) {
|
|
360
|
+
return this.client.delete(`/storage/folder/${payload.folderId}/file/${payload.fileId}`, this.headers());
|
|
361
|
+
}
|
|
439
362
|
/**
|
|
440
363
|
* Deletes a file from the storage system using its unique identifier (UUID).
|
|
441
364
|
*
|
|
442
365
|
* @param fileId - The UUID of the file to be deleted.
|
|
443
366
|
* @returns A promise that resolves with the response of the delete operation.
|
|
444
367
|
*/
|
|
445
|
-
|
|
446
|
-
return this.client.delete(
|
|
447
|
-
}
|
|
368
|
+
deleteFileByUuid(fileId) {
|
|
369
|
+
return this.client.delete(`/files/${fileId}`, this.headers());
|
|
370
|
+
}
|
|
448
371
|
/**
|
|
449
372
|
* Updates the persisted path of a file entry
|
|
450
373
|
* @param payload
|
|
451
374
|
* @deprecated Use `moveFileByUuid` instead.
|
|
452
375
|
*/
|
|
453
|
-
|
|
376
|
+
moveFile(payload) {
|
|
454
377
|
return this.client.post('/storage/move/file', {
|
|
455
378
|
fileId: payload.fileId,
|
|
456
379
|
destination: payload.destination,
|
|
457
380
|
relativePath: payload.destinationPath,
|
|
458
381
|
bucketId: payload.bucketId,
|
|
459
382
|
}, this.headers());
|
|
460
|
-
}
|
|
383
|
+
}
|
|
461
384
|
/**
|
|
462
385
|
* Moves a specific file to a new location
|
|
463
386
|
* @param payload
|
|
464
387
|
*/
|
|
465
|
-
|
|
466
|
-
return
|
|
467
|
-
|
|
468
|
-
return [2 /*return*/, this.client.patch("/files/".concat(uuid), payload, this.headers())];
|
|
469
|
-
});
|
|
470
|
-
});
|
|
471
|
-
};
|
|
388
|
+
async moveFileByUuid(uuid, payload) {
|
|
389
|
+
return this.client.patch(`/files/${uuid}`, payload, this.headers());
|
|
390
|
+
}
|
|
472
391
|
/**
|
|
473
392
|
* Returns a list of the n most recent files
|
|
474
393
|
* @param limit
|
|
475
394
|
* @deprecated use `getRecentFilesV2` call instead.
|
|
476
395
|
*/
|
|
477
|
-
|
|
478
|
-
return this.client.get(
|
|
479
|
-
}
|
|
396
|
+
getRecentFiles(limit) {
|
|
397
|
+
return this.client.get(`/storage/recents?limit=${limit}`, this.headers());
|
|
398
|
+
}
|
|
480
399
|
/**
|
|
481
400
|
* Returns a list of the n most recent files
|
|
482
401
|
* @param limit
|
|
483
402
|
*/
|
|
484
|
-
|
|
485
|
-
return
|
|
486
|
-
|
|
487
|
-
return [2 /*return*/, this.client.get("/files/recents?limit=".concat(limit), this.headers())];
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
};
|
|
403
|
+
async getRecentFilesV2(limit) {
|
|
404
|
+
return this.client.get(`/files/recents?limit=${limit}`, this.headers());
|
|
405
|
+
}
|
|
491
406
|
/**
|
|
492
407
|
* Returns a list of items in trash
|
|
493
408
|
*/
|
|
494
|
-
|
|
495
|
-
|
|
409
|
+
getTrash() {
|
|
410
|
+
const { promise, requestCanceler } = this.client.getCancellable('/storage/trash', this.headers());
|
|
496
411
|
return [promise, requestCanceler];
|
|
497
|
-
}
|
|
412
|
+
}
|
|
498
413
|
/**
|
|
499
414
|
* Add Items to Trash
|
|
500
415
|
* @param payload
|
|
501
416
|
*/
|
|
502
|
-
|
|
417
|
+
addItemsToTrash(payload) {
|
|
503
418
|
return this.client.post('/storage/trash/add', {
|
|
504
419
|
items: payload.items,
|
|
505
420
|
}, this.headers());
|
|
506
|
-
}
|
|
421
|
+
}
|
|
507
422
|
/**
|
|
508
423
|
* @returns whether the user has uploaded any files
|
|
509
424
|
*/
|
|
510
|
-
|
|
425
|
+
hasUploadedFiles() {
|
|
511
426
|
return this.client.get('/users/me/upload-status', this.headers());
|
|
512
|
-
}
|
|
427
|
+
}
|
|
513
428
|
/**
|
|
514
429
|
* Returns a list of the n most recent files
|
|
515
430
|
* @param limit
|
|
516
431
|
*/
|
|
517
|
-
|
|
518
|
-
return this.client.post('/users/search', { plain_name
|
|
519
|
-
}
|
|
432
|
+
searchItemsByName(plain_name) {
|
|
433
|
+
return this.client.post('/users/search', { plain_name }, this.headers());
|
|
434
|
+
}
|
|
520
435
|
/**
|
|
521
436
|
* Returns the current space usage of the user
|
|
522
437
|
* @deprecated use `spaceUsageV2` call instead.
|
|
523
438
|
*/
|
|
524
|
-
|
|
439
|
+
spaceUsage() {
|
|
525
440
|
return this.client.get('/usage', this.headers());
|
|
526
|
-
}
|
|
441
|
+
}
|
|
527
442
|
/**
|
|
528
443
|
* Returns the current space usage of the user
|
|
529
444
|
*/
|
|
530
|
-
|
|
445
|
+
spaceUsageV2() {
|
|
531
446
|
return this.client.get('/users/usage', this.headers());
|
|
532
|
-
}
|
|
447
|
+
}
|
|
533
448
|
/**
|
|
534
449
|
* Returns the current space limit for the user
|
|
535
450
|
* @deprecated use `spaceLimitV2` call instead.
|
|
536
451
|
*/
|
|
537
|
-
|
|
452
|
+
spaceLimit() {
|
|
538
453
|
return this.client.get('/limit', this.headers());
|
|
539
|
-
}
|
|
454
|
+
}
|
|
540
455
|
/**
|
|
541
456
|
* Returns the current space limit for the user
|
|
542
457
|
*/
|
|
543
|
-
|
|
458
|
+
spaceLimitV2() {
|
|
544
459
|
return this.client.get('/users/limit', this.headers());
|
|
545
|
-
}
|
|
460
|
+
}
|
|
546
461
|
/**
|
|
547
462
|
* Get global search items.
|
|
548
463
|
*
|
|
@@ -551,26 +466,29 @@ var Storage = /** @class */ (function () {
|
|
|
551
466
|
* @param {number} offset - The position of the first item to return (optional).
|
|
552
467
|
* @returns {[Promise<SearchResultData>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
553
468
|
*/
|
|
554
|
-
|
|
555
|
-
|
|
469
|
+
getGlobalSearchItems(search, workspaceId, offset) {
|
|
470
|
+
const query = new URLSearchParams();
|
|
556
471
|
if (offset !== undefined)
|
|
557
472
|
query.set('offset', String(offset));
|
|
558
|
-
|
|
559
|
-
? this.client.getCancellable(
|
|
560
|
-
: this.client.getCancellable(
|
|
473
|
+
const { promise, requestCanceler } = workspaceId
|
|
474
|
+
? this.client.getCancellable(`workspaces/${workspaceId}/fuzzy/${search}?${query}`, this.headers())
|
|
475
|
+
: this.client.getCancellable(`fuzzy/${search}?${query}`, this.headers());
|
|
561
476
|
return [promise, requestCanceler];
|
|
562
|
-
}
|
|
477
|
+
}
|
|
563
478
|
/**
|
|
564
479
|
* Returns the needed headers for the module requests
|
|
565
480
|
* @private
|
|
566
481
|
*/
|
|
567
|
-
|
|
568
|
-
|
|
482
|
+
headers(customHeaders) {
|
|
483
|
+
let customExtraHeaders = {};
|
|
569
484
|
if (customHeaders) {
|
|
570
485
|
customExtraHeaders = customHeaders;
|
|
571
486
|
}
|
|
572
487
|
if (this.appDetails.customHeaders) {
|
|
573
|
-
customExtraHeaders =
|
|
488
|
+
customExtraHeaders = {
|
|
489
|
+
...customExtraHeaders,
|
|
490
|
+
...this.appDetails.customHeaders,
|
|
491
|
+
};
|
|
574
492
|
}
|
|
575
493
|
return (0, headers_1.headersWithToken)({
|
|
576
494
|
clientName: this.appDetails.clientName,
|
|
@@ -580,16 +498,16 @@ var Storage = /** @class */ (function () {
|
|
|
580
498
|
desktopToken: this.appDetails.desktopHeader,
|
|
581
499
|
customHeaders: customExtraHeaders,
|
|
582
500
|
});
|
|
583
|
-
}
|
|
501
|
+
}
|
|
584
502
|
/**
|
|
585
503
|
* Gets the ancestors of a given folder UUID
|
|
586
504
|
*
|
|
587
505
|
* @param {string} uuid - UUID of the folder.
|
|
588
506
|
* @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
|
|
589
507
|
*/
|
|
590
|
-
|
|
591
|
-
return this.client.get(
|
|
592
|
-
}
|
|
508
|
+
getFolderAncestors(uuid) {
|
|
509
|
+
return this.client.get(`folders/${uuid}/ancestors`, this.headers());
|
|
510
|
+
}
|
|
593
511
|
/**
|
|
594
512
|
* Gets the ancestors of an item with the given UUID and type in a Workspace
|
|
595
513
|
*
|
|
@@ -598,41 +516,41 @@ var Storage = /** @class */ (function () {
|
|
|
598
516
|
* @param {string} uuid - UUID of the item.
|
|
599
517
|
* @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
|
|
600
518
|
*/
|
|
601
|
-
|
|
602
|
-
return this.client.get(
|
|
603
|
-
}
|
|
519
|
+
getFolderAncestorsInWorkspace(workspaceId, itemType, uuid, resourcesToken) {
|
|
520
|
+
return this.client.get(`workspaces/${workspaceId}/${itemType}/${uuid}/ancestors`, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
521
|
+
}
|
|
604
522
|
/**
|
|
605
523
|
* Gets the meta of a given folder UUID
|
|
606
524
|
*
|
|
607
525
|
* @param {string} folderUUID - UUID of the folder.
|
|
608
526
|
* @returns {Promise<FolderMeta>}
|
|
609
527
|
*/
|
|
610
|
-
|
|
611
|
-
|
|
528
|
+
getFolderMeta(uuid, workspacesToken, resourcesToken) {
|
|
529
|
+
const customHeaders = workspacesToken
|
|
612
530
|
? {
|
|
613
531
|
'x-internxt-workspace': workspacesToken,
|
|
614
532
|
}
|
|
615
533
|
: undefined;
|
|
616
|
-
return this.client.get(
|
|
617
|
-
}
|
|
534
|
+
return this.client.get(`folders/${uuid}/meta`, (0, headers_1.addResourcesTokenToHeaders)(this.headers(customHeaders), resourcesToken));
|
|
535
|
+
}
|
|
618
536
|
/**
|
|
619
537
|
* Gets the stats of a given folder UUID
|
|
620
538
|
*
|
|
621
539
|
* @param {string} uuid - UUID of the folder.
|
|
622
540
|
* @returns {Promise<FolderStatsResponse>}
|
|
623
541
|
*/
|
|
624
|
-
|
|
625
|
-
return this.client.get(
|
|
626
|
-
}
|
|
542
|
+
getFolderStats(uuid) {
|
|
543
|
+
return this.client.get(`folders/${uuid}/stats`, this.headers());
|
|
544
|
+
}
|
|
627
545
|
/**
|
|
628
546
|
* Gets the meta of a given folder Id
|
|
629
547
|
*
|
|
630
548
|
* @param {number} folderId - Id of the folder.
|
|
631
549
|
* @returns {Promise<FolderMeta>}
|
|
632
550
|
*/
|
|
633
|
-
|
|
634
|
-
return this.client.get(
|
|
635
|
-
}
|
|
551
|
+
getFolderMetaById(folderId) {
|
|
552
|
+
return this.client.get(`folders/${folderId}/metadata`, this.headers());
|
|
553
|
+
}
|
|
636
554
|
/**
|
|
637
555
|
* Replaces a file with a new one.
|
|
638
556
|
*
|
|
@@ -640,86 +558,80 @@ var Storage = /** @class */ (function () {
|
|
|
640
558
|
* @param {ReplaceFile} payload
|
|
641
559
|
* @returns {Promise<DriveFileData>} - The replaced file data.
|
|
642
560
|
*/
|
|
643
|
-
|
|
644
|
-
return this.client.put(
|
|
645
|
-
}
|
|
561
|
+
replaceFile(uuid, payload) {
|
|
562
|
+
return this.client.put(`/files/${uuid}`, { ...payload }, this.headers());
|
|
563
|
+
}
|
|
646
564
|
/**
|
|
647
565
|
* Checks the size limit for a file.
|
|
648
566
|
*
|
|
649
567
|
* @param {number} size - The size of the file to check.
|
|
650
568
|
* @return {Promise<void>} - A promise that resolves when the size limit check is complete.
|
|
651
569
|
*/
|
|
652
|
-
|
|
653
|
-
return
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}, this.headers())];
|
|
660
|
-
});
|
|
661
|
-
});
|
|
662
|
-
};
|
|
570
|
+
async checkSizeLimit(size) {
|
|
571
|
+
return this.client.post('/files/check-size-limit', {
|
|
572
|
+
file: {
|
|
573
|
+
size,
|
|
574
|
+
},
|
|
575
|
+
}, this.headers());
|
|
576
|
+
}
|
|
663
577
|
/**
|
|
664
578
|
* Retrieves the folder tree based on the UUID.
|
|
665
579
|
*
|
|
666
580
|
* @param {string} uuid - The UUID of the folder.
|
|
667
581
|
* @return {Promise<FolderTreeResponse>} The promise containing the folder tree response.
|
|
668
582
|
*/
|
|
669
|
-
|
|
670
|
-
return this.client.get(
|
|
671
|
-
}
|
|
583
|
+
getFolderTree(uuid) {
|
|
584
|
+
return this.client.get(`/folders/${uuid}/tree`, this.headers());
|
|
585
|
+
}
|
|
672
586
|
/**
|
|
673
587
|
* Checks if the given files already exist in the given folder.
|
|
674
588
|
*
|
|
675
589
|
* @param {CheckDuplicatedFilesPayload} payload - Payload containing the folder UUID and the list of files to check.
|
|
676
590
|
* @return {Promise<CheckDuplicatedFilesResponse>} - Promise that contains the duplicated files in a list.
|
|
677
591
|
*/
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return this.client.post("/folders/content/".concat(folderUuid, "/files/existence"), {
|
|
592
|
+
checkDuplicatedFiles({ folderUuid, filesList, }) {
|
|
593
|
+
return this.client.post(`/folders/content/${folderUuid}/files/existence`, {
|
|
681
594
|
files: filesList,
|
|
682
595
|
}, this.headers());
|
|
683
|
-
}
|
|
596
|
+
}
|
|
684
597
|
/**
|
|
685
598
|
* Checks if the given folders names already exist in the given folder
|
|
686
599
|
*
|
|
687
600
|
* @param {CheckDuplicatedFolderPayload} payload - Payload containing the folder UUID and the list of folders to check.
|
|
688
601
|
* @return {Promise<CheckDuplicatedFoldersResponse>} - Promise that contains the duplicated folders in a list.
|
|
689
602
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return this.client.post("/folders/content/".concat(folderUuid, "/folders/existence"), {
|
|
603
|
+
checkDuplicatedFolders({ folderUuid, folderNamesList, }) {
|
|
604
|
+
return this.client.post(`/folders/content/${folderUuid}/folders/existence`, {
|
|
693
605
|
plainNames: folderNamesList,
|
|
694
606
|
}, this.headers());
|
|
695
|
-
}
|
|
607
|
+
}
|
|
696
608
|
/**
|
|
697
609
|
* Gets the folder meta from a given path (e.g. "/folder1/folder2")
|
|
698
610
|
*
|
|
699
611
|
* @param {string} folderPath - The path of the folder.
|
|
700
612
|
* @returns {Promise<FolderMeta>} A promise that resolves the folder on that path.
|
|
701
613
|
*/
|
|
702
|
-
|
|
703
|
-
return this.client.get(
|
|
704
|
-
}
|
|
614
|
+
getFolderByPath(folderPath) {
|
|
615
|
+
return this.client.get(`folders/meta?path=${folderPath}`, this.headers());
|
|
616
|
+
}
|
|
705
617
|
/**
|
|
706
618
|
* Gets the file meta from a given path (e.g. "/folder1/folder2/file.png")
|
|
707
619
|
*
|
|
708
620
|
* @param {string} filePath - The path of the file.
|
|
709
621
|
* @returns {Promise<FileMeta>} A promise that resolves the file on that path.
|
|
710
622
|
*/
|
|
711
|
-
|
|
712
|
-
return this.client.get(
|
|
713
|
-
}
|
|
623
|
+
getFileByPath(filePath) {
|
|
624
|
+
return this.client.get(`files/meta?path=${filePath}`, this.headers());
|
|
625
|
+
}
|
|
714
626
|
/**
|
|
715
627
|
* Gets all versions of a file
|
|
716
628
|
*
|
|
717
629
|
* @param {string} uuid - The UUID of the file.
|
|
718
630
|
* @returns {Promise<FileVersion[]>} A promise that resolves with an array of file versions.
|
|
719
631
|
*/
|
|
720
|
-
|
|
721
|
-
return this.client.get(
|
|
722
|
-
}
|
|
632
|
+
getFileVersions(uuid) {
|
|
633
|
+
return this.client.get(`/files/${uuid}/versions`, this.headers());
|
|
634
|
+
}
|
|
723
635
|
/**
|
|
724
636
|
* Deletes a specific version of a file
|
|
725
637
|
*
|
|
@@ -727,9 +639,9 @@ var Storage = /** @class */ (function () {
|
|
|
727
639
|
* @param {string} versionId - The UUID of the version to delete.
|
|
728
640
|
* @returns {Promise<void>} A promise that resolves when the version is deleted.
|
|
729
641
|
*/
|
|
730
|
-
|
|
731
|
-
return this.client.delete(
|
|
732
|
-
}
|
|
642
|
+
deleteFileVersion(uuid, versionId) {
|
|
643
|
+
return this.client.delete(`/files/${uuid}/versions/${versionId}`, this.headers());
|
|
644
|
+
}
|
|
733
645
|
/**
|
|
734
646
|
* Restores a file to a specific version
|
|
735
647
|
*
|
|
@@ -737,17 +649,16 @@ var Storage = /** @class */ (function () {
|
|
|
737
649
|
* @param {string} versionId - The UUID of the version to restore.
|
|
738
650
|
* @returns {Promise<RestoreFileVersionResponse>} A promise that resolves with the restored file.
|
|
739
651
|
*/
|
|
740
|
-
|
|
741
|
-
return this.client.post(
|
|
742
|
-
}
|
|
652
|
+
restoreFileVersion(uuid, versionId) {
|
|
653
|
+
return this.client.post(`/files/${uuid}/versions/${versionId}/restore`, {}, this.headers());
|
|
654
|
+
}
|
|
743
655
|
/**
|
|
744
656
|
* Gets the file version limits for the user
|
|
745
657
|
*
|
|
746
658
|
* @returns {Promise<FileLimitsResponse>} A promise that resolves with the file limits.
|
|
747
659
|
*/
|
|
748
|
-
|
|
660
|
+
getFileVersionLimits() {
|
|
749
661
|
return this.client.get('/files/limits', this.headers());
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
}());
|
|
662
|
+
}
|
|
663
|
+
}
|
|
753
664
|
exports.Storage = Storage;
|