@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.
- package/dist/auth/index.js +180 -262
- package/dist/auth/types.js +2 -22
- package/dist/drive/backups/index.js +34 -32
- package/dist/drive/payments/index.js +96 -149
- package/dist/drive/payments/object-storage.js +34 -36
- package/dist/drive/referrals/index.js +19 -17
- package/dist/drive/share/index.js +168 -235
- package/dist/drive/storage/index.js +213 -302
- package/dist/drive/trash/index.js +40 -84
- package/dist/drive/users/index.js +95 -140
- package/dist/mail/index.d.ts +124 -2
- package/dist/mail/index.js +170 -16
- package/dist/mail/types.d.ts +50 -0
- package/dist/mail/types.js +6 -0
- package/dist/meet/index.js +31 -99
- package/dist/misc/location/index.js +10 -50
- package/dist/network/download.js +38 -107
- package/dist/network/errors/codes.js +8 -24
- package/dist/network/errors/context.js +9 -26
- package/dist/network/errors/download.js +6 -24
- package/dist/network/errors/upload.js +21 -48
- package/dist/network/index.js +120 -277
- package/dist/network/types.js +3 -4
- package/dist/network/upload.js +63 -133
- package/dist/payments/checkout.js +57 -69
- package/dist/send/send.js +17 -27
- package/dist/shared/headers/index.js +56 -42
- package/dist/shared/http/client.js +95 -207
- package/dist/shared/http/retryWithBackoff.js +36 -110
- package/dist/shared/types/errors.js +37 -51
- package/dist/workspaces/index.js +224 -264
- package/package.json +14 -15
- package/dist/mail/api.d.ts +0 -126
- package/dist/mail/api.js +0 -288
- package/dist/mail/crypto.d.ts +0 -66
- package/dist/mail/crypto.js +0 -156
- package/dist/mail/mail.d.ts +0 -162
- package/dist/mail/mail.js +0 -382
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -43,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
|
-
|
|
85
|
-
|
|
37
|
+
const headers_1 = require("../../shared/headers");
|
|
38
|
+
const client_1 = require("../../shared/http/client");
|
|
86
39
|
exports.ShareTypes = __importStar(require("./types"));
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
110
|
-
|
|
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(
|
|
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
|
-
|
|
128
|
-
return this.client.put(
|
|
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
|
-
|
|
137
|
-
return this.client.delete(
|
|
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
|
-
|
|
144
|
-
return this.client.put(
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
return this.client.get(
|
|
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
|
-
|
|
159
|
-
|
|
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
|
-
|
|
117
|
+
let headers = this.basicHeaders();
|
|
164
118
|
if (payload.password) {
|
|
165
119
|
headers = this.basicHeadersWithPassword(payload.password);
|
|
166
120
|
}
|
|
167
|
-
return this.client.get(
|
|
168
|
-
}
|
|
169
|
-
|
|
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
|
-
|
|
177
|
-
return this.client.get(
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
275
|
-
|
|
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
|
-
|
|
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
|
-
|
|
290
|
-
return this.client.get(
|
|
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
|
-
|
|
301
|
-
|
|
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
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
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
|
-
|
|
358
|
-
return this.client.post('sharings/invites/send',
|
|
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
|
-
|
|
364
|
-
return this.client.post('sharings',
|
|
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
|
-
|
|
370
|
-
|
|
371
|
-
return this.client.get(
|
|
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
|
-
|
|
380
|
-
return this.client.patch(
|
|
381
|
-
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
|
-
|
|
390
|
-
return this.client.delete(
|
|
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
|
-
|
|
398
|
-
return this.client.get(
|
|
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
|
-
|
|
404
|
-
return this.client.post('sharings/invites/send',
|
|
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
|
-
|
|
413
|
-
return this.client.get(
|
|
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
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
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
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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
|
-
|
|
419
|
+
getSharingRoles() {
|
|
478
420
|
return this.client.get('/sharings/roles', this.headers());
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
557
|
-
|
|
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
|
-
|
|
570
|
-
return this.client.get(
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
}());
|
|
503
|
+
getSharedFolderSize(id) {
|
|
504
|
+
return this.client.get(`sharings/public/${id}/folder/size`, this.headers());
|
|
505
|
+
}
|
|
506
|
+
}
|
|
574
507
|
exports.Share = Share;
|