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