@internxt/sdk 1.4.76 → 1.4.77
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.d.ts +42 -1
- package/dist/auth/index.js +82 -5
- package/dist/auth/types.d.ts +11 -0
- package/dist/drive/payments/index.d.ts +16 -3
- package/dist/drive/payments/index.js +66 -4
- package/dist/drive/payments/types.d.ts +10 -0
- package/dist/drive/referrals/index.js +2 -3
- package/dist/drive/share/index.d.ts +246 -1
- package/dist/drive/share/index.js +386 -3
- package/dist/drive/share/types.d.ts +280 -0
- package/dist/drive/storage/index.d.ts +107 -5
- package/dist/drive/storage/index.js +198 -7
- package/dist/drive/storage/types.d.ts +221 -1
- package/dist/drive/storage/types.js +7 -1
- package/dist/drive/trash/index.d.ts +13 -2
- package/dist/drive/trash/index.js +18 -1
- package/dist/drive/trash/types.d.ts +2 -1
- package/dist/drive/users/index.d.ts +44 -3
- package/dist/drive/users/index.js +53 -2
- package/dist/drive/users/types.d.ts +23 -1
- package/dist/shared/headers/index.d.ts +13 -40
- package/dist/shared/headers/index.js +12 -14
- package/dist/shared/http/client.d.ts +7 -0
- package/dist/shared/http/client.js +16 -1
- package/dist/shared/types/apiConnection.d.ts +0 -1
- package/package.json +1 -7
|
@@ -1,4 +1,15 @@
|
|
|
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
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -18,6 +29,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
29
|
__setModuleDefault(result, mod);
|
|
19
30
|
return result;
|
|
20
31
|
};
|
|
32
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
+
function step(op) {
|
|
46
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
+
while (_) try {
|
|
48
|
+
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;
|
|
49
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
+
switch (op[0]) {
|
|
51
|
+
case 0: case 1: t = op; break;
|
|
52
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
+
default:
|
|
56
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
+
if (t[2]) _.ops.pop();
|
|
61
|
+
_.trys.pop(); continue;
|
|
62
|
+
}
|
|
63
|
+
op = body.call(thisArg, _);
|
|
64
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
21
68
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
22
69
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
23
70
|
if (ar || !(i in from)) {
|
|
@@ -114,6 +161,9 @@ var Share = /** @class */ (function () {
|
|
|
114
161
|
}
|
|
115
162
|
return this.client.get("/storage/share/down/" + payload.type + "s?token=" + payload.token + "&folderId=" + payload.folderId + "&parentId=" + payload.parentId + "&page=" + payload.page + "&perPage=" + payload.perPage + (payload.code ? '&code=' + payload.code : ''), headers);
|
|
116
163
|
};
|
|
164
|
+
Share.prototype.getShareDomains = function () {
|
|
165
|
+
return this.client.get('/storage/share/domains', this.headers());
|
|
166
|
+
};
|
|
117
167
|
/**
|
|
118
168
|
* Get size of folder in share links
|
|
119
169
|
* @param payload
|
|
@@ -121,6 +171,318 @@ var Share = /** @class */ (function () {
|
|
|
121
171
|
Share.prototype.getShareLinkFolderSize = function (payload) {
|
|
122
172
|
return this.client.get("/storage/share/" + payload.itemId + "/folder/" + payload.folderId + "/size", this.basicHeaders());
|
|
123
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Fetches all folders shared by a user.
|
|
176
|
+
*
|
|
177
|
+
* @param {number} page - The page number for pagination.
|
|
178
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
179
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
180
|
+
* @returns {Promise<ListPrivateSharedFoldersResponse>} A promise containing the list of shared folders.
|
|
181
|
+
*/
|
|
182
|
+
Share.prototype.getSentSharedFolders = function (page, perPage, orderBy) {
|
|
183
|
+
if (page === void 0) { page = 0; }
|
|
184
|
+
if (perPage === void 0) { perPage = 50; }
|
|
185
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
186
|
+
return this.client.get("sharings/shared-by-me/folders?page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Fetches folders shared with a user.
|
|
190
|
+
*
|
|
191
|
+
* @param {number} page - The page number for pagination.
|
|
192
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
193
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
194
|
+
* @returns {Promise<ListPrivateSharedFoldersResponse>} A promise containing the list of shared folders.
|
|
195
|
+
*/
|
|
196
|
+
Share.prototype.getReceivedSharedFolders = function (page, perPage, orderBy) {
|
|
197
|
+
if (page === void 0) { page = 0; }
|
|
198
|
+
if (perPage === void 0) { perPage = 50; }
|
|
199
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
200
|
+
return this.client.get("sharings/shared-with-me/folders?page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Fetches all shared folders.
|
|
204
|
+
*
|
|
205
|
+
* @param {number} page - The page number for pagination.
|
|
206
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
207
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
208
|
+
* @returns {Promise<ListAllSharedFoldersResponse>} A promise containing the list of shared folders.
|
|
209
|
+
*/
|
|
210
|
+
Share.prototype.getAllSharedFolders = function (page, perPage, orderBy) {
|
|
211
|
+
if (page === void 0) { page = 0; }
|
|
212
|
+
if (perPage === void 0) { perPage = 50; }
|
|
213
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
214
|
+
return this.client.get("sharings/folders?page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Fetches all shared files.
|
|
218
|
+
*
|
|
219
|
+
* @param {number} page - The page number for pagination.
|
|
220
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
221
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
222
|
+
* @returns {Promise<ListAllSharedFoldersResponse>} A promise containing the list of shared folders.
|
|
223
|
+
*/
|
|
224
|
+
Share.prototype.getAllSharedFiles = function (page, perPage, orderBy) {
|
|
225
|
+
if (page === void 0) { page = 0; }
|
|
226
|
+
if (perPage === void 0) { perPage = 50; }
|
|
227
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
228
|
+
return this.client.get("sharings/files?page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Get all users with access to a shared folder.
|
|
232
|
+
*
|
|
233
|
+
* @param {string} folderUUID - The UUID of the folder.
|
|
234
|
+
* @param {number} page - The page number for pagination.
|
|
235
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
236
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
237
|
+
* @returns {Promise<{ users: SharedFolderUser[] }>} A promise containing the list of users with access to the folder.
|
|
238
|
+
*/
|
|
239
|
+
Share.prototype.getSharedFolderUsers = function (folderUUID, page, perPage, orderBy) {
|
|
240
|
+
if (page === void 0) { page = 0; }
|
|
241
|
+
if (perPage === void 0) { perPage = 50; }
|
|
242
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
243
|
+
return this.client.get("sharings/shared-with/" + folderUUID + "?page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Get shared folder content
|
|
247
|
+
* @param {string} sharedFolderId - The UUID of the shared folder.
|
|
248
|
+
* @param {string} type - The item type for the query folders/files
|
|
249
|
+
* @param {string} token - Key that enables invited users to navigate the folders
|
|
250
|
+
* @param {number} page - The page number for pagination.
|
|
251
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
252
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
253
|
+
*/
|
|
254
|
+
Share.prototype.getSharedFolderContent = function (sharedFolderId, type, token, page, perPage, orderBy) {
|
|
255
|
+
if (page === void 0) { page = 0; }
|
|
256
|
+
if (perPage === void 0) { perPage = 50; }
|
|
257
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
258
|
+
return this.client.get("sharings/items/" + sharedFolderId + "/" + type + "?token=" + token + "&page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Get public shared folder content
|
|
262
|
+
* @param {string} sharedFolderId - The UUID of the shared folder.
|
|
263
|
+
* @param {string} type - The item type for the query folders/files
|
|
264
|
+
* @param {string} token - Key that enables invited users to navigate the folders
|
|
265
|
+
* @param {number} page - The page number for pagination.
|
|
266
|
+
* @param {number} perPage - The number of items per page for pagination.
|
|
267
|
+
* @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
|
|
268
|
+
*/
|
|
269
|
+
Share.prototype.getPublicSharedFolderContent = function (sharedFolderId, type, token, page, perPage, code, orderBy) {
|
|
270
|
+
if (page === void 0) { page = 0; }
|
|
271
|
+
if (perPage === void 0) { perPage = 50; }
|
|
272
|
+
if (code === void 0) { code = ''; }
|
|
273
|
+
var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
|
|
274
|
+
return this.client.get(
|
|
275
|
+
// eslint-disable-next-line max-len
|
|
276
|
+
"sharings/public/items/" + sharedFolderId + "/" + type + "?token=" + token + "&code=" + code + "&page=" + page + "&perPage=" + perPage + orderByQueryParam, this.headers());
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Get the role of a user on a folder.
|
|
280
|
+
*
|
|
281
|
+
* @param {string} options.sharingId - The unique identifier of the sharing.
|
|
282
|
+
* @returns {Promise<Role>} A promise containing the role of the current user in the sharing.
|
|
283
|
+
*/
|
|
284
|
+
Share.prototype.getUserRole = function (sharingId) {
|
|
285
|
+
return this.client.get("sharings/" + sharingId + "/role", this.headers());
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Update the role of a user on a folder.
|
|
289
|
+
*
|
|
290
|
+
* @param {UpdateUserRolePayload} options - The options for updating the user's role on the folder.
|
|
291
|
+
* @param {string} options.sharingId - The unique identifier of the user to whom we will update the role.
|
|
292
|
+
* @param {string} options.newRoleId - The new role Id.
|
|
293
|
+
* @returns {Promise<UpdateRoleFolderResponse>} A promise that resolves when the user's role is updated.
|
|
294
|
+
*/
|
|
295
|
+
Share.prototype.updateUserRole = function (_a) {
|
|
296
|
+
var sharingId = _a.sharingId, newRoleId = _a.newRoleId;
|
|
297
|
+
return this.client.put("sharings/" + sharingId + "/role", {
|
|
298
|
+
roleId: newRoleId,
|
|
299
|
+
}, this.headers());
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Remove user from shared folder.
|
|
303
|
+
*
|
|
304
|
+
* @param {UpdateUserRolePayload} options - The options for updating the user's role on the folder.
|
|
305
|
+
* @param {string} options.itemType - The unique identifier of the folder.
|
|
306
|
+
* @param {string} options.itemId - The identifier of the role to assign to the user.
|
|
307
|
+
* @param {string} options.userId - The role Id how we want to delete.
|
|
308
|
+
* @returns {Promise<UpdateRoleFolderResponse>} A promise that resolves when the user's role is updated.
|
|
309
|
+
*/
|
|
310
|
+
Share.prototype.removeUserRole = function (_a) {
|
|
311
|
+
var itemType = _a.itemType, itemId = _a.itemId, userId = _a.userId;
|
|
312
|
+
return this.client.delete("sharings/" + itemType + "/" + itemId + "/users/" + userId, this.headers());
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Get private folder data.
|
|
316
|
+
*
|
|
317
|
+
* @param {string} itemId - The itemId of the folder.
|
|
318
|
+
* @param {string} itemType - The itemType of the folder (file | folder).
|
|
319
|
+
* @returns {Promise<{ data: SharingInvite[] }>} A promise containing the private folder data.
|
|
320
|
+
*/
|
|
321
|
+
Share.prototype.getSharedFolderInvitations = function (_a) {
|
|
322
|
+
var itemId = _a.itemId, itemType = _a.itemType;
|
|
323
|
+
return this.client.get("sharings/" + itemType + "/" + itemId + "/invites", this.headers());
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Get all invitations for a user.
|
|
327
|
+
* @param limit - The number of items per page for pagination.
|
|
328
|
+
* @param offset - The page number for pagination.
|
|
329
|
+
* @returns {Promise<invites: any>} A promise containing the list of invitations.
|
|
330
|
+
*/
|
|
331
|
+
Share.prototype.getSharedFolderInvitationsAsInvitedUser = function (_a) {
|
|
332
|
+
var limit = _a.limit, offset = _a.offset;
|
|
333
|
+
return this.client.get("sharings/invites?limit=" + limit + "&offset=" + offset, this.headers());
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Share a private folder with a user.
|
|
337
|
+
*
|
|
338
|
+
* @param {ShareFolderWithUserPayload} options - The options for sharing the private folder with a user.
|
|
339
|
+
* @param {string} options.itemId - The id of the item to share.
|
|
340
|
+
* @param {string} options.itemType - The type of the item to share (folder | file).
|
|
341
|
+
* @param {string} options.sharedWith - The email address of the user to share the folder with.
|
|
342
|
+
* @param {string} options.encryptionKey - Owner\'s encryption key encrypted with the invited user\'s public key. This field should not be empty if the invitation type is "OWNER".
|
|
343
|
+
* @param {string} options.encryptionAlgorithm - Encryption algorithm used to encrypt the encryption key. This field should not be empty if the invitation type is "OWNER".
|
|
344
|
+
* @param {string} options.type - Owner's encryption key encrypted with the invited user's public key.
|
|
345
|
+
* @param {string} options.roleId - The id of the role to assign to the user.
|
|
346
|
+
* @param {string} options.notifyUser - If it has to notify the users
|
|
347
|
+
* @param {string} options.notificationMessage - Message of the notificacion
|
|
348
|
+
*
|
|
349
|
+
*
|
|
350
|
+
* @returns {Promise<SharingInvite>} A promise that resolves when the folder is shared with the user.
|
|
351
|
+
*/
|
|
352
|
+
Share.prototype.inviteUserToSharedFolder = function (createInviteDto) {
|
|
353
|
+
return this.client.post('sharings/invites/send', __assign(__assign({}, createInviteDto), { type: 'OWNER' }), this.headers());
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Create a sharing.
|
|
357
|
+
*/
|
|
358
|
+
Share.prototype.createSharing = function (createSharingPayload) {
|
|
359
|
+
return this.client.post('sharings', __assign({}, createSharingPayload), this.headers());
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Get sharing meta with code
|
|
363
|
+
*/
|
|
364
|
+
Share.prototype.getSharingMeta = function (sharingId, code, password) {
|
|
365
|
+
var extraHeaders = password ? { 'x-share-password': password } : {};
|
|
366
|
+
return this.client.get("sharings/" + sharingId + "/meta?code=" + code, __assign(__assign({}, this.headers()), extraHeaders));
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Add/edit sharing Password
|
|
370
|
+
* @param {string} sharingId - id of sharing.
|
|
371
|
+
* @param {string} encryptedPassword - password encrypted with CODE as key
|
|
372
|
+
* @returns {Promise<SharingMeta>} A promise that returns the sharing info with the new encrypted password
|
|
373
|
+
*/
|
|
374
|
+
Share.prototype.saveSharingPassword = function (sharingId, encryptedPassword) {
|
|
375
|
+
return this.client.patch("sharings/" + sharingId + "/password", {
|
|
376
|
+
encryptedPassword: encryptedPassword,
|
|
377
|
+
}, this.headers());
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Remove password protection from sharing
|
|
381
|
+
* @param {string} sharingId - id of sharing.
|
|
382
|
+
* @returns {Promise<void>} A promise that resolves when password was successfully deleted.
|
|
383
|
+
*/
|
|
384
|
+
Share.prototype.removeSharingPassword = function (sharingId) {
|
|
385
|
+
return this.client.delete("sharings/" + sharingId + "/password", this.headers());
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Get public information of the item shared.
|
|
389
|
+
* @param {string} sharingId - id of sharing.
|
|
390
|
+
* @returns {Promise<PublicSharedItemInfo>} A promise that returns data of the public shared item.
|
|
391
|
+
*/
|
|
392
|
+
Share.prototype.getPublicSharedItemInfo = function (sharingId) {
|
|
393
|
+
return this.client.get("sharings/public/" + sharingId + "/item", this.headers());
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Request access to shared folder.
|
|
397
|
+
*/
|
|
398
|
+
Share.prototype.requestUserToSharedFolder = function (createInviteDto) {
|
|
399
|
+
return this.client.post('sharings/invites/send', __assign(__assign({}, createInviteDto), { type: 'SELF' }), this.headers());
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Check if the expirationDate of invite is valid.
|
|
403
|
+
* @param {string} invitationId - The id of the invitation.
|
|
404
|
+
|
|
405
|
+
* @returns {Promise<{uuid: string}>} A promise returning the uuid of the invitation if valid.
|
|
406
|
+
*/
|
|
407
|
+
Share.prototype.validateInviteExpiration = function (invitationId) {
|
|
408
|
+
return this.client.get("sharings/invites/" + invitationId + "/validate", this.headers());
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Share a private folder with a user.
|
|
412
|
+
* @param {string} invitationId - The id of the invitation.
|
|
413
|
+
* @param {ShareFolderWithUserPayload} options - The options for sharing the private folder with a user.
|
|
414
|
+
* @param {string} options.encryptionKey - The encryption key (just in case the invitation is a request).
|
|
415
|
+
* @param {string} options.itemType - The encryption algorithm (just in case the invitation is a request).
|
|
416
|
+
|
|
417
|
+
* @returns {Promise<void>} A promise that resolves when the folder is shared with the user.
|
|
418
|
+
*/
|
|
419
|
+
Share.prototype.acceptSharedFolderInvite = function (_a) {
|
|
420
|
+
var invitationId = _a.invitationId, acceptInvite = _a.acceptInvite, token = _a.token;
|
|
421
|
+
var headers = this.getRequestHeaders(token);
|
|
422
|
+
return this.client.post("sharings/invites/" + invitationId + "/accept", {
|
|
423
|
+
acceptInvite: acceptInvite,
|
|
424
|
+
}, headers);
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* Change Sharing Mode.
|
|
428
|
+
* @param {string} options.itemType - folder | file
|
|
429
|
+
* @param {string} options.itemId - id of folder or file
|
|
430
|
+
* @param {string} options.sharingType - New Sharing type.
|
|
431
|
+
|
|
432
|
+
* @returns {Promise<void>} A promise that resolves when sharing mode has been updated.
|
|
433
|
+
*/
|
|
434
|
+
Share.prototype.updateSharingType = function (_a) {
|
|
435
|
+
var itemId = _a.itemId, itemType = _a.itemType, sharingType = _a.sharingType;
|
|
436
|
+
var headers = this.headers();
|
|
437
|
+
return this.client.put("sharings/" + itemType + "/" + itemId + "/type", {
|
|
438
|
+
sharingType: sharingType,
|
|
439
|
+
}, headers);
|
|
440
|
+
};
|
|
441
|
+
/**
|
|
442
|
+
* Get Sharing type
|
|
443
|
+
* @param {string} options.itemType - folder | file
|
|
444
|
+
* @param {string} options.itemId - id of folder or file
|
|
445
|
+
* @returns {Promise<SharingMeta>} A promise that returns the sharing data.
|
|
446
|
+
*/
|
|
447
|
+
Share.prototype.getSharingType = function (_a) {
|
|
448
|
+
var itemId = _a.itemId, itemType = _a.itemType;
|
|
449
|
+
var headers = this.headers();
|
|
450
|
+
return this.client.get("sharings/" + itemType + "/" + itemId + "/type", headers);
|
|
451
|
+
};
|
|
452
|
+
Share.prototype.declineSharedFolderInvite = function (invitationId, token) {
|
|
453
|
+
var headers = this.getRequestHeaders(token);
|
|
454
|
+
return this.client.delete("sharings/invites/" + invitationId, headers);
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Fetches roles for sharing items.
|
|
458
|
+
*
|
|
459
|
+
* @returns {Promise<PrivateSharingRolesResponse>} A promise containing the list of sharing roles.
|
|
460
|
+
*/
|
|
461
|
+
Share.prototype.getSharingRoles = function () {
|
|
462
|
+
return this.client.get('/sharings/roles', this.headers());
|
|
463
|
+
};
|
|
464
|
+
Share.prototype.getAllAccessUsers = function (_a) {
|
|
465
|
+
var itemType = _a.itemType, folderId = _a.folderId;
|
|
466
|
+
return this.client.get("sharings/shared-with/" + itemType + "/" + folderId, this.headers());
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Stop sharing folder
|
|
470
|
+
* @param {string} itemType - Type of the sharing to delete
|
|
471
|
+
* @param {string} itemId - Id of the sharing to delete
|
|
472
|
+
* @returns
|
|
473
|
+
*/
|
|
474
|
+
Share.prototype.stopSharingFolder = function (itemType, itemId) {
|
|
475
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
476
|
+
return __generator(this, function (_a) {
|
|
477
|
+
switch (_a.label) {
|
|
478
|
+
case 0: return [4 /*yield*/, this.client.delete("sharings/" + itemType + "/" + itemId, this.headers())];
|
|
479
|
+
case 1:
|
|
480
|
+
_a.sent();
|
|
481
|
+
return [2 /*return*/];
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
};
|
|
124
486
|
/**
|
|
125
487
|
* Returns the needed headers for the module requests
|
|
126
488
|
* @private
|
|
@@ -130,12 +492,11 @@ var Share = /** @class */ (function () {
|
|
|
130
492
|
this.appDetails.clientName,
|
|
131
493
|
this.appDetails.clientVersion,
|
|
132
494
|
this.apiSecurity.token,
|
|
133
|
-
this.apiSecurity.mnemonic,
|
|
134
495
|
];
|
|
135
496
|
if (password) {
|
|
136
|
-
return headers_1.
|
|
497
|
+
return headers_1.headersWithTokenAndPassword.apply(void 0, __spreadArray(__spreadArray([], args, false), [password], false));
|
|
137
498
|
}
|
|
138
|
-
return headers_1.
|
|
499
|
+
return headers_1.headersWithToken.apply(void 0, args);
|
|
139
500
|
};
|
|
140
501
|
/**
|
|
141
502
|
* Returns the needed headers for the module requests
|
|
@@ -151,6 +512,28 @@ var Share = /** @class */ (function () {
|
|
|
151
512
|
Share.prototype.basicHeadersWithPassword = function (password) {
|
|
152
513
|
return (0, headers_1.basicHeadersWithPassword)(this.appDetails.clientName, this.appDetails.clientVersion, password);
|
|
153
514
|
};
|
|
515
|
+
/**
|
|
516
|
+
* Get request headers with optional authorization token.
|
|
517
|
+
*
|
|
518
|
+
* @param {string} [token] - Optional authorization token.
|
|
519
|
+
* @returns {Object} - Request headers object.
|
|
520
|
+
*/
|
|
521
|
+
Share.prototype.getRequestHeaders = function (token) {
|
|
522
|
+
var headers = __assign({}, this.headers());
|
|
523
|
+
if (token) {
|
|
524
|
+
headers.Authorization = 'Bearer ' + token;
|
|
525
|
+
}
|
|
526
|
+
return headers;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* Gets the size of a shared folder given sharing id
|
|
530
|
+
*
|
|
531
|
+
* @param {string} sharingId - Sharing ID.
|
|
532
|
+
* @returns {Promise<SharedFolderSize>}
|
|
533
|
+
*/
|
|
534
|
+
Share.prototype.getSharedFolderSize = function (id) {
|
|
535
|
+
return this.client.get("sharings/public/" + id + "/folder/size", this.headers());
|
|
536
|
+
};
|
|
154
537
|
return Share;
|
|
155
538
|
}());
|
|
156
539
|
exports.Share = Share;
|