@internxt/sdk 1.15.14 → 1.16.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 (38) hide show
  1. package/dist/auth/index.js +180 -262
  2. package/dist/auth/types.js +2 -22
  3. package/dist/drive/backups/index.js +34 -32
  4. package/dist/drive/payments/index.js +96 -149
  5. package/dist/drive/payments/object-storage.js +34 -36
  6. package/dist/drive/referrals/index.js +19 -17
  7. package/dist/drive/share/index.js +168 -235
  8. package/dist/drive/storage/index.js +213 -302
  9. package/dist/drive/trash/index.js +40 -84
  10. package/dist/drive/users/index.js +95 -140
  11. package/dist/mail/index.d.ts +124 -2
  12. package/dist/mail/index.js +170 -16
  13. package/dist/mail/types.d.ts +50 -0
  14. package/dist/mail/types.js +6 -0
  15. package/dist/meet/index.js +31 -99
  16. package/dist/misc/location/index.js +10 -50
  17. package/dist/network/download.js +38 -107
  18. package/dist/network/errors/codes.js +8 -24
  19. package/dist/network/errors/context.js +9 -26
  20. package/dist/network/errors/download.js +6 -24
  21. package/dist/network/errors/upload.js +21 -48
  22. package/dist/network/index.js +120 -277
  23. package/dist/network/types.js +3 -4
  24. package/dist/network/upload.js +63 -133
  25. package/dist/payments/checkout.js +57 -69
  26. package/dist/send/send.js +17 -27
  27. package/dist/shared/headers/index.js +56 -42
  28. package/dist/shared/http/client.js +95 -207
  29. package/dist/shared/http/retryWithBackoff.js +36 -110
  30. package/dist/shared/types/errors.js +37 -51
  31. package/dist/workspaces/index.js +224 -264
  32. package/package.json +14 -15
  33. package/dist/mail/api.d.ts +0 -126
  34. package/dist/mail/api.js +0 -288
  35. package/dist/mail/crypto.d.ts +0 -66
  36. package/dist/mail/crypto.js +0 -156
  37. package/dist/mail/mail.d.ts +0 -162
  38. 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,75 +32,40 @@ 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.Share = exports.ShareTypes = void 0;
84
- var headers_1 = require("../../shared/headers");
85
- var client_1 = require("../../shared/http/client");
37
+ const headers_1 = require("../../shared/headers");
38
+ const client_1 = require("../../shared/http/client");
86
39
  exports.ShareTypes = __importStar(require("./types"));
