@internxt/sdk 1.5.25 → 1.6.4

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 (93) hide show
  1. package/dist/auth/index.d.ts +127 -122
  2. package/dist/auth/index.js +378 -310
  3. package/dist/auth/types.d.ts +65 -54
  4. package/dist/auth/types.js +26 -26
  5. package/dist/drive/backups/index.d.ts +18 -18
  6. package/dist/drive/backups/index.js +40 -40
  7. package/dist/drive/backups/types.d.ts +27 -27
  8. package/dist/drive/backups/types.js +2 -2
  9. package/dist/drive/index.d.ts +7 -7
  10. package/dist/drive/index.js +23 -19
  11. package/dist/drive/payments/index.d.ts +66 -71
  12. package/dist/drive/payments/index.js +206 -208
  13. package/dist/drive/payments/types.d.ts +180 -176
  14. package/dist/drive/payments/types.js +37 -37
  15. package/dist/drive/referrals/index.d.ts +19 -19
  16. package/dist/drive/referrals/index.js +54 -50
  17. package/dist/drive/referrals/types.d.ts +21 -21
  18. package/dist/drive/referrals/types.js +18 -18
  19. package/dist/drive/share/index.d.ts +319 -319
  20. package/dist/drive/share/index.js +544 -540
  21. package/dist/drive/share/types.d.ts +360 -360
  22. package/dist/drive/share/types.js +2 -2
  23. package/dist/drive/storage/index.d.ts +315 -315
  24. package/dist/drive/storage/index.js +634 -630
  25. package/dist/drive/storage/types.d.ts +480 -473
  26. package/dist/drive/storage/types.js +13 -13
  27. package/dist/drive/trash/index.d.ts +75 -75
  28. package/dist/drive/trash/index.js +184 -180
  29. package/dist/drive/trash/types.d.ts +29 -29
  30. package/dist/drive/trash/types.js +2 -2
  31. package/dist/drive/users/index.d.ts +135 -135
  32. package/dist/drive/users/index.js +208 -204
  33. package/dist/drive/users/types.d.ts +53 -51
  34. package/dist/drive/users/types.js +2 -2
  35. package/dist/index.d.ts +6 -6
  36. package/dist/index.js +35 -31
  37. package/dist/network/download.d.ts +8 -8
  38. package/dist/network/download.js +123 -123
  39. package/dist/network/errors/codes.d.ts +24 -24
  40. package/dist/network/errors/codes.js +48 -48
  41. package/dist/network/errors/context.d.ts +35 -35
  42. package/dist/network/errors/context.js +39 -39
  43. package/dist/network/errors/download.d.ts +4 -4
  44. package/dist/network/errors/download.js +52 -48
  45. package/dist/network/errors/index.d.ts +3 -3
  46. package/dist/network/errors/index.js +19 -15
  47. package/dist/network/errors/upload.d.ts +13 -13
  48. package/dist/network/errors/upload.js +82 -78
  49. package/dist/network/index.d.ts +70 -70
  50. package/dist/network/index.js +315 -311
  51. package/dist/network/types.d.ts +102 -102
  52. package/dist/network/types.js +18 -18
  53. package/dist/network/upload.d.ts +4 -4
  54. package/dist/network/upload.js +158 -159
  55. package/dist/photos/devices/index.d.ts +10 -10
  56. package/dist/photos/devices/index.js +79 -79
  57. package/dist/photos/index.d.ts +17 -17
  58. package/dist/photos/index.js +56 -52
  59. package/dist/photos/photos/index.d.ts +60 -60
  60. package/dist/photos/photos/index.js +225 -225
  61. package/dist/photos/shares/index.d.ts +8 -8
  62. package/dist/photos/shares/index.js +34 -34
  63. package/dist/photos/types.d.ts +154 -154
  64. package/dist/photos/types.js +19 -19
  65. package/dist/photos/users/index.d.ts +7 -7
  66. package/dist/photos/users/index.js +46 -46
  67. package/dist/shared/headers/index.d.ts +21 -21
  68. package/dist/shared/headers/index.js +78 -79
  69. package/dist/shared/http/client.d.ts +85 -85
  70. package/dist/shared/http/client.js +172 -172
  71. package/dist/shared/http/types.d.ts +7 -7
  72. package/dist/shared/http/types.js +2 -2
  73. package/dist/shared/index.d.ts +1 -1
  74. package/dist/shared/index.js +17 -13
  75. package/dist/shared/types/apiConnection.d.ts +12 -12
  76. package/dist/shared/types/apiConnection.js +2 -2
  77. package/dist/shared/types/appsumo.d.ts +16 -16
  78. package/dist/shared/types/appsumo.js +12 -12
  79. package/dist/shared/types/errors.d.ts +5 -5
  80. package/dist/shared/types/errors.js +28 -28
  81. package/dist/shared/types/teams.d.ts +9 -9
  82. package/dist/shared/types/teams.js +2 -2
  83. package/dist/shared/types/userSettings.d.ts +43 -29
  84. package/dist/shared/types/userSettings.js +2 -2
  85. package/dist/utils.d.ts +3 -3
  86. package/dist/utils.js +24 -25
  87. package/dist/workspaces/index.d.ts +176 -176
  88. package/dist/workspaces/index.js +419 -415
  89. package/dist/workspaces/index.test.d.ts +1 -1
  90. package/dist/workspaces/index.test.js +908 -903
  91. package/dist/workspaces/types.d.ts +294 -291
  92. package/dist/workspaces/types.js +2 -2
  93. package/package.json +13 -13
