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