87
- var Share = /** @class */ (function () {
88
- function Share(apiUrl, appDetails, apiSecurity) {
40
+ class Share {
41
+ client;
42
+ appDetails;
43
+ apiSecurity;
44
+ static client(apiUrl, appDetails, apiSecurity) {
45
+ return new Share(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
- Share.client = function (apiUrl, appDetails, apiSecurity) {
94
- return new Share(apiUrl, appDetails, apiSecurity);
95
- };
96
52
  /**
97
53
  * Fetches the list of shared items
98
54
  */
99
- Share.prototype.getShareLinks = function (page, perPage, orderBy) {
100
- if (page === void 0) { page = 0; }
101
- if (perPage === void 0) { perPage = 50; }
102
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
103
- return this.client.get("/storage/share/list?page=".concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
104
- };
55
+ getShareLinks(page = 0, perPage = 50, orderBy) {
56
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
57
+ return this.client.get(`/storage/share/list?page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
58
+ }
105
59
  /**
106
60
  * Creates a new link to share a file or folder
107
61
  * @param payload
108
62
  */
109
- Share.prototype.createShareLink = function (payload) {
110
- var types = ['file', 'folder'];
63
+ createShareLink(payload) {
64
+ const types = ['file', 'folder'];
111
65
  if (!types.includes(payload.type)) {
112
66
  throw new Error('Invalid type');
113
67
  }
114
- return this.client.post("/storage/share/".concat(payload.type, "/").concat(payload.itemId), {
68
+ return this.client.post(`/storage/share/${payload.type}/${payload.itemId}`, {
115
69
  timesValid: payload.timesValid,
116
70
  encryptedMnemonic: payload.encryptedMnemonic,
117
71
  itemToken: payload.itemToken,
@@ -119,63 +73,63 @@ var Share = /** @class */ (function () {
119
73
  encryptedCode: payload.encryptedCode,
120
74
  plainPassword: payload.plainPassword,
121
75
  }, this.headers());
122
- };
76
+ }
123
77
  /**
124
78
  * Update share link
125
79
  * @param payload
126
80
  */
127
- Share.prototype.updateShareLink = function (payload) {
128
- return this.client.put("/storage/share/".concat(payload.itemId), {
81
+ updateShareLink(payload) {
82
+ return this.client.put(`/storage/share/${payload.itemId}`, {
129
83
  plainPassword: payload.plainPassword,
130
84
  }, this.headers());
131
- };
85
+ }
132
86
  /**
133
87
  * Delete share link by id
134
88
  * @param payload
135
89
  */
136
- Share.prototype.deleteShareLink = function (shareId) {
137
- return this.client.delete("/storage/share/".concat(shareId), this.headers());
138
- };
90
+ deleteShareLink(shareId) {
91
+ return this.client.delete(`/storage/share/${shareId}`, this.headers());
92
+ }
139
93
  /**
140
94
  * Increment share view by token
141
95
  * @param token
142
96
  */
143
- Share.prototype.incrementShareViewByToken = function (token) {
144
- return this.client.put("/storage/share/".concat(token, "/view"), {}, this.headers());
145
- };
97
+ incrementShareViewByToken(token) {
98
+ return this.client.put(`/storage/share/${token}/view`, {}, this.headers());
99
+ }
146
100
  /**
147
101
  * Fetches data of a shared file
148
102
  * @param token
149
103
  */
150
- Share.prototype.getShareLink = function (token, password) {
151
- var headers = password ? this.basicHeadersWithPassword(password) : this.basicHeaders();
152
- return this.client.get("/storage/share/".concat(token), headers);
153
- };
104
+ getShareLink(token, password) {
105
+ const headers = password ? this.basicHeadersWithPassword(password) : this.basicHeaders();
106
+ return this.client.get(`/storage/share/${token}`, headers);
107
+ }
154
108
  /**
155
109
  * Fetches paginated folders or files of a specific share link
156
110
  * @param payload
157
111
  */
158
- Share.prototype.getShareLinkDirectory = function (payload) {
159
- var types = ['file', 'folder'];
112
+ getShareLinkDirectory(payload) {
113
+ const types = ['file', 'folder'];
160
114
  if (!types.includes(payload.type)) {
161
115
  throw new Error('Invalid type');
162
116
  }
163
- var headers = this.basicHeaders();
117
+ let headers = this.basicHeaders();
164
118
  if (payload.password) {
165
119
  headers = this.basicHeadersWithPassword(payload.password);
166
120
  }
167
- return this.client.get("/storage/share/down/".concat(payload.type, "s?token=").concat(payload.token, "&folderId=").concat(payload.folderId, "&parentId=").concat(payload.parentId, "&page=").concat(payload.page, "&perPage=").concat(payload.perPage).concat(payload.code ? '&code=' + payload.code : ''), headers);
168
- };
169
- Share.prototype.getShareDomains = function () {
121
+ 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);
122
+ }
123
+ getShareDomains() {
170
124
  return this.client.get('/storage/share/domains', this.headers());
171
- };
125
+ }
172
126
  /**
173
127
  * Get size of folder in share links
174
128
  * @param payload
175
129
  */
176
- Share.prototype.getShareLinkFolderSize = function (payload) {
177
- return this.client.get("/storage/share/".concat(payload.itemId, "/folder/").concat(payload.folderId, "/size"), this.basicHeaders());
178
- };
130
+ getShareLinkFolderSize(payload) {
131
+ return this.client.get(`/storage/share/${payload.itemId}/folder/${payload.folderId}/size`, this.basicHeaders());
132
+ }
179
133
  /**
180
134
  * Fetches all folders shared by a user.
181
135
  *
@@ -184,12 +138,10 @@ var Share = /** @class */ (function () {
184
138
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
185
139
  * @returns {Promise<ListPrivateSharedFoldersResponse>} A promise containing the list of shared folders.
186
140
  */
187
- Share.prototype.getSentSharedFolders = function (page, perPage, orderBy) {
188
- if (page === void 0) { page = 0; }
189
- if (perPage === void 0) { perPage = 50; }
190
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
191
- return this.client.get("sharings/shared-by-me/folders?page=".concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
192
- };
141
+ getSentSharedFolders(page = 0, perPage = 50, orderBy) {
142
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
143
+ return this.client.get(`sharings/shared-by-me/folders?page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
144
+ }
193
145
  /**
194
146
  * Fetches folders shared with a user.
195
147
  *
@@ -198,12 +150,10 @@ var Share = /** @class */ (function () {
198
150
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
199
151
  * @returns {Promise<ListPrivateSharedFoldersResponse>} A promise containing the list of shared folders.
200
152
  */
201
- Share.prototype.getReceivedSharedFolders = function (page, perPage, orderBy) {
202
- if (page === void 0) { page = 0; }
203
- if (perPage === void 0) { perPage = 50; }
204
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
205
- return this.client.get("sharings/shared-with-me/folders?page=".concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
206
- };
153
+ getReceivedSharedFolders(page = 0, perPage = 50, orderBy) {
154
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
155
+ return this.client.get(`sharings/shared-with-me/folders?page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
156
+ }
207
157
  /**
208
158
  * Fetches all shared folders.
209
159
  *
@@ -212,12 +162,10 @@ var Share = /** @class */ (function () {
212
162
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
213
163
  * @returns {Promise<ListAllSharedFoldersResponse>} A promise containing the list of shared folders.
214
164
  */
215
- Share.prototype.getAllSharedFolders = function (page, perPage, orderBy) {
216
- if (page === void 0) { page = 0; }
217
- if (perPage === void 0) { perPage = 50; }
218
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
219
- return this.client.get("sharings/folders?page=".concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
220
- };
165
+ getAllSharedFolders(page = 0, perPage = 50, orderBy) {
166
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
167
+ return this.client.get(`sharings/folders?page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
168
+ }
221
169
  /**
222
170
  * Fetches all shared files.
223
171
  *
@@ -226,12 +174,10 @@ var Share = /** @class */ (function () {
226
174
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
227
175
  * @returns {Promise<ListAllSharedFoldersResponse>} A promise containing the list of shared folders.
228
176
  */
229
- Share.prototype.getAllSharedFiles = function (page, perPage, orderBy) {
230
- if (page === void 0) { page = 0; }
231
- if (perPage === void 0) { perPage = 50; }
232
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
233
- return this.client.get("sharings/files?page=".concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
234
- };
177
+ getAllSharedFiles(page = 0, perPage = 50, orderBy) {
178
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
179
+ return this.client.get(`sharings/files?page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
180
+ }
235
181
  /**
236
182
  * Get all users with access to a shared folder.
237
183
  *
@@ -241,12 +187,10 @@ var Share = /** @class */ (function () {
241
187
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
242
188
  * @returns {Promise<{ users: SharedFolderUser[] }>} A promise containing the list of users with access to the folder.
243
189
  */
244
- Share.prototype.getSharedFolderUsers = function (folderUUID, page, perPage, orderBy) {
245
- if (page === void 0) { page = 0; }
246
- if (perPage === void 0) { perPage = 50; }
247
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
248
- return this.client.get("sharings/shared-with/".concat(folderUUID, "?page=").concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
249
- };
190
+ getSharedFolderUsers(folderUUID, page = 0, perPage = 50, orderBy) {
191
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
192
+ return this.client.get(`sharings/shared-with/${folderUUID}?page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
193
+ }
250
194
  /**
251
195
  * Get shared folder content
252
196
  * @param {string} sharedFolderId - The UUID of the shared folder.
@@ -256,12 +200,10 @@ var Share = /** @class */ (function () {
256
200
  * @param {number} perPage - The number of items per page for pagination.
257
201
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
258
202
  */
259
- Share.prototype.getSharedFolderContent = function (sharedFolderId, type, token, page, perPage, orderBy) {
260
- if (page === void 0) { page = 0; }
261
- if (perPage === void 0) { perPage = 50; }
262
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
263
- return this.client.get("sharings/items/".concat(sharedFolderId, "/").concat(type, "?token=").concat(token, "&page=").concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
264
- };
203
+ getSharedFolderContent(sharedFolderId, type, token, page = 0, perPage = 50, orderBy) {
204
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
205
+ return this.client.get(`sharings/items/${sharedFolderId}/${type}?token=${token}&page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
206
+ }
265
207
  /**
266
208
  * Get public shared folder content
267
209
  * @param {string} sharedFolderId - The UUID of the shared folder.
@@ -271,24 +213,21 @@ var Share = /** @class */ (function () {
271
213
  * @param {number} perPage - The number of items per page for pagination.
272
214
  * @param {string} [orderBy] - The optional order criteria (e.g., 'views:ASC', 'createdAt:DESC').
273
215
  */
274
- Share.prototype.getPublicSharedFolderContent = function (sharedFolderId, type, token, page, perPage, code, orderBy) {
275
- if (page === void 0) { page = 0; }
276
- if (perPage === void 0) { perPage = 50; }
277
- if (code === void 0) { code = ''; }
278
- var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
216
+ getPublicSharedFolderContent(sharedFolderId, type, token, page = 0, perPage = 50, code = '', orderBy) {
217
+ const orderByQueryParam = orderBy ? `&orderBy=${orderBy}` : '';
279
218
  return this.client.get(
280
219
  // eslint-disable-next-line max-len
281
- "sharings/public/items/".concat(sharedFolderId, "/").concat(type, "?token=").concat(token, "&code=").concat(code, "&page=").concat(page, "&perPage=").concat(perPage).concat(orderByQueryParam), this.headers());
282
- };
220
+ `sharings/public/items/${sharedFolderId}/${type}?token=${token}&code=${code}&page=${page}&perPage=${perPage}${orderByQueryParam}`, this.headers());
221
+ }
283
222
  /**
284
223
  * Get the role of a user on a folder.
285
224
  *
286
225
  * @param {string} options.sharingId - The unique identifier of the sharing.
287
226
  * @returns {Promise<Role>} A promise containing the role of the current user in the sharing.
288
227
  */
289
- Share.prototype.getUserRole = function (sharingId) {
290
- return this.client.get("sharings/".concat(sharingId, "/role"), this.headers());
291
- };
228
+ getUserRole(sharingId) {
229
+ return this.client.get(`sharings/${sharingId}/role`, this.headers());
230
+ }
292
231
  /**
293
232
  * Update the role of a user on a folder.
294
233
  *
@@ -297,12 +236,11 @@ var Share = /** @class */ (function () {
297
236
  * @param {string} options.newRoleId - The new role Id.
298
237
  * @returns {Promise<UpdateRoleFolderResponse>} A promise that resolves when the user's role is updated.
299
238
  */
300
- Share.prototype.updateUserRole = function (_a) {
301
- var sharingId = _a.sharingId, newRoleId = _a.newRoleId;
302
- return this.client.put("sharings/".concat(sharingId, "/role"), {
239
+ updateUserRole({ sharingId, newRoleId }) {
240
+ return this.client.put(`sharings/${sharingId}/role`, {
303
241
  roleId: newRoleId,
304
242
  }, this.headers());
305
- };
243
+ }
306
244
  /**
307
245
  * Remove user from shared folder.
308
246
  *
@@ -312,10 +250,9 @@ var Share = /** @class */ (function () {
312
250
  * @param {string} options.userId - The role Id how we want to delete.
313
251
  * @returns {Promise<UpdateRoleFolderResponse>} A promise that resolves when the user's role is updated.
314
252
  */
315
- Share.prototype.removeUserRole = function (_a) {
316
- var itemType = _a.itemType, itemId = _a.itemId, userId = _a.userId;
317
- return this.client.delete("sharings/".concat(itemType, "/").concat(itemId, "/users/").concat(userId), this.headers());
318
- };
253
+ removeUserRole({ itemType, itemId, userId }) {
254
+ return this.client.delete(`sharings/${itemType}/${itemId}/users/${userId}`, this.headers());
255
+ }
319
256
  /**
320
257
  * Get private folder data.
321
258
  *
@@ -323,20 +260,18 @@ var Share = /** @class */ (function () {
323
260
  * @param {string} itemType - The itemType of the folder (file | folder).
324
261
  * @returns {Promise<{ data: SharingInvite[] }>} A promise containing the private folder data.
325
262
  */
326
- Share.prototype.getSharedFolderInvitations = function (_a) {
327
- var itemId = _a.itemId, itemType = _a.itemType;
328
- return this.client.get("sharings/".concat(itemType, "/").concat(itemId, "/invites"), this.headers());
329
- };
263
+ getSharedFolderInvitations({ itemId, itemType }) {
264
+ return this.client.get(`sharings/${itemType}/${itemId}/invites`, this.headers());
265
+ }
330
266
  /**
331
267
  * Get all invitations for a user.
332
268
  * @param limit - The number of items per page for pagination.
333
269
  * @param offset - The page number for pagination.
334
270
  * @returns {Promise<invites: any>} A promise containing the list of invitations.
335
271
  */
336
- Share.prototype.getSharedFolderInvitationsAsInvitedUser = function (_a) {
337
- var limit = _a.limit, offset = _a.offset;
338
- return this.client.get("sharings/invites?limit=".concat(limit, "&offset=").concat(offset), this.headers());
339
- };
272
+ getSharedFolderInvitationsAsInvitedUser({ limit, offset, }) {
273
+ return this.client.get(`sharings/invites?limit=${limit}&offset=${offset}`, this.headers());
274
+ }
340
275
  /**
341
276
  * Share a private folder with a user.
342
277
  *
@@ -354,64 +289,75 @@ var Share = /** @class */ (function () {
354
289
  *
355
290
  * @returns {Promise<SharingInvite>} A promise that resolves when the folder is shared with the user.
356
291
  */
357
- Share.prototype.inviteUserToSharedFolder = function (createInviteDto) {
358
- return this.client.post('sharings/invites/send', __assign(__assign({}, createInviteDto), { type: 'OWNER' }), this.headers());
359
- };
292
+ inviteUserToSharedFolder(createInviteDto) {
293
+ return this.client.post('sharings/invites/send', {
294
+ ...createInviteDto,
295
+ type: 'OWNER',
296
+ }, this.headers());
297
+ }
360
298
  /**
361
299
  * Create a sharing.
362
300
  */
363
- Share.prototype.createSharing = function (createSharingPayload) {
364
- return this.client.post('sharings', __assign({}, createSharingPayload), this.headers());
365
- };
301
+ createSharing(createSharingPayload) {
302
+ return this.client.post('sharings', {
303
+ ...createSharingPayload,
304
+ }, this.headers());
305
+ }
366
306
  /**
367
307
  * Get sharing meta with code
368
308
  */
369
- Share.prototype.getSharingMeta = function (sharingId, code, password) {
370
- var extraHeaders = password ? { 'x-share-password': password } : {};
371
- return this.client.get("sharings/".concat(sharingId, "/meta?code=").concat(code), __assign(__assign({}, this.headers()), extraHeaders));
372
- };
309
+ getSharingMeta(sharingId, code, password) {
310
+ const extraHeaders = password ? { 'x-share-password': password } : {};
311
+ return this.client.get(`sharings/${sharingId}/meta?code=${code}`, {
312
+ ...this.headers(),
313
+ ...extraHeaders,
314
+ });
315
+ }
373
316
  /**
374
317
  * Add/edit sharing Password
375
318
  * @param {string} sharingId - id of sharing.
376
319
  * @param {string} encryptedPassword - password encrypted with CODE as key
377
320
  * @returns {Promise<SharingMeta>} A promise that returns the sharing info with the new encrypted password
378
321
  */
379
- Share.prototype.saveSharingPassword = function (sharingId, encryptedPassword) {
380
- return this.client.patch("sharings/".concat(sharingId, "/password"), {
381
- encryptedPassword: encryptedPassword,
322
+ saveSharingPassword(sharingId, encryptedPassword) {
323
+ return this.client.patch(`sharings/${sharingId}/password`, {
324
+ encryptedPassword,
382
325
  }, this.headers());
383
- };
326
+ }
384
327
  /**
385
328
  * Remove password protection from sharing
386
329
  * @param {string} sharingId - id of sharing.
387
330
  * @returns {Promise<void>} A promise that resolves when password was successfully deleted.
388
331
  */
389
- Share.prototype.removeSharingPassword = function (sharingId) {
390
- return this.client.delete("sharings/".concat(sharingId, "/password"), this.headers());
391
- };
332
+ removeSharingPassword(sharingId) {
333
+ return this.client.delete(`sharings/${sharingId}/password`, this.headers());
334
+ }
392
335
  /**
393
336
  * Get public information of the item shared.
394
337
  * @param {string} sharingId - id of sharing.
395
338
  * @returns {Promise<PublicSharedItemInfo>} A promise that returns data of the public shared item.
396
339
  */
397
- Share.prototype.getPublicSharedItemInfo = function (sharingId) {
398
- return this.client.get("sharings/public/".concat(sharingId, "/item"), this.headers());
399
- };
340
+ getPublicSharedItemInfo(sharingId) {
341
+ return this.client.get(`sharings/public/${sharingId}/item`, this.headers());
342
+ }
400
343
  /**
401
344
  * Request access to shared folder.
402
345
  */
403
- Share.prototype.requestUserToSharedFolder = function (createInviteDto) {
404
- return this.client.post('sharings/invites/send', __assign(__assign({}, createInviteDto), { type: 'SELF' }), this.headers());
405
- };
346
+ requestUserToSharedFolder(createInviteDto) {
347
+ return this.client.post('sharings/invites/send', {
348
+ ...createInviteDto,
349
+ type: 'SELF',
350
+ }, this.headers());
351
+ }
406
352
  /**
407
353
  * Check if the expirationDate of invite is valid.
408
354
  * @param {string} invitationId - The id of the invitation.
409
355
 
410
356
  * @returns {Promise<{uuid: string}>} A promise returning the uuid of the invitation if valid.
411
357
  */
412
- Share.prototype.validateInviteExpiration = function (invitationId) {
413
- return this.client.get("sharings/invites/".concat(invitationId, "/validate"), this.headers());
414
- };
358
+ validateInviteExpiration(invitationId) {
359
+ return this.client.get(`sharings/invites/${invitationId}/validate`, this.headers());
360
+ }
415
361
  /**
416
362
  * Share a private folder with a user.
417
363
  * @param {string} invitationId - The id of the invitation.
@@ -421,13 +367,12 @@ var Share = /** @class */ (function () {
421
367
 
422
368
  * @returns {Promise<void>} A promise that resolves when the folder is shared with the user.
423
369
  */
424
- Share.prototype.acceptSharedFolderInvite = function (_a) {
425
- var invitationId = _a.invitationId, acceptInvite = _a.acceptInvite, token = _a.token;
426
- var headers = this.getRequestHeaders(token);
427
- return this.client.post("sharings/invites/".concat(invitationId, "/accept"), {
428
- acceptInvite: acceptInvite,
370
+ acceptSharedFolderInvite({ invitationId, acceptInvite, token, }) {
371
+ const headers = this.getRequestHeaders(token);
372
+ return this.client.post(`sharings/invites/${invitationId}/accept`, {
373
+ acceptInvite,
429
374
  }, headers);
430
- };
375
+ }
431
376
  /**
432
377
  * Change Sharing Mode.
433
378
  * @param {string} options.itemType - folder | file
@@ -436,74 +381,61 @@ var Share = /** @class */ (function () {
436
381
 
437
382
  * @returns {Promise<void>} A promise that resolves when sharing mode has been updated.
438
383
  */
439
- Share.prototype.updateSharingType = function (_a) {
440
- var itemId = _a.itemId, itemType = _a.itemType, sharingType = _a.sharingType;
441
- var headers = this.headers();
442
- return this.client.put("sharings/".concat(itemType, "/").concat(itemId, "/type"), {
443
- sharingType: sharingType,
384
+ updateSharingType({ itemId, itemType, sharingType, }) {
385
+ const headers = this.headers();
386
+ return this.client.put(`sharings/${itemType}/${itemId}/type`, {
387
+ sharingType,
444
388
  }, headers);
445
- };
389
+ }
446
390
  /**
447
391
  * Get Sharing type
448
392
  * @param {string} options.itemType - folder | file
449
393
  * @param {string} options.itemId - id of folder or file
450
394
  * @returns {Promise<SharingMeta>} A promise that returns the sharing data.
451
395
  */
452
- Share.prototype.getSharingType = function (_a) {
453
- var itemId = _a.itemId, itemType = _a.itemType;
454
- var headers = this.headers();
455
- return this.client.get("sharings/".concat(itemType, "/").concat(itemId, "/type"), headers);
456
- };
396
+ getSharingType({ itemId, itemType }) {
397
+ const headers = this.headers();
398
+ return this.client.get(`sharings/${itemType}/${itemId}/type`, headers);
399
+ }
457
400
  /**
458
401
  * Obtains detailed sharing information for a given file or folder
459
402
  * @param {string} options.itemType - folder | file
460
403
  * @param {string} options.itemId - id of folder or file
461
404
  * @returns {Promise<SharingInfo>} A promise that returns information about the shared item.
462
405
  */
463
- Share.prototype.getSharingInfo = function (_a) {
464
- var itemId = _a.itemId, itemType = _a.itemType;
465
- var headers = this.headers();
466
- return this.client.get("sharings/".concat(itemType, "/").concat(itemId, "/info"), headers);
467
- };
468
- Share.prototype.declineSharedFolderInvite = function (invitationId, token) {
469
- var headers = this.getRequestHeaders(token);
470
- return this.client.delete("sharings/invites/".concat(invitationId), headers);
471
- };
406
+ getSharingInfo({ itemId, itemType }) {
407
+ const headers = this.headers();
408
+ return this.client.get(`sharings/${itemType}/${itemId}/info`, headers);
409
+ }
410
+ declineSharedFolderInvite(invitationId, token) {
411
+ const headers = this.getRequestHeaders(token);
412
+ return this.client.delete(`sharings/invites/${invitationId}`, headers);
413
+ }
472
414
  /**
473
415
  * Fetches roles for sharing items.
474
416
  *
475
417
  * @returns {Promise<PrivateSharingRolesResponse>} A promise containing the list of sharing roles.
476
418
  */
477
- Share.prototype.getSharingRoles = function () {
419
+ getSharingRoles() {
478
420
  return this.client.get('/sharings/roles', this.headers());
479
- };
480
- Share.prototype.getAllAccessUsers = function (_a) {
481
- var itemType = _a.itemType, folderId = _a.folderId;
482
- return this.client.get("sharings/shared-with/".concat(itemType, "/").concat(folderId), this.headers());
483
- };
421
+ }
422
+ getAllAccessUsers({ itemType, folderId, }) {
423
+ return this.client.get(`sharings/shared-with/${itemType}/${folderId}`, this.headers());
424
+ }
484
425
  /**
485
426
  * Stop sharing folder
486
427
  * @param {string} itemType - Type of the sharing to delete
487
428
  * @param {string} itemId - Id of the sharing to delete
488
429
  * @returns
489
430
  */
490
- Share.prototype.stopSharingFolder = function (itemType, itemId) {
491
- return __awaiter(this, void 0, void 0, function () {
492
- return __generator(this, function (_a) {
493
- switch (_a.label) {
494
- case 0: return [4 /*yield*/, this.client.delete("sharings/".concat(itemType, "/").concat(itemId), this.headers())];
495
- case 1:
496
- _a.sent();
497
- return [2 /*return*/];
498
- }
499
- });
500
- });
501
- };
431
+ async stopSharingFolder(itemType, itemId) {
432
+ await this.client.delete(`sharings/${itemType}/${itemId}`, this.headers());
433
+ }
502
434
  /**
503
435
  * Returns the needed headers for the module requests
504
436
  * @private
505
437
  */
506
- Share.prototype.headers = function (password) {
438
+ headers(password) {
507
439
  if (password) {
508
440
  return (0, headers_1.headersWithTokenAndPassword)({
509
441
  clientName: this.appDetails.clientName,
@@ -511,7 +443,7 @@ var Share = /** @class */ (function () {
511
443
  token: this.apiSecurity.token,
512
444
  workspaceToken: this.apiSecurity.workspaceToken,
513
445
  desktopToken: this.appDetails.desktopHeader,
514
- password: password,
446
+ password,
515
447
  });
516
448
  }
517
449
  return (0, headers_1.headersWithToken)({
@@ -522,53 +454,54 @@ var Share = /** @class */ (function () {
522
454
  desktopToken: this.appDetails.desktopHeader,
523
455
  customHeaders: this.appDetails.customHeaders,
524
456
  });
525
- };
457
+ }
526
458
  /**
527
459
  * Returns the needed headers for the module requests
528
460
  * @private
529
461
  */
530
- Share.prototype.basicHeaders = function () {
462
+ basicHeaders() {
531
463
  return (0, headers_1.basicHeaders)({
532
464
  clientName: this.appDetails.clientName,
533
465
  clientVersion: this.appDetails.clientVersion,
534
466
  desktopToken: this.appDetails.desktopHeader,
535
467
  customHeaders: this.appDetails.customHeaders,
536
468
  });
537
- };
469
+ }
538
470
  /**
539
471
  * Used to send the password in shares
540
472
  * @private
541
473
  */
542
- Share.prototype.basicHeadersWithPassword = function (password) {
474
+ basicHeadersWithPassword(password) {
543
475
  return (0, headers_1.basicHeadersWithPassword)({
544
476
  clientName: this.appDetails.clientName,
545
477
  clientVersion: this.appDetails.clientVersion,
546
478
  desktopToken: this.appDetails.desktopHeader,
547
- password: password,
479
+ password,
548
480
  });
549
- };
481
+ }
550
482
  /**
551
483
  * Get request headers with optional authorization token.
552
484
  *
553
485
  * @param {string} [token] - Optional authorization token.
554
486
  * @returns {Object} - Request headers object.
555
487
  */
556
- Share.prototype.getRequestHeaders = function (token) {
557
- var headers = __assign({}, this.headers());
488
+ getRequestHeaders(token) {
489
+ const headers = {
490
+ ...this.headers(),
491
+ };
558
492
  if (token) {
559
493
  headers.Authorization = 'Bearer ' + token;
560
494
  }
561
495
  return headers;
562
- };
496
+ }
563
497
  /**
564
498
  * Gets the size of a shared folder given sharing id
565
499
  *
566
500
  * @param {string} sharingId - Sharing ID.
567
501
  * @returns {Promise<SharedFolderSize>}
568
502
  */
569
- Share.prototype.getSharedFolderSize = function (id) {
570
- return this.client.get("sharings/public/".concat(id, "/folder/size"), this.headers());
571
- };
572
- return Share;
573
- }());
503
+ getSharedFolderSize(id) {
504
+ return this.client.get(`sharings/public/${id}/folder/size`, this.headers());
505
+ }
506
+ }
574
507
  exports.Share = Share;