@@ -1,415 +1,419 @@
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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- var __rest = (this && this.__rest) || function (s, e) {
24
- var t = {};
25
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
26
- t[p] = s[p];
27
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
28
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
29
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
30
- t[p[i]] = s[p[i]];
31
- }
32
- return t;
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.Workspaces = void 0;
36
- var headers_1 = require("../shared/headers");
37
- var client_1 = require("../shared/http/client");
38
- var Workspaces = /** @class */ (function () {
39
- function Workspaces(apiUrl, appDetails, apiSecurity) {
40
- this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
41
- this.appDetails = appDetails;
42
- this.apiSecurity = apiSecurity;
43
- }
44
- Workspaces.client = function (apiUrl, appDetails, apiSecurity) {
45
- return new Workspaces(apiUrl, appDetails, apiSecurity);
46
- };
47
- /**
48
- * Returns the needed headers for the module requests
49
- * @private
50
- */
51
- Workspaces.prototype.headers = function () {
52
- return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token, this.apiSecurity.workspaceToken);
53
- };
54
- Workspaces.prototype.getRequestHeaders = function (token) {
55
- var headers = __assign({}, this.headers());
56
- if (token) {
57
- headers.Authorization = 'Bearer ' + token;
58
- }
59
- return headers;
60
- };
61
- Workspaces.prototype.getWorkspaces = function () {
62
- return this.client.get('workspaces/', this.headers());
63
- };
64
- Workspaces.prototype.getPendingWorkspaces = function () {
65
- return this.client.get('workspaces/pending-setup', this.headers());
66
- };
67
- Workspaces.prototype.getPendingInvites = function () {
68
- var limitQuery = '?limit=25';
69
- var offsetQuery = '&offset=0';
70
- var query = "" + limitQuery + offsetQuery;
71
- return this.client.get("workspaces/invitations/" + query, this.headers());
72
- };
73
- Workspaces.prototype.validateWorkspaceInvite = function (inviteId) {
74
- return this.client.get("workspaces/invitations/" + inviteId + "validate", this.headers());
75
- };
76
- /**
77
- * Uploads an avatar for a specific workspace.
78
- * @param workspaceId The UUID of the workspace to upload the avatar for.
79
- * @param avatar The avatar to upload.
80
- * @returns The response from the server.
81
- */
82
- Workspaces.prototype.uploadWorkspaceAvatar = function (workspaceId, avatar) {
83
- var formData = new FormData();
84
- formData.append('file', avatar);
85
- return this.client.post("workspaces/" + workspaceId + "/avatar", formData, __assign(__assign({}, this.headers()), { 'content-type': 'multipart/form-data' }));
86
- };
87
- Workspaces.prototype.deleteWorkspaceAvatar = function (workspaceId) {
88
- return this.client.delete("workspaces/" + workspaceId + "/avatar", this.headers());
89
- };
90
- Workspaces.prototype.setupWorkspace = function (_a) {
91
- var workspaceId = _a.workspaceId, name = _a.name, address = _a.address, description = _a.description, encryptedMnemonic = _a.encryptedMnemonic;
92
- return this.client.patch("workspaces/" + workspaceId + "/setup", { name: name, address: address, description: description, encryptedMnemonic: encryptedMnemonic }, this.headers());
93
- };
94
- Workspaces.prototype.getWorkspaceUsage = function (workspaceId) {
95
- return this.client.get("workspaces/" + workspaceId + "/usage", this.headers());
96
- };
97
- Workspaces.prototype.editWorkspace = function (workspaceId, details) {
98
- return this.client.patch("workspaces/" + workspaceId, details, this.headers());
99
- };
100
- Workspaces.prototype.updateAvatar = function (workspaceId, payload) {
101
- var formData = new FormData();
102
- formData.set('file', payload.avatar);
103
- return this.client.post("workspaces/" + workspaceId + "/avatar", formData, this.headers());
104
- };
105
- Workspaces.prototype.deleteAvatar = function (workspaceId) {
106
- return this.client.delete("workspaces/" + workspaceId + "/avatar", this.headers());
107
- };
108
- Workspaces.prototype.createTeam = function (_a) {
109
- var workspaceId = _a.workspaceId, name = _a.name, managerId = _a.managerId;
110
- return this.client.post("workspaces/" + workspaceId + "/teams", {
111
- name: name,
112
- managerId: managerId,
113
- }, this.headers());
114
- };
115
- Workspaces.prototype.getWorkspacesMembers = function (workspaceId) {
116
- return this.client.get("workspaces/" + workspaceId + "/members", this.headers());
117
- };
118
- Workspaces.prototype.getWorkspacesTeams = function (workspaceId) {
119
- return this.client.get("workspaces/" + workspaceId + "/teams", this.headers());
120
- };
121
- Workspaces.prototype.editTeam = function (_a) {
122
- var teamId = _a.teamId, name = _a.name;
123
- return this.client.patch("workspaces/teams/" + teamId, {
124
- name: name,
125
- }, this.headers());
126
- };
127
- Workspaces.prototype.deleteTeam = function (_a) {
128
- var workspaceId = _a.workspaceId, teamId = _a.teamId;
129
- return this.client.delete("workspaces/" + workspaceId + "/teams/" + teamId, this.headers());
130
- };
131
- Workspaces.prototype.getWorkspacesTeamMembers = function (teamId) {
132
- return this.client.get("workspaces/teams/" + teamId + "/members", this.headers());
133
- };
134
- Workspaces.prototype.addTeamUser = function (teamId, userUuid) {
135
- return this.client.post("/workspaces/teams/" + teamId + "/user/" + userUuid, {}, this.headers());
136
- };
137
- Workspaces.prototype.removeTeamUser = function (teamId, userUuid) {
138
- return this.client.delete("/workspaces/teams/" + teamId + "/user/" + userUuid, this.headers());
139
- };
140
- Workspaces.prototype.changeTeamManager = function (workspaceId, teamId, userUuid) {
141
- return this.client.patch("/workspaces/" + workspaceId + "/teams/" + teamId + "/manager", { managerId: userUuid }, this.headers());
142
- };
143
- Workspaces.prototype.getPersonalTrash = function (workspaceId, type, offset, limit) {
144
- if (offset === void 0) { offset = 0; }
145
- if (limit === void 0) { limit = 50; }
146
- var offsetQuery = "?offset=" + offset;
147
- var limitQuery = "&limit=" + limit;
148
- var typeQuery = "&type=" + type;
149
- var query = "" + offsetQuery + limitQuery + typeQuery;
150
- return this.client.get("/workspaces/" + workspaceId + "/trash" + query, this.headers());
151
- };
152
- Workspaces.prototype.emptyPersonalTrash = function (workspaceId) {
153
- return this.client.delete("/workspaces/" + workspaceId + "/trash", this.headers());
154
- };
155
- Workspaces.prototype.changeUserRole = function (teamId, memberId, role) {
156
- return this.client.patch("/api/workspaces/teams/" + teamId + "/members/" + memberId + "/role", {
157
- role: role,
158
- }, this.headers());
159
- };
160
- Workspaces.prototype.inviteMemberToWorkspace = function (_a) {
161
- var workspaceId = _a.workspaceId, invitedUserEmail = _a.invitedUserEmail, spaceLimitBytes = _a.spaceLimitBytes, encryptedMnemonicInBase64 = _a.encryptedMnemonicInBase64, _b = _a.encryptionAlgorithm, encryptionAlgorithm = _b === void 0 ? 'aes-256-gcm' : _b, message = _a.message;
162
- return this.client.post("workspaces/" + workspaceId + "/members/invite", {
163
- invitedUser: invitedUserEmail,
164
- spaceLimit: spaceLimitBytes,
165
- encryptionKey: encryptedMnemonicInBase64,
166
- encryptionAlgorithm: encryptionAlgorithm,
167
- message: message,
168
- }, this.headers());
169
- };
170
- Workspaces.prototype.leaveWorkspace = function (workspaceId) {
171
- return this.client.delete("workspaces/" + workspaceId + "/members/leave", this.headers());
172
- };
173
- Workspaces.prototype.getMemberDetails = function (workspaceId, memberId) {
174
- return this.client.get("workspaces/" + workspaceId + "/members/" + memberId, this.headers());
175
- };
176
- Workspaces.prototype.modifyMemberUsage = function (workspaceId, memberId, spaceLimitBytes) {
177
- return this.client.patch("workspaces/" + workspaceId + "/members/" + memberId + "/usage", {
178
- spaceLimit: spaceLimitBytes,
179
- }, this.headers());
180
- };
181
- Workspaces.prototype.getMemberUsage = function (workspaceId) {
182
- return this.client.get("workspaces/" + workspaceId + "/usage/member", this.headers());
183
- };
184
- Workspaces.prototype.deactivateMember = function (workspaceId, memberId) {
185
- return this.client.patch("workspaces/" + workspaceId + "/members/" + memberId + "/deactivate", {}, this.headers());
186
- };
187
- Workspaces.prototype.activateMember = function (workspaceId, memberId) {
188
- return this.client.patch("workspaces/" + workspaceId + "/members/" + memberId + "/activate", {}, this.headers());
189
- };
190
- Workspaces.prototype.removeMember = function (workspaceId, memberId) {
191
- return this.client.delete("workspaces/" + workspaceId + "/members/" + memberId, this.headers());
192
- };
193
- Workspaces.prototype.acceptInvitation = function (inviteId, token) {
194
- return this.client.post('workspaces/invitations/accept', {
195
- inviteId: inviteId,
196
- }, this.getRequestHeaders(token));
197
- };
198
- Workspaces.prototype.declineInvitation = function (inviteId, token) {
199
- return this.client.delete("workspaces/invitations/" + inviteId, this.getRequestHeaders(token));
200
- };
201
- Workspaces.prototype.getWorkspaceCredentials = function (workspaceId) {
202
- return this.client.get("workspaces/" + workspaceId + "/credentials", this.headers());
203
- };
204
- Workspaces.prototype.createFileEntry = function (fileEntry, workspaceId, resourcesToken) {
205
- return this.client.post("/workspaces/" + workspaceId + "/files", {
206
- name: fileEntry.name,
207
- bucket: fileEntry.bucket,
208
- fileId: fileEntry.fileId,
209
- encryptVersion: fileEntry.encryptVersion,
210
- folderUuid: fileEntry.folderUuid,
211
- size: fileEntry.size,
212
- plainName: fileEntry.plainName,
213
- type: fileEntry.type,
214
- modificationTime: fileEntry.modificationTime,
215
- date: fileEntry.date,
216
- }, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
217
- };
218
- /**
219
- * Creates a new folder in the specified workspace.
220
- *
221
- * @param {CreateFolderPayload} options - The options for creating the folder.
222
- * @param {string} options.workspaceId - The ID of the workspace.
223
- * @param {string} options.plainName - The plain name of the folder.
224
- * @param {string} options.parentFolderUuid - The UUID of the parent folder.
225
- * @return {[Promise<CreateFolderResponse>, RequestCanceler]} A tuple containing a promise to get the API response and a function to cancel the request.
226
- */
227
- Workspaces.prototype.createFolder = function (_a) {
228
- var workspaceId = _a.workspaceId, plainName = _a.plainName, parentFolderUuid = _a.parentFolderUuid;
229
- var _b = this.client.postCancellable("/workspaces/" + workspaceId + "/folders", {
230
- name: plainName,
231
- parentFolderUuid: parentFolderUuid,
232
- }, this.headers()), promise = _b.promise, requestCanceler = _b.requestCanceler;
233
- return [promise, requestCanceler];
234
- };
235
- /**
236
- * Retrieves a paginated list of folders within a specific folder in a workspace.
237
- *
238
- * @param {string} workspaceId - The ID of the workspace.
239
- * @param {string} folderUUID - The UUID of the folder.
240
- * @param {number} [offset=0] - The position of the first file to return.
241
- * @param {number} [limit=50] - The max number of files to be returned.
242
- * @param {string} [sort=''] - The reference column to sort it.
243
- * @param {string} [order=''] - The order to be followed.
244
- * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
245
- */
246
- Workspaces.prototype.getFolders = function (workspaceId, folderUUID, offset, limit, sort, order) {
247
- if (offset === void 0) { offset = 0; }
248
- if (limit === void 0) { limit = 50; }
249
- if (sort === void 0) { sort = ''; }
250
- if (order === void 0) { order = ''; }
251
- var offsetQuery = "?offset=" + offset;
252
- var limitQuery = "&limit=" + limit;
253
- var sortQuery = sort !== '' ? "&sort=" + sort : '';
254
- var orderQuery = order !== '' ? "&order=" + order : '';
255
- var query = "" + offsetQuery + limitQuery + sortQuery + orderQuery;
256
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/folders/" + folderUUID + "/folders/" + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
257
- return [promise, requestCanceler];
258
- };
259
- /**
260
- * Retrieves a paginated list of files within a specific folder in a workspace.
261
- *
262
- * @param {string} workspaceId - The ID of the workspace.
263
- * @param {string} folderUUID - The UUID of the folder.
264
- * @param {number} [offset=0] - The position of the first file to return.
265
- * @param {number} [limit=50] - The max number of files to be returned.
266
- * @param {string} [sort=''] - The reference column to sort it.
267
- * @param {string} [order=''] - The order to be followed.
268
- * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
269
- */
270
- Workspaces.prototype.getFiles = function (workspaceId, folderUUID, offset, limit, sort, order) {
271
- if (offset === void 0) { offset = 0; }
272
- if (limit === void 0) { limit = 50; }
273
- if (sort === void 0) { sort = ''; }
274
- if (order === void 0) { order = ''; }
275
- var offsetQuery = "?offset=" + offset;
276
- var limitQuery = "&limit=" + limit;
277
- var sortQuery = sort !== '' ? "&sort=" + sort : '';
278
- var orderQuery = order !== '' ? "&order=" + order : '';
279
- var query = "" + offsetQuery + limitQuery + sortQuery + orderQuery;
280
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/folders/" + folderUUID + "/files/" + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
281
- return [promise, requestCanceler];
282
- };
283
- Workspaces.prototype.getWorkspacePendingInvitations = function (workspaceId, limit, offset) {
284
- var limitQuery = "?limit=" + limit;
285
- var offsetQuery = "&offset=" + offset;
286
- var query = "" + limitQuery + offsetQuery;
287
- return this.client.get("workspaces/" + workspaceId + "/invitations/" + query, this.headers());
288
- };
289
- /**
290
- * Creates a new sharing for a workspace item.
291
- *
292
- * @param {CreateWorkspaceSharingPayload} options - The options for creating the sharing.
293
- * @param {string} options.workspaceId - The ID of the workspace.
294
- * @param {string} options.teamUUID - The UUID of the team.
295
- * @param {...CreateSharingPayload} options.createSharingPayload - The payload for creating the sharing.
296
- * @returns {Promise<SharingMeta>} A promise that resolves to the sharing metadata.
297
- */
298
- Workspaces.prototype.shareItem = function (_a) {
299
- var workspaceId = _a.workspaceId, teamUUID = _a.teamUUID, createSharingPayload = __rest(_a, ["workspaceId", "teamUUID"]);
300
- return this.client.post("workspaces/" + workspaceId + "/shared", __assign(__assign({}, createSharingPayload), { sharedWith: teamUUID }), this.headers());
301
- };
302
- Workspaces.prototype.validateWorkspaceInvitation = function (inviteId) {
303
- return this.client.get("workspaces/invitations/" + inviteId + "/validate", this.headers());
304
- };
305
- /**
306
- * Returns shared files in teams.
307
- * @param orderBy
308
- * @deprecated use `getWorkspaceTeamSharedFilesV2` call instead.
309
- */
310
- Workspaces.prototype.getWorkspaceTeamSharedFiles = function (workspaceId, teamId, orderBy) {
311
- var orderByQueryParam = orderBy ? "?orderBy=" + orderBy : '';
312
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/teams/" + teamId + "/shared/files" + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
313
- return [promise, requestCanceler];
314
- };
315
- /**
316
- * Returns shared files in teams.
317
- * @param orderBy
318
- */
319
- Workspaces.prototype.getWorkspaceTeamSharedFilesV2 = function (workspaceId, orderBy) {
320
- var orderByQueryParam = orderBy ? "?orderBy=" + orderBy : '';
321
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/shared/files" + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
322
- return [promise, requestCanceler];
323
- };
324
- /**
325
- * Returns shared folders in teams.
326
- * @param orderBy
327
- * @deprecated use `getWorkspaceTeamSharedFoldersV2` call instead.
328
- */
329
- Workspaces.prototype.getWorkspaceTeamSharedFolders = function (workspaceId, teamId, orderBy) {
330
- var orderByQueryParam = orderBy ? "?orderBy=" + orderBy : '';
331
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/teams/" + teamId + "/shared/folders" + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
332
- return [promise, requestCanceler];
333
- };
334
- /**
335
- * Returns shared folders in teams.
336
- * @param orderBy
337
- */
338
- Workspaces.prototype.getWorkspaceTeamSharedFoldersV2 = function (workspaceId, orderBy) {
339
- var orderByQueryParam = orderBy ? "?orderBy=" + orderBy : '';
340
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/shared/folders" + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
341
- return [promise, requestCanceler];
342
- };
343
- /**
344
- * Returns files inside a shared folders with teams.
345
- * @param orderBy
346
- * @deprecated use `getWorkspaceTeamSharedFolderFilesV2` call instead.
347
- */
348
- Workspaces.prototype.getWorkspaceTeamSharedFolderFiles = function (workspaceId, teamId, sharedFolderUUID, page, perPage, token, orderBy) {
349
- if (page === void 0) { page = 0; }
350
- if (perPage === void 0) { perPage = 50; }
351
- var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
352
- var params = "?page=" + page + "&perPage=" + perPage;
353
- if (token)
354
- params = params + ("&token=" + token);
355
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/teams/" + teamId + "/shared/" + sharedFolderUUID + "/files" + params + "\n " + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
356
- return [promise, requestCanceler];
357
- };
358
- /**
359
- * Returns files inside a shared folders with teams.
360
- * @param orderBy
361
- */
362
- Workspaces.prototype.getWorkspaceTeamSharedFolderFilesV2 = function (workspaceId, sharedFolderUUID, page, perPage, token, orderBy) {
363
- if (page === void 0) { page = 0; }
364
- if (perPage === void 0) { perPage = 50; }
365
- var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
366
- var params = "?page=" + page + "&perPage=" + perPage;
367
- if (token)
368
- params = params + ("&token=" + token);
369
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/shared/" + sharedFolderUUID + "/files" + params + "\n " + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
370
- return [promise, requestCanceler];
371
- };
372
- /**
373
- * Returns folders inside a shared folders with teams.
374
- * @param orderBy
375
- * @deprecated use `getWorkspaceTeamSharedFolderFoldersV2` call instead.
376
- */
377
- Workspaces.prototype.getWorkspaceTeamSharedFolderFolders = function (workspaceId, teamId, sharedFolderUUID, page, perPage, token, orderBy) {
378
- if (page === void 0) { page = 0; }
379
- if (perPage === void 0) { perPage = 50; }
380
- var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
381
- var params = "?page=" + page + "&perPage=" + perPage;
382
- if (token)
383
- params = params + ("&token=" + token);
384
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/teams/" + teamId + "/shared/" + sharedFolderUUID + "/folders" + params + "\n " + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
385
- return [promise, requestCanceler];
386
- };
387
- /**
388
- * Returns folders inside a shared folders with teams.
389
- * @param orderBy
390
- */
391
- Workspaces.prototype.getWorkspaceTeamSharedFolderFoldersV2 = function (workspaceId, sharedFolderUUID, page, perPage, token, orderBy) {
392
- if (page === void 0) { page = 0; }
393
- if (perPage === void 0) { perPage = 50; }
394
- var orderByQueryParam = orderBy ? "&orderBy=" + orderBy : '';
395
- var params = "?page=" + page + "&perPage=" + perPage;
396
- if (token)
397
- params = params + ("&token=" + token);
398
- var _a = this.client.getCancellable("workspaces/" + workspaceId + "/shared/" + sharedFolderUUID + "/folders" + params + "\n " + orderByQueryParam, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
399
- return [promise, requestCanceler];
400
- };
401
- /**
402
- * Returns users and teams an item is shared with.
403
- */
404
- Workspaces.prototype.getUsersAndTeamsAnItemIsShareWidth = function (_a) {
405
- var workspaceId = _a.workspaceId, itemType = _a.itemType, itemId = _a.itemId;
406
- var _b = this.client.getCancellable("workspaces/" + workspaceId + "/shared/" + itemType + "/" + itemId + "/shared-with", this.headers()), promise = _b.promise, requestCanceler = _b.requestCanceler;
407
- return [promise, requestCanceler];
408
- };
409
- Workspaces.prototype.getWorkspace = function (workspaceId) {
410
- return this.client.get("workspaces/" + workspaceId, this.headers());
411
- };
412
- return Workspaces;
413
- }());
414
- exports.Workspaces = Workspaces;
415
- __exportStar(require("./types"), exports);
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ var __rest = (this && this.__rest) || function (s, e) {
28
+ var t = {};
29
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
+ t[p] = s[p];
31
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
+ t[p[i]] = s[p[i]];
35
+ }
36
+ return t;
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Workspaces = void 0;
40
+ var headers_1 = require("../shared/headers");
41
+ var client_1 = require("../shared/http/client");
42
+ var Workspaces = /** @class */ (function () {
43
+ function Workspaces(apiUrl, appDetails, apiSecurity) {
44
+ this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
45
+ this.appDetails = appDetails;
46
+ this.apiSecurity = apiSecurity;
47
+ }
48
+ Workspaces.client = function (apiUrl, appDetails, apiSecurity) {
49
+ return new Workspaces(apiUrl, appDetails, apiSecurity);
50
+ };
51
+ /**
52
+ * Returns the needed headers for the module requests
53
+ * @private
54
+ */
55
+ Workspaces.prototype.headers = function () {
56
+ return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token, this.apiSecurity.workspaceToken);
57
+ };
58
+ Workspaces.prototype.getRequestHeaders = function (token) {
59
+ var headers = __assign({}, this.headers());
60
+ if (token) {
61
+ headers.Authorization = 'Bearer ' + token;
62
+ }
63
+ return headers;
64
+ };
65
+ Workspaces.prototype.getWorkspaces = function () {
66
+ return this.client.get('workspaces/', this.headers());
67
+ };
68
+ Workspaces.prototype.getPendingWorkspaces = function () {
69
+ return this.client.get('workspaces/pending-setup', this.headers());
70
+ };
71
+ Workspaces.prototype.getPendingInvites = function () {
72
+ var limitQuery = '?limit=25';
73
+ var offsetQuery = '&offset=0';
74
+ var query = "".concat(limitQuery).concat(offsetQuery);
75
+ return this.client.get("workspaces/invitations/".concat(query), this.headers());
76
+ };
77
+ Workspaces.prototype.validateWorkspaceInvite = function (inviteId) {
78
+ return this.client.get("workspaces/invitations/".concat(inviteId, "validate"), this.headers());
79
+ };
80
+ /**
81
+ * Uploads an avatar for a specific workspace.
82
+ * @param workspaceId The UUID of the workspace to upload the avatar for.
83
+ * @param avatar The avatar to upload.
84
+ * @returns The response from the server.
85
+ */
86
+ Workspaces.prototype.uploadWorkspaceAvatar = function (workspaceId, avatar) {
87
+ var formData = new FormData();
88
+ formData.append('file', avatar);
89
+ return this.client.post("workspaces/".concat(workspaceId, "/avatar"), formData, __assign(__assign({}, this.headers()), { 'content-type': 'multipart/form-data' }));
90
+ };
91
+ Workspaces.prototype.deleteWorkspaceAvatar = function (workspaceId) {
92
+ return this.client.delete("workspaces/".concat(workspaceId, "/avatar"), this.headers());
93
+ };
94
+ Workspaces.prototype.setupWorkspace = function (_a) {
95
+ var workspaceId = _a.workspaceId, name = _a.name, address = _a.address, description = _a.description, encryptedMnemonic = _a.encryptedMnemonic, hybridModeEnabled = _a.hybridModeEnabled;
96
+ return this.client.patch("workspaces/".concat(workspaceId, "/setup"), { name: name, address: address, description: description, encryptedMnemonic: encryptedMnemonic, hybridModeEnabled: hybridModeEnabled }, this.headers());
97
+ };
98
+ Workspaces.prototype.getWorkspaceUsage = function (workspaceId) {
99
+ return this.client.get("workspaces/".concat(workspaceId, "/usage"), this.headers());
100
+ };
101
+ Workspaces.prototype.editWorkspace = function (workspaceId, details) {
102
+ return this.client.patch("workspaces/".concat(workspaceId), details, this.headers());
103
+ };
104
+ Workspaces.prototype.updateAvatar = function (workspaceId, payload) {
105
+ var formData = new FormData();
106
+ formData.set('file', payload.avatar);
107
+ return this.client.post("workspaces/".concat(workspaceId, "/avatar"), formData, this.headers());
108
+ };
109
+ Workspaces.prototype.deleteAvatar = function (workspaceId) {
110
+ return this.client.delete("workspaces/".concat(workspaceId, "/avatar"), this.headers());
111
+ };
112
+ Workspaces.prototype.createTeam = function (_a) {
113
+ var workspaceId = _a.workspaceId, name = _a.name, managerId = _a.managerId;
114
+ return this.client.post("workspaces/".concat(workspaceId, "/teams"), {
115
+ name: name,
116
+ managerId: managerId,
117
+ }, this.headers());
118
+ };
119
+ Workspaces.prototype.getWorkspacesMembers = function (workspaceId) {
120
+ return this.client.get("workspaces/".concat(workspaceId, "/members"), this.headers());
121
+ };
122
+ Workspaces.prototype.getWorkspacesTeams = function (workspaceId) {
123
+ return this.client.get("workspaces/".concat(workspaceId, "/teams"), this.headers());
124
+ };
125
+ Workspaces.prototype.editTeam = function (_a) {
126
+ var teamId = _a.teamId, name = _a.name;
127
+ return this.client.patch("workspaces/teams/".concat(teamId), {
128
+ name: name,
129
+ }, this.headers());
130
+ };
131
+ Workspaces.prototype.deleteTeam = function (_a) {
132
+ var workspaceId = _a.workspaceId, teamId = _a.teamId;
133
+ return this.client.delete("workspaces/".concat(workspaceId, "/teams/").concat(teamId), this.headers());
134
+ };
135
+ Workspaces.prototype.getWorkspacesTeamMembers = function (teamId) {
136
+ return this.client.get("workspaces/teams/".concat(teamId, "/members"), this.headers());
137
+ };
138
+ Workspaces.prototype.addTeamUser = function (teamId, userUuid) {
139
+ return this.client.post("/workspaces/teams/".concat(teamId, "/user/").concat(userUuid), {}, this.headers());
140
+ };
141
+ Workspaces.prototype.removeTeamUser = function (teamId, userUuid) {
142
+ return this.client.delete("/workspaces/teams/".concat(teamId, "/user/").concat(userUuid), this.headers());
143
+ };
144
+ Workspaces.prototype.changeTeamManager = function (workspaceId, teamId, userUuid) {
145
+ return this.client.patch("/workspaces/".concat(workspaceId, "/teams/").concat(teamId, "/manager"), { managerId: userUuid }, this.headers());
146
+ };
147
+ Workspaces.prototype.getPersonalTrash = function (workspaceId, type, offset, limit) {
148
+ if (offset === void 0) { offset = 0; }
149
+ if (limit === void 0) { limit = 50; }
150
+ var offsetQuery = "?offset=".concat(offset);
151
+ var limitQuery = "&limit=".concat(limit);
152
+ var typeQuery = "&type=".concat(type);
153
+ var query = "".concat(offsetQuery).concat(limitQuery).concat(typeQuery);
154
+ return this.client.get("/workspaces/".concat(workspaceId, "/trash").concat(query), this.headers());
155
+ };
156
+ Workspaces.prototype.emptyPersonalTrash = function (workspaceId) {
157
+ return this.client.delete("/workspaces/".concat(workspaceId, "/trash"), this.headers());
158
+ };
159
+ Workspaces.prototype.changeUserRole = function (teamId, memberId, role) {
160
+ return this.client.patch("/api/workspaces/teams/".concat(teamId, "/members/").concat(memberId, "/role"), {
161
+ role: role,
162
+ }, this.headers());
163
+ };
164
+ Workspaces.prototype.inviteMemberToWorkspace = function (_a) {
165
+ var workspaceId = _a.workspaceId, invitedUserEmail = _a.invitedUserEmail, spaceLimitBytes = _a.spaceLimitBytes, encryptedMnemonicInBase64 = _a.encryptedMnemonicInBase64, _b = _a.encryptionAlgorithm, encryptionAlgorithm = _b === void 0 ? 'aes-256-gcm' : _b, message = _a.message;
166
+ return this.client.post("workspaces/".concat(workspaceId, "/members/invite"), {
167
+ invitedUser: invitedUserEmail,
168
+ spaceLimit: spaceLimitBytes,
169
+ encryptionKey: encryptedMnemonicInBase64,
170
+ encryptionAlgorithm: encryptionAlgorithm,
171
+ message: message,
172
+ }, this.headers());
173
+ };
174
+ Workspaces.prototype.leaveWorkspace = function (workspaceId) {
175
+ return this.client.delete("workspaces/".concat(workspaceId, "/members/leave"), this.headers());
176
+ };
177
+ Workspaces.prototype.getMemberDetails = function (workspaceId, memberId) {
178
+ return this.client.get("workspaces/".concat(workspaceId, "/members/").concat(memberId), this.headers());
179
+ };
180
+ Workspaces.prototype.modifyMemberUsage = function (workspaceId, memberId, spaceLimitBytes) {
181
+ return this.client.patch("workspaces/".concat(workspaceId, "/members/").concat(memberId, "/usage"), {
182
+ spaceLimit: spaceLimitBytes,
183
+ }, this.headers());
184
+ };
185
+ Workspaces.prototype.getMemberUsage = function (workspaceId) {
186
+ return this.client.get("workspaces/".concat(workspaceId, "/usage/member"), this.headers());
187
+ };
188
+ Workspaces.prototype.deactivateMember = function (workspaceId, memberId) {
189
+ return this.client.patch("workspaces/".concat(workspaceId, "/members/").concat(memberId, "/deactivate"), {}, this.headers());
190
+ };
191
+ Workspaces.prototype.activateMember = function (workspaceId, memberId) {
192
+ return this.client.patch("workspaces/".concat(workspaceId, "/members/").concat(memberId, "/activate"), {}, this.headers());
193
+ };
194
+ Workspaces.prototype.removeMember = function (workspaceId, memberId) {
195
+ return this.client.delete("workspaces/".concat(workspaceId, "/members/").concat(memberId), this.headers());
196
+ };
197
+ Workspaces.prototype.acceptInvitation = function (inviteId, token) {
198
+ return this.client.post('workspaces/invitations/accept', {
199
+ inviteId: inviteId,
200
+ }, this.getRequestHeaders(token));
201
+ };
202
+ Workspaces.prototype.declineInvitation = function (inviteId, token) {
203
+ return this.client.delete("workspaces/invitations/".concat(inviteId), this.getRequestHeaders(token));
204
+ };
205
+ Workspaces.prototype.getWorkspaceCredentials = function (workspaceId) {
206
+ return this.client.get("workspaces/".concat(workspaceId, "/credentials"), this.headers());
207
+ };
208
+ Workspaces.prototype.createFileEntry = function (fileEntry, workspaceId, resourcesToken) {
209
+ return this.client.post("/workspaces/".concat(workspaceId, "/files"), {
210
+ name: fileEntry.name,
211
+ bucket: fileEntry.bucket,
212
+ fileId: fileEntry.fileId,
213
+ encryptVersion: fileEntry.encryptVersion,
214
+ folderUuid: fileEntry.folderUuid,
215
+ size: fileEntry.size,
216
+ plainName: fileEntry.plainName,
217
+ type: fileEntry.type,
218
+ modificationTime: fileEntry.modificationTime,
219
+ date: fileEntry.date,
220
+ }, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
221
+ };
222
+ /**
223
+ * Creates a new folder in the specified workspace.
224
+ *
225
+ * @param {CreateFolderPayload} options - The options for creating the folder.
226
+ * @param {string} options.workspaceId - The ID of the workspace.
227
+ * @param {string} options.plainName - The plain name of the folder.
228
+ * @param {string} options.parentFolderUuid - The UUID of the parent folder.
229
+ * @return {[Promise<CreateFolderResponse>, RequestCanceler]} A tuple containing a promise to get the API response and a function to cancel the request.
230
+ */
231
+ Workspaces.prototype.createFolder = function (_a) {
232
+ var workspaceId = _a.workspaceId, plainName = _a.plainName, parentFolderUuid = _a.parentFolderUuid;
233
+ var _b = this.client.postCancellable("/workspaces/".concat(workspaceId, "/folders"), {
234
+ name: plainName,
235
+ parentFolderUuid: parentFolderUuid,
236
+ }, this.headers()), promise = _b.promise, requestCanceler = _b.requestCanceler;
237
+ return [promise, requestCanceler];
238
+ };
239
+ /**
240
+ * Retrieves a paginated list of folders within a specific folder in a workspace.
241
+ *
242
+ * @param {string} workspaceId - The ID of the workspace.
243
+ * @param {string} folderUUID - The UUID of the folder.
244
+ * @param {number} [offset=0] - The position of the first file to return.
245
+ * @param {number} [limit=50] - The max number of files to be returned.
246
+ * @param {string} [sort=''] - The reference column to sort it.
247
+ * @param {string} [order=''] - The order to be followed.
248
+ * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
249
+ */
250
+ Workspaces.prototype.getFolders = function (workspaceId, folderUUID, offset, limit, sort, order) {
251
+ if (offset === void 0) { offset = 0; }
252
+ if (limit === void 0) { limit = 50; }
253
+ if (sort === void 0) { sort = ''; }
254
+ if (order === void 0) { order = ''; }
255
+ var offsetQuery = "?offset=".concat(offset);
256
+ var limitQuery = "&limit=".concat(limit);
257
+ var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
258
+ var orderQuery = order !== '' ? "&order=".concat(order) : '';
259
+ var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
260
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/folders/").concat(folderUUID, "/folders/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
261
+ return [promise, requestCanceler];
262
+ };
263
+ /**
264
+ * Retrieves a paginated list of files within a specific folder in a workspace.
265
+ *
266
+ * @param {string} workspaceId - The ID of the workspace.
267
+ * @param {string} folderUUID - The UUID of the folder.
268
+ * @param {number} [offset=0] - The position of the first file to return.
269
+ * @param {number} [limit=50] - The max number of files to be returned.
270
+ * @param {string} [sort=''] - The reference column to sort it.
271
+ * @param {string} [order=''] - The order to be followed.
272
+ * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
273
+ */
274
+ Workspaces.prototype.getFiles = function (workspaceId, folderUUID, offset, limit, sort, order) {
275
+ if (offset === void 0) { offset = 0; }
276
+ if (limit === void 0) { limit = 50; }
277
+ if (sort === void 0) { sort = ''; }
278
+ if (order === void 0) { order = ''; }
279
+ var offsetQuery = "?offset=".concat(offset);
280
+ var limitQuery = "&limit=".concat(limit);
281
+ var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
282
+ var orderQuery = order !== '' ? "&order=".concat(order) : '';
283
+ var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
284
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/folders/").concat(folderUUID, "/files/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
285
+ return [promise, requestCanceler];
286
+ };
287
+ Workspaces.prototype.getWorkspacePendingInvitations = function (workspaceId, limit, offset) {
288
+ var limitQuery = "?limit=".concat(limit);
289
+ var offsetQuery = "&offset=".concat(offset);
290
+ var query = "".concat(limitQuery).concat(offsetQuery);
291
+ return this.client.get("workspaces/".concat(workspaceId, "/invitations/").concat(query), this.headers());
292
+ };
293
+ /**
294
+ * Creates a new sharing for a workspace item.
295
+ *
296
+ * @param {CreateWorkspaceSharingPayload} options - The options for creating the sharing.
297
+ * @param {string} options.workspaceId - The ID of the workspace.
298
+ * @param {string} options.teamUUID - The UUID of the team.
299
+ * @param {...CreateSharingPayload} options.createSharingPayload - The payload for creating the sharing.
300
+ * @returns {Promise<SharingMeta>} A promise that resolves to the sharing metadata.
301
+ */
302
+ Workspaces.prototype.shareItem = function (_a) {
303
+ var workspaceId = _a.workspaceId, teamUUID = _a.teamUUID, createSharingPayload = __rest(_a, ["workspaceId", "teamUUID"]);
304
+ return this.client.post("workspaces/".concat(workspaceId, "/shared"), __assign(__assign({}, createSharingPayload), { sharedWith: teamUUID }), this.headers());
305
+ };
306
+ Workspaces.prototype.validateWorkspaceInvitation = function (inviteId) {
307
+ return this.client.get("workspaces/invitations/".concat(inviteId, "/validate"), this.headers());
308
+ };
309
+ /**
310
+ * Returns shared files in teams.
311
+ * @param orderBy
312
+ * @deprecated use `getWorkspaceTeamSharedFilesV2` call instead.
313
+ */
314
+ Workspaces.prototype.getWorkspaceTeamSharedFiles = function (workspaceId, teamId, orderBy) {
315
+ var orderByQueryParam = orderBy ? "?orderBy=".concat(orderBy) : '';
316
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/teams/").concat(teamId, "/shared/files").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
317
+ return [promise, requestCanceler];
318
+ };
319
+ /**
320
+ * Returns shared files in teams.
321
+ * @param orderBy
322
+ */
323
+ Workspaces.prototype.getWorkspaceTeamSharedFilesV2 = function (workspaceId, orderBy) {
324
+ var orderByQueryParam = orderBy ? "?orderBy=".concat(orderBy) : '';
325
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/shared/files").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
326
+ return [promise, requestCanceler];
327
+ };
328
+ /**
329
+ * Returns shared folders in teams.
330
+ * @param orderBy
331
+ * @deprecated use `getWorkspaceTeamSharedFoldersV2` call instead.
332
+ */
333
+ Workspaces.prototype.getWorkspaceTeamSharedFolders = function (workspaceId, teamId, orderBy) {
334
+ var orderByQueryParam = orderBy ? "?orderBy=".concat(orderBy) : '';
335
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/teams/").concat(teamId, "/shared/folders").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
336
+ return [promise, requestCanceler];
337
+ };
338
+ /**
339
+ * Returns shared folders in teams.
340
+ * @param orderBy
341
+ */
342
+ Workspaces.prototype.getWorkspaceTeamSharedFoldersV2 = function (workspaceId, orderBy) {
343
+ var orderByQueryParam = orderBy ? "?orderBy=".concat(orderBy) : '';
344
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/shared/folders").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
345
+ return [promise, requestCanceler];
346
+ };
347
+ /**
348
+ * Returns files inside a shared folders with teams.
349
+ * @param orderBy
350
+ * @deprecated use `getWorkspaceTeamSharedFolderFilesV2` call instead.
351
+ */
352
+ Workspaces.prototype.getWorkspaceTeamSharedFolderFiles = function (workspaceId, teamId, sharedFolderUUID, page, perPage, token, orderBy) {
353
+ if (page === void 0) { page = 0; }
354
+ if (perPage === void 0) { perPage = 50; }
355
+ var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
356
+ var params = "?page=".concat(page, "&perPage=").concat(perPage);
357
+ if (token)
358
+ params = params + "&token=".concat(token);
359
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/teams/").concat(teamId, "/shared/").concat(sharedFolderUUID, "/files").concat(params, "\n ").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
360
+ return [promise, requestCanceler];
361
+ };
362
+ /**
363
+ * Returns files inside a shared folders with teams.
364
+ * @param orderBy
365
+ */
366
+ Workspaces.prototype.getWorkspaceTeamSharedFolderFilesV2 = function (workspaceId, sharedFolderUUID, page, perPage, token, orderBy) {
367
+ if (page === void 0) { page = 0; }
368
+ if (perPage === void 0) { perPage = 50; }
369
+ var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
370
+ var params = "?page=".concat(page, "&perPage=").concat(perPage);
371
+ if (token)
372
+ params = params + "&token=".concat(token);
373
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/shared/").concat(sharedFolderUUID, "/files").concat(params, "\n ").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
374
+ return [promise, requestCanceler];
375
+ };
376
+ /**
377
+ * Returns folders inside a shared folders with teams.
378
+ * @param orderBy
379
+ * @deprecated use `getWorkspaceTeamSharedFolderFoldersV2` call instead.
380
+ */
381
+ Workspaces.prototype.getWorkspaceTeamSharedFolderFolders = function (workspaceId, teamId, sharedFolderUUID, page, perPage, token, orderBy) {
382
+ if (page === void 0) { page = 0; }
383
+ if (perPage === void 0) { perPage = 50; }
384
+ var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
385
+ var params = "?page=".concat(page, "&perPage=").concat(perPage);
386
+ if (token)
387
+ params = params + "&token=".concat(token);
388
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/teams/").concat(teamId, "/shared/").concat(sharedFolderUUID, "/folders").concat(params, "\n ").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
389
+ return [promise, requestCanceler];
390
+ };
391
+ /**
392
+ * Returns folders inside a shared folders with teams.
393
+ * @param orderBy
394
+ */
395
+ Workspaces.prototype.getWorkspaceTeamSharedFolderFoldersV2 = function (workspaceId, sharedFolderUUID, page, perPage, token, orderBy) {
396
+ if (page === void 0) { page = 0; }
397
+ if (perPage === void 0) { perPage = 50; }
398
+ var orderByQueryParam = orderBy ? "&orderBy=".concat(orderBy) : '';
399
+ var params = "?page=".concat(page, "&perPage=").concat(perPage);
400
+ if (token)
401
+ params = params + "&token=".concat(token);
402
+ var _a = this.client.getCancellable("workspaces/".concat(workspaceId, "/shared/").concat(sharedFolderUUID, "/folders").concat(params, "\n ").concat(orderByQueryParam), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
403
+ return [promise, requestCanceler];
404
+ };
405
+ /**
406
+ * Returns users and teams an item is shared with.
407
+ */
408
+ Workspaces.prototype.getUsersAndTeamsAnItemIsShareWidth = function (_a) {
409
+ var workspaceId = _a.workspaceId, itemType = _a.itemType, itemId = _a.itemId;
410
+ var _b = this.client.getCancellable("workspaces/".concat(workspaceId, "/shared/").concat(itemType, "/").concat(itemId, "/shared-with"), this.headers()), promise = _b.promise, requestCanceler = _b.requestCanceler;
411
+ return [promise, requestCanceler];
412
+ };
413
+ Workspaces.prototype.getWorkspace = function (workspaceId) {
414
+ return this.client.get("workspaces/".concat(workspaceId), this.headers());
415
+ };
416
+ return Workspaces;
417
+ }());
418
+ exports.Workspaces = Workspaces;
419
+ __exportStar(require("./types"), exports);