files.com 1.0.256 → 1.0.257

Sign up to get free protection for your applications and to get access to all the features.
@@ -66,75 +66,101 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
66
66
  return _ref.apply(this, arguments);
67
67
  };
68
68
  }());
69
+ (0, _defineProperty2.default)(this, "downloadToString", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
70
+ var downloadUri, _require2, saveUrlToString;
71
+ return _regenerator.default.wrap(function _callee2$(_context2) {
72
+ while (1) switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ if (!(0, _utils.isBrowser)()) {
75
+ _context2.next = 2;
76
+ break;
77
+ }
78
+ throw new errors.NotImplementedError('String downloads are only available in a NodeJS environment');
79
+ case 2:
80
+ downloadUri = _this.getDownloadUri();
81
+ if (downloadUri) {
82
+ _context2.next = 5;
83
+ break;
84
+ }
85
+ throw new errors.EmptyPropertyError('Current object has no download URI');
86
+ case 5:
87
+ _require2 = require('../isomorphic/File.node.js'), saveUrlToString = _require2.saveUrlToString;
88
+ return _context2.abrupt("return", saveUrlToString(downloadUri));
89
+ case 7:
90
+ case "end":
91
+ return _context2.stop();
92
+ }
93
+ }, _callee2);
94
+ })));
69
95
  (0, _defineProperty2.default)(this, "downloadToFile", /*#__PURE__*/function () {
70
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(destinationPath) {
71
- var downloadUri, _require2, saveUrlToFile;
72
- return _regenerator.default.wrap(function _callee2$(_context2) {
73
- while (1) switch (_context2.prev = _context2.next) {
96
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationPath) {
97
+ var downloadUri, _require3, saveUrlToFile;
98
+ return _regenerator.default.wrap(function _callee3$(_context3) {
99
+ while (1) switch (_context3.prev = _context3.next) {
74
100
  case 0:
75
101
  if (!(0, _utils.isBrowser)()) {
76
- _context2.next = 2;
102
+ _context3.next = 2;
77
103
  break;
78
104
  }
79
105
  throw new errors.NotImplementedError('Disk file downloads are only available in a NodeJS environment');
80
106
  case 2:
81
107
  downloadUri = _this.getDownloadUri();
82
108
  if (downloadUri) {
83
- _context2.next = 5;
109
+ _context3.next = 5;
84
110
  break;
85
111
  }
86
112
  throw new errors.EmptyPropertyError('Current object has no download URI');
87
113
  case 5:
88
- _require2 = require('../isomorphic/File.node.js'), saveUrlToFile = _require2.saveUrlToFile;
89
- return _context2.abrupt("return", saveUrlToFile(downloadUri, destinationPath));
114
+ _require3 = require('../isomorphic/File.node.js'), saveUrlToFile = _require3.saveUrlToFile;
115
+ return _context3.abrupt("return", saveUrlToFile(downloadUri, destinationPath));
90
116
  case 7:
91
117
  case "end":
92
- return _context2.stop();
118
+ return _context3.stop();
93
119
  }
94
- }, _callee2);
120
+ }, _callee3);
95
121
  }));
96
122
  return function (_x2) {
97
- return _ref2.apply(this, arguments);
123
+ return _ref3.apply(this, arguments);
98
124
  };
99
125
  }());
100
126
  (0, _defineProperty2.default)(this, "copyTo", /*#__PURE__*/function () {
101
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath, options) {
127
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath, options) {
102
128
  var params;
103
- return _regenerator.default.wrap(function _callee3$(_context3) {
104
- while (1) switch (_context3.prev = _context3.next) {
129
+ return _regenerator.default.wrap(function _callee4$(_context4) {
130
+ while (1) switch (_context4.prev = _context4.next) {
105
131
  case 0:
106
132
  params = {
107
133
  destination: destinationFilePath
108
134
  };
109
- return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
135
+ return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
110
136
  case 2:
111
137
  case "end":
112
- return _context3.stop();
138
+ return _context4.stop();
113
139
  }
114
- }, _callee3);
140
+ }, _callee4);
115
141
  }));
116
142
  return function (_x3, _x4) {
117
- return _ref3.apply(this, arguments);
143
+ return _ref4.apply(this, arguments);
118
144
  };
119
145
  }());
120
146
  (0, _defineProperty2.default)(this, "moveTo", /*#__PURE__*/function () {
121
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath, options) {
147
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(destinationFilePath, options) {
122
148
  var params;
123
- return _regenerator.default.wrap(function _callee4$(_context4) {
124
- while (1) switch (_context4.prev = _context4.next) {
149
+ return _regenerator.default.wrap(function _callee5$(_context5) {
150
+ while (1) switch (_context5.prev = _context5.next) {
125
151
  case 0:
126
152
  params = {
127
153
  destination: destinationFilePath
128
154
  };
129
- return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
155
+ return _context5.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
130
156
  case 2:
131
157
  case "end":
132
- return _context4.stop();
158
+ return _context5.stop();
133
159
  }
134
- }, _callee4);
160
+ }, _callee5);
135
161
  }));
136
162
  return function (_x5, _x6) {
137
- return _ref4.apply(this, arguments);
163
+ return _ref5.apply(this, arguments);
138
164
  };
139
165
  }());
140
166
  // string # File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
@@ -330,190 +356,190 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
330
356
  // preview_size - string - Request a preview size. Can be `small` (default), `large`, `xlarge`, or `pdf`.
331
357
  // with_previews - boolean - Include file preview information?
332
358
  // with_priority_color - boolean - Include file priority color information?
333
- (0, _defineProperty2.default)(this, "download", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
359
+ (0, _defineProperty2.default)(this, "download", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
334
360
  var params,
335
361
  response,
336
- _args5 = arguments;
337
- return _regenerator.default.wrap(function _callee5$(_context5) {
338
- while (1) switch (_context5.prev = _context5.next) {
362
+ _args6 = arguments;
363
+ return _regenerator.default.wrap(function _callee6$(_context6) {
364
+ while (1) switch (_context6.prev = _context6.next) {
339
365
  case 0:
340
- params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
366
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
341
367
  if (_this.attributes.path) {
342
- _context5.next = 3;
368
+ _context6.next = 3;
343
369
  break;
344
370
  }
345
371
  throw new errors.EmptyPropertyError('Current object has no path');
346
372
  case 3:
347
373
  if ((0, _utils.isObject)(params)) {
348
- _context5.next = 5;
374
+ _context6.next = 5;
349
375
  break;
350
376
  }
351
377
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
352
378
  case 5:
353
379
  params.path = _this.attributes.path;
354
380
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
355
- _context5.next = 8;
381
+ _context6.next = 8;
356
382
  break;
357
383
  }
358
384
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
359
385
  case 8:
360
386
  if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
361
- _context5.next = 10;
387
+ _context6.next = 10;
362
388
  break;
363
389
  }
364
390
  throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(action)));
365
391
  case 10:
366
392
  if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
367
- _context5.next = 12;
393
+ _context6.next = 12;
368
394
  break;
369
395
  }
370
396
  throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(preview_size)));
371
397
  case 12:
372
398
  if (params['path']) {
373
- _context5.next = 18;
399
+ _context6.next = 18;
374
400
  break;
375
401
  }
376
402
  if (!_this.attributes.path) {
377
- _context5.next = 17;
403
+ _context6.next = 17;
378
404
  break;
379
405
  }
380
406
  params['path'] = _this.path;
381
- _context5.next = 18;
407
+ _context6.next = 18;
382
408
  break;
383
409
  case 17:
384
410
  throw new errors.MissingParameterError('Parameter missing: path');
385
411
  case 18:
386
- _context5.next = 20;
412
+ _context6.next = 20;
387
413
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'GET', params, _this.options);
388
414
  case 20:
389
- response = _context5.sent;
390
- return _context5.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
415
+ response = _context6.sent;
416
+ return _context6.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
391
417
  case 22:
392
418
  case "end":
393
- return _context5.stop();
419
+ return _context6.stop();
394
420
  }
395
- }, _callee5);
421
+ }, _callee6);
396
422
  })));
397
423
  // Parameters:
398
424
  // provided_mtime - string - Modified time of file.
399
425
  // priority_color - string - Priority/Bookmark color of file.
400
- (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
426
+ (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
401
427
  var params,
402
428
  response,
403
- _args6 = arguments;
404
- return _regenerator.default.wrap(function _callee6$(_context6) {
405
- while (1) switch (_context6.prev = _context6.next) {
429
+ _args7 = arguments;
430
+ return _regenerator.default.wrap(function _callee7$(_context7) {
431
+ while (1) switch (_context7.prev = _context7.next) {
406
432
  case 0:
407
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
433
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
408
434
  if (_this.attributes.path) {
409
- _context6.next = 3;
435
+ _context7.next = 3;
410
436
  break;
411
437
  }
412
438
  throw new errors.EmptyPropertyError('Current object has no path');
413
439
  case 3:
414
440
  if ((0, _utils.isObject)(params)) {
415
- _context6.next = 5;
441
+ _context7.next = 5;
416
442
  break;
417
443
  }
418
444
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
419
445
  case 5:
420
446
  params.path = _this.attributes.path;
421
447
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
422
- _context6.next = 8;
448
+ _context7.next = 8;
423
449
  break;
424
450
  }
425
451
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
426
452
  case 8:
427
453
  if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
428
- _context6.next = 10;
454
+ _context7.next = 10;
429
455
  break;
430
456
  }
431
457
  throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(provided_mtime)));
432
458
  case 10:
433
459
  if (!(params['priority_color'] && !(0, _utils.isString)(params['priority_color']))) {
434
- _context6.next = 12;
460
+ _context7.next = 12;
435
461
  break;
436
462
  }
437
463
  throw new errors.InvalidParameterError("Bad parameter: priority_color must be of type String, received ".concat((0, _utils.getType)(priority_color)));
438
464
  case 12:
439
465
  if (params['path']) {
440
- _context6.next = 18;
466
+ _context7.next = 18;
441
467
  break;
442
468
  }
443
469
  if (!_this.attributes.path) {
444
- _context6.next = 17;
470
+ _context7.next = 17;
445
471
  break;
446
472
  }
447
473
  params['path'] = _this.path;
448
- _context6.next = 18;
474
+ _context7.next = 18;
449
475
  break;
450
476
  case 17:
451
477
  throw new errors.MissingParameterError('Parameter missing: path');
452
478
  case 18:
453
- _context6.next = 20;
479
+ _context7.next = 20;
454
480
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'PATCH', params, _this.options);
455
481
  case 20:
456
- response = _context6.sent;
457
- return _context6.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
482
+ response = _context7.sent;
483
+ return _context7.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
458
484
  case 22:
459
485
  case "end":
460
- return _context6.stop();
486
+ return _context7.stop();
461
487
  }
462
- }, _callee6);
488
+ }, _callee7);
463
489
  })));
464
490
  // Parameters:
465
491
  // recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders.
466
- (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
492
+ (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
467
493
  var params,
468
494
  response,
469
- _args7 = arguments;
470
- return _regenerator.default.wrap(function _callee7$(_context7) {
471
- while (1) switch (_context7.prev = _context7.next) {
495
+ _args8 = arguments;
496
+ return _regenerator.default.wrap(function _callee8$(_context8) {
497
+ while (1) switch (_context8.prev = _context8.next) {
472
498
  case 0:
473
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
499
+ params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
474
500
  if (_this.attributes.path) {
475
- _context7.next = 3;
501
+ _context8.next = 3;
476
502
  break;
477
503
  }
478
504
  throw new errors.EmptyPropertyError('Current object has no path');
479
505
  case 3:
480
506
  if ((0, _utils.isObject)(params)) {
481
- _context7.next = 5;
507
+ _context8.next = 5;
482
508
  break;
483
509
  }
484
510
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
485
511
  case 5:
486
512
  params.path = _this.attributes.path;
487
513
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
488
- _context7.next = 8;
514
+ _context8.next = 8;
489
515
  break;
490
516
  }
491
517
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
492
518
  case 8:
493
519
  if (params['path']) {
494
- _context7.next = 14;
520
+ _context8.next = 14;
495
521
  break;
496
522
  }
497
523
  if (!_this.attributes.path) {
498
- _context7.next = 13;
524
+ _context8.next = 13;
499
525
  break;
500
526
  }
501
527
  params['path'] = _this.path;
502
- _context7.next = 14;
528
+ _context8.next = 14;
503
529
  break;
504
530
  case 13:
505
531
  throw new errors.MissingParameterError('Parameter missing: path');
506
532
  case 14:
507
- _context7.next = 16;
533
+ _context8.next = 16;
508
534
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'DELETE', params, _this.options);
509
535
  case 16:
510
- response = _context7.sent;
511
- return _context7.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
536
+ response = _context8.sent;
537
+ return _context8.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
512
538
  case 18:
513
539
  case "end":
514
- return _context7.stop();
540
+ return _context8.stop();
515
541
  }
516
- }, _callee7);
542
+ }, _callee8);
517
543
  })));
518
544
  (0, _defineProperty2.default)(this, "destroy", function () {
519
545
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -524,153 +550,153 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
524
550
  // Parameters:
525
551
  // destination (required) - string - Copy destination path.
526
552
  // structure - boolean - Copy structure only?
527
- (0, _defineProperty2.default)(this, "copy", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
553
+ (0, _defineProperty2.default)(this, "copy", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
528
554
  var params,
529
555
  response,
530
- _args8 = arguments;
531
- return _regenerator.default.wrap(function _callee8$(_context8) {
532
- while (1) switch (_context8.prev = _context8.next) {
556
+ _args9 = arguments;
557
+ return _regenerator.default.wrap(function _callee9$(_context9) {
558
+ while (1) switch (_context9.prev = _context9.next) {
533
559
  case 0:
534
- params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
560
+ params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
535
561
  if (_this.attributes.path) {
536
- _context8.next = 3;
562
+ _context9.next = 3;
537
563
  break;
538
564
  }
539
565
  throw new errors.EmptyPropertyError('Current object has no path');
540
566
  case 3:
541
567
  if ((0, _utils.isObject)(params)) {
542
- _context8.next = 5;
568
+ _context9.next = 5;
543
569
  break;
544
570
  }
545
571
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
546
572
  case 5:
547
573
  params.path = _this.attributes.path;
548
574
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
549
- _context8.next = 8;
575
+ _context9.next = 8;
550
576
  break;
551
577
  }
552
578
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
553
579
  case 8:
554
580
  if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
555
- _context8.next = 10;
581
+ _context9.next = 10;
556
582
  break;
557
583
  }
558
584
  throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
559
585
  case 10:
560
586
  if (params['path']) {
561
- _context8.next = 16;
587
+ _context9.next = 16;
562
588
  break;
563
589
  }
564
590
  if (!_this.attributes.path) {
565
- _context8.next = 15;
591
+ _context9.next = 15;
566
592
  break;
567
593
  }
568
594
  params['path'] = _this.path;
569
- _context8.next = 16;
595
+ _context9.next = 16;
570
596
  break;
571
597
  case 15:
572
598
  throw new errors.MissingParameterError('Parameter missing: path');
573
599
  case 16:
574
600
  if (params['destination']) {
575
- _context8.next = 22;
601
+ _context9.next = 22;
576
602
  break;
577
603
  }
578
604
  if (!_this.attributes.destination) {
579
- _context8.next = 21;
605
+ _context9.next = 21;
580
606
  break;
581
607
  }
582
608
  params['destination'] = _this.destination;
583
- _context8.next = 22;
609
+ _context9.next = 22;
584
610
  break;
585
611
  case 21:
586
612
  throw new errors.MissingParameterError('Parameter missing: destination');
587
613
  case 22:
588
- _context8.next = 24;
614
+ _context9.next = 24;
589
615
  return _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
590
616
  case 24:
591
- response = _context8.sent;
592
- return _context8.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
617
+ response = _context9.sent;
618
+ return _context9.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
593
619
  case 26:
594
620
  case "end":
595
- return _context8.stop();
621
+ return _context9.stop();
596
622
  }
597
- }, _callee8);
623
+ }, _callee9);
598
624
  })));
599
625
  // Move file/folder
600
626
  //
601
627
  // Parameters:
602
628
  // destination (required) - string - Move destination path.
603
- (0, _defineProperty2.default)(this, "move", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
629
+ (0, _defineProperty2.default)(this, "move", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
604
630
  var params,
605
631
  response,
606
- _args9 = arguments;
607
- return _regenerator.default.wrap(function _callee9$(_context9) {
608
- while (1) switch (_context9.prev = _context9.next) {
632
+ _args10 = arguments;
633
+ return _regenerator.default.wrap(function _callee10$(_context10) {
634
+ while (1) switch (_context10.prev = _context10.next) {
609
635
  case 0:
610
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
636
+ params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
611
637
  if (_this.attributes.path) {
612
- _context9.next = 3;
638
+ _context10.next = 3;
613
639
  break;
614
640
  }
615
641
  throw new errors.EmptyPropertyError('Current object has no path');
616
642
  case 3:
617
643
  if ((0, _utils.isObject)(params)) {
618
- _context9.next = 5;
644
+ _context10.next = 5;
619
645
  break;
620
646
  }
621
647
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
622
648
  case 5:
623
649
  params.path = _this.attributes.path;
624
650
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
625
- _context9.next = 8;
651
+ _context10.next = 8;
626
652
  break;
627
653
  }
628
654
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
629
655
  case 8:
630
656
  if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
631
- _context9.next = 10;
657
+ _context10.next = 10;
632
658
  break;
633
659
  }
634
660
  throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
635
661
  case 10:
636
662
  if (params['path']) {
637
- _context9.next = 16;
663
+ _context10.next = 16;
638
664
  break;
639
665
  }
640
666
  if (!_this.attributes.path) {
641
- _context9.next = 15;
667
+ _context10.next = 15;
642
668
  break;
643
669
  }
644
670
  params['path'] = _this.path;
645
- _context9.next = 16;
671
+ _context10.next = 16;
646
672
  break;
647
673
  case 15:
648
674
  throw new errors.MissingParameterError('Parameter missing: path');
649
675
  case 16:
650
676
  if (params['destination']) {
651
- _context9.next = 22;
677
+ _context10.next = 22;
652
678
  break;
653
679
  }
654
680
  if (!_this.attributes.destination) {
655
- _context9.next = 21;
681
+ _context10.next = 21;
656
682
  break;
657
683
  }
658
684
  params['destination'] = _this.destination;
659
- _context9.next = 22;
685
+ _context10.next = 22;
660
686
  break;
661
687
  case 21:
662
688
  throw new errors.MissingParameterError('Parameter missing: destination');
663
689
  case 22:
664
- _context9.next = 24;
690
+ _context10.next = 24;
665
691
  return _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
666
692
  case 24:
667
- response = _context9.sent;
668
- return _context9.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
693
+ response = _context10.sent;
694
+ return _context10.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
669
695
  case 26:
670
696
  case "end":
671
- return _context9.stop();
697
+ return _context10.stop();
672
698
  }
673
- }, _callee9);
699
+ }, _callee10);
674
700
  })));
675
701
  // Begin file upload
676
702
  //
@@ -682,100 +708,100 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
682
708
  // restart - int64 - File byte offset to restart from.
683
709
  // size - int64 - Total bytes of file being uploaded (include bytes being retained if appending/restarting).
684
710
  // with_rename - boolean - Allow file rename instead of overwrite?
685
- (0, _defineProperty2.default)(this, "beginUpload", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
711
+ (0, _defineProperty2.default)(this, "beginUpload", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
686
712
  var _response$data;
687
713
  var params,
688
714
  response,
689
- _args10 = arguments;
690
- return _regenerator.default.wrap(function _callee10$(_context10) {
691
- while (1) switch (_context10.prev = _context10.next) {
715
+ _args11 = arguments;
716
+ return _regenerator.default.wrap(function _callee11$(_context11) {
717
+ while (1) switch (_context11.prev = _context11.next) {
692
718
  case 0:
693
- params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
719
+ params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
694
720
  if (_this.attributes.path) {
695
- _context10.next = 3;
721
+ _context11.next = 3;
696
722
  break;
697
723
  }
698
724
  throw new errors.EmptyPropertyError('Current object has no path');
699
725
  case 3:
700
726
  if ((0, _utils.isObject)(params)) {
701
- _context10.next = 5;
727
+ _context11.next = 5;
702
728
  break;
703
729
  }
704
730
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
705
731
  case 5:
706
732
  params.path = _this.attributes.path;
707
733
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
708
- _context10.next = 8;
734
+ _context11.next = 8;
709
735
  break;
710
736
  }
711
737
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
712
738
  case 8:
713
739
  if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
714
- _context10.next = 10;
740
+ _context11.next = 10;
715
741
  break;
716
742
  }
717
743
  throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(part)));
718
744
  case 10:
719
745
  if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
720
- _context10.next = 12;
746
+ _context11.next = 12;
721
747
  break;
722
748
  }
723
749
  throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(parts)));
724
750
  case 12:
725
751
  if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
726
- _context10.next = 14;
752
+ _context11.next = 14;
727
753
  break;
728
754
  }
729
755
  throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(ref)));
730
756
  case 14:
731
757
  if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
732
- _context10.next = 16;
758
+ _context11.next = 16;
733
759
  break;
734
760
  }
735
761
  throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(restart)));
736
762
  case 16:
737
763
  if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
738
- _context10.next = 18;
764
+ _context11.next = 18;
739
765
  break;
740
766
  }
741
767
  throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(size)));
742
768
  case 18:
743
769
  if (params['path']) {
744
- _context10.next = 24;
770
+ _context11.next = 24;
745
771
  break;
746
772
  }
747
773
  if (!_this.attributes.path) {
748
- _context10.next = 23;
774
+ _context11.next = 23;
749
775
  break;
750
776
  }
751
777
  params['path'] = _this.path;
752
- _context10.next = 24;
778
+ _context11.next = 24;
753
779
  break;
754
780
  case 23:
755
781
  throw new errors.MissingParameterError('Parameter missing: path');
756
782
  case 24:
757
- _context10.next = 26;
783
+ _context11.next = 26;
758
784
  return _Api.default.sendRequest("/file_actions/begin_upload/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
759
785
  case 26:
760
- response = _context10.sent;
761
- return _context10.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
786
+ response = _context11.sent;
787
+ return _context11.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
762
788
  return new _FileUploadPart.default(obj, _this.options);
763
789
  })) || []);
764
790
  case 28:
765
791
  case "end":
766
- return _context10.stop();
792
+ return _context11.stop();
767
793
  }
768
- }, _callee10);
794
+ }, _callee11);
769
795
  })));
770
796
  (0, _defineProperty2.default)(this, "save", function () {
771
797
  var newObject = File.create(_this.attributes.path, _this.attributes, _this.options);
772
798
  _this.attributes = _objectSpread({}, newObject.attributes);
773
799
  return true;
774
800
  });
775
- Object.entries(attributes).forEach(function (_ref11) {
776
- var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
777
- key = _ref12[0],
778
- value = _ref12[1];
801
+ Object.entries(attributes).forEach(function (_ref12) {
802
+ var _ref13 = (0, _slicedToArray2.default)(_ref12, 2),
803
+ key = _ref13[0],
804
+ value = _ref13[1];
779
805
  var normalizedKey = key.replace('?', '');
780
806
  _this.attributes[normalizedKey] = value;
781
807
  Object.defineProperty(_this, normalizedKey, {
@@ -786,117 +812,117 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
786
812
  this.options = _objectSpread({}, _options);
787
813
  });
788
814
  (0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
789
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw, options) {
815
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, paramsRaw, options) {
790
816
  var params, response, partData;
791
- return _regenerator.default.wrap(function _callee11$(_context11) {
792
- while (1) switch (_context11.prev = _context11.next) {
817
+ return _regenerator.default.wrap(function _callee12$(_context12) {
818
+ while (1) switch (_context12.prev = _context12.next) {
793
819
  case 0:
794
820
  params = _objectSpread(_objectSpread({}, paramsRaw), {}, {
795
821
  action: 'put'
796
822
  });
797
- _context11.next = 3;
823
+ _context12.next = 3;
798
824
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
799
825
  case 3:
800
- response = _context11.sent;
826
+ response = _context12.sent;
801
827
  if (response) {
802
- _context11.next = 6;
828
+ _context12.next = 6;
803
829
  break;
804
830
  }
805
- return _context11.abrupt("return", null);
831
+ return _context12.abrupt("return", null);
806
832
  case 6:
807
833
  partData = _objectSpread(_objectSpread({}, response.data), {}, {
808
834
  headers: response.headers,
809
835
  parameters: params
810
836
  });
811
- return _context11.abrupt("return", new _FileUploadPart.default(partData));
837
+ return _context12.abrupt("return", new _FileUploadPart.default(partData));
812
838
  case 8:
813
839
  case "end":
814
- return _context11.stop();
840
+ return _context12.stop();
815
841
  }
816
- }, _callee11);
842
+ }, _callee12);
817
843
  }));
818
844
  return function (_x7, _x8, _x9) {
819
- return _ref13.apply(this, arguments);
845
+ return _ref14.apply(this, arguments);
820
846
  };
821
847
  }());
822
848
  (0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
823
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart, options) {
849
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(path, partNumber, firstFileUploadPart, options) {
824
850
  var params, response, partData;
825
- return _regenerator.default.wrap(function _callee12$(_context12) {
826
- while (1) switch (_context12.prev = _context12.next) {
851
+ return _regenerator.default.wrap(function _callee13$(_context13) {
852
+ while (1) switch (_context13.prev = _context13.next) {
827
853
  case 0:
828
854
  params = {
829
855
  action: 'put',
830
856
  part: partNumber,
831
857
  ref: firstFileUploadPart.ref
832
858
  };
833
- _context12.next = 3;
859
+ _context13.next = 3;
834
860
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
835
861
  case 3:
836
- response = _context12.sent;
862
+ response = _context13.sent;
837
863
  if (response) {
838
- _context12.next = 6;
864
+ _context13.next = 6;
839
865
  break;
840
866
  }
841
- return _context12.abrupt("return", null);
867
+ return _context13.abrupt("return", null);
842
868
  case 6:
843
869
  partData = _objectSpread(_objectSpread({}, response.data), {}, {
844
870
  headers: response.headers,
845
871
  parameters: params
846
872
  });
847
- return _context12.abrupt("return", new _FileUploadPart.default(partData));
873
+ return _context13.abrupt("return", new _FileUploadPart.default(partData));
848
874
  case 8:
849
875
  case "end":
850
- return _context12.stop();
876
+ return _context13.stop();
851
877
  }
852
- }, _callee12);
878
+ }, _callee13);
853
879
  }));
854
880
  return function (_x10, _x11, _x12, _x13) {
855
- return _ref14.apply(this, arguments);
881
+ return _ref15.apply(this, arguments);
856
882
  };
857
883
  }());
858
884
  (0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
859
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart, options) {
885
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(firstFileUploadPart, options) {
860
886
  var params;
861
- return _regenerator.default.wrap(function _callee13$(_context13) {
862
- while (1) switch (_context13.prev = _context13.next) {
887
+ return _regenerator.default.wrap(function _callee14$(_context14) {
888
+ while (1) switch (_context14.prev = _context14.next) {
863
889
  case 0:
864
890
  params = {
865
891
  action: 'end',
866
892
  ref: firstFileUploadPart.ref
867
893
  };
868
- return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
894
+ return _context14.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
869
895
  case 2:
870
896
  case "end":
871
- return _context13.stop();
897
+ return _context14.stop();
872
898
  }
873
- }, _callee13);
899
+ }, _callee14);
874
900
  }));
875
901
  return function (_x14, _x15) {
876
- return _ref15.apply(this, arguments);
902
+ return _ref16.apply(this, arguments);
877
903
  };
878
904
  }());
879
905
  /**
880
906
  * @note see File.copy() for list of supported params
881
907
  */
882
908
  (0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
883
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params, options) {
909
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, readableStream, params, options) {
884
910
  var firstFileUploadPart, file;
885
- return _regenerator.default.wrap(function _callee16$(_context16) {
886
- while (1) switch (_context16.prev = _context16.next) {
911
+ return _regenerator.default.wrap(function _callee17$(_context17) {
912
+ while (1) switch (_context17.prev = _context17.next) {
887
913
  case 0:
888
- _context16.next = 2;
914
+ _context17.next = 2;
889
915
  return File._openUpload(destinationPath, params, options);
890
916
  case 2:
891
- firstFileUploadPart = _context16.sent;
917
+ firstFileUploadPart = _context17.sent;
892
918
  if (firstFileUploadPart) {
893
- _context16.next = 5;
919
+ _context17.next = 5;
894
920
  break;
895
921
  }
896
- return _context16.abrupt("return");
922
+ return _context17.abrupt("return");
897
923
  case 5:
898
- _context16.prev = 5;
899
- _context16.next = 8;
924
+ _context17.prev = 5;
925
+ _context17.next = 8;
900
926
  return new Promise(function (resolve, reject) {
901
927
  var part = 0;
902
928
  var chunks = [];
@@ -906,17 +932,17 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
906
932
  reject(error);
907
933
  });
908
934
  readableStream.on('data', /*#__PURE__*/function () {
909
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(chunk) {
935
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
910
936
  var nextLength, excessLength, chunkBuffer, tailLength, lastChunkForPart, firstChunkForNextPart, buffer, nextFileUploadPart;
911
- return _regenerator.default.wrap(function _callee14$(_context14) {
912
- while (1) switch (_context14.prev = _context14.next) {
937
+ return _regenerator.default.wrap(function _callee15$(_context15) {
938
+ while (1) switch (_context15.prev = _context15.next) {
913
939
  case 0:
914
- _context14.prev = 0;
940
+ _context15.prev = 0;
915
941
  nextLength = length + chunk.length;
916
942
  excessLength = nextLength - firstFileUploadPart.partsize;
917
943
  chunkBuffer = _safeBuffer.Buffer.from(chunk);
918
944
  if (!(excessLength > 0)) {
919
- _context14.next = 20;
945
+ _context15.next = 20;
920
946
  break;
921
947
  }
922
948
  readableStream.pause();
@@ -927,90 +953,90 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
927
953
  firstChunkForNextPart = chunkBuffer.subarray(tailLength);
928
954
  chunks.push(lastChunkForPart);
929
955
  buffer = _safeBuffer.Buffer.concat(chunks);
930
- _context14.next = 13;
956
+ _context15.next = 13;
931
957
  return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
932
958
  case 13:
933
- nextFileUploadPart = _context14.sent;
959
+ nextFileUploadPart = _context15.sent;
934
960
  concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
935
961
  chunks = [firstChunkForNextPart];
936
962
  length = firstChunkForNextPart.length;
937
963
  readableStream.resume();
938
- _context14.next = 22;
964
+ _context15.next = 22;
939
965
  break;
940
966
  case 20:
941
967
  chunks.push(chunkBuffer);
942
968
  length += chunk.length;
943
969
  case 22:
944
- _context14.next = 27;
970
+ _context15.next = 27;
945
971
  break;
946
972
  case 24:
947
- _context14.prev = 24;
948
- _context14.t0 = _context14["catch"](0);
949
- reject(_context14.t0);
973
+ _context15.prev = 24;
974
+ _context15.t0 = _context15["catch"](0);
975
+ reject(_context15.t0);
950
976
  case 27:
951
977
  case "end":
952
- return _context14.stop();
978
+ return _context15.stop();
953
979
  }
954
- }, _callee14, null, [[0, 24]]);
980
+ }, _callee15, null, [[0, 24]]);
955
981
  }));
956
982
  return function (_x20) {
957
- return _ref17.apply(this, arguments);
983
+ return _ref18.apply(this, arguments);
958
984
  };
959
985
  }());
960
- readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
986
+ readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
961
987
  var buffer, nextFileUploadPart, response, createdFile;
962
- return _regenerator.default.wrap(function _callee15$(_context15) {
963
- while (1) switch (_context15.prev = _context15.next) {
988
+ return _regenerator.default.wrap(function _callee16$(_context16) {
989
+ while (1) switch (_context16.prev = _context16.next) {
964
990
  case 0:
965
- _context15.prev = 0;
991
+ _context16.prev = 0;
966
992
  if (!(chunks.length > 0)) {
967
- _context15.next = 7;
993
+ _context16.next = 7;
968
994
  break;
969
995
  }
970
996
  buffer = _safeBuffer.Buffer.concat(chunks);
971
- _context15.next = 5;
997
+ _context16.next = 5;
972
998
  return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
973
999
  case 5:
974
- nextFileUploadPart = _context15.sent;
1000
+ nextFileUploadPart = _context16.sent;
975
1001
  concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
976
1002
  case 7:
977
- _context15.next = 9;
1003
+ _context16.next = 9;
978
1004
  return Promise.all(concurrentUploads);
979
1005
  case 9:
980
- _context15.next = 11;
1006
+ _context16.next = 11;
981
1007
  return File._completeUpload(firstFileUploadPart, options);
982
1008
  case 11:
983
- response = _context15.sent;
1009
+ response = _context16.sent;
984
1010
  createdFile = new File(response.data, options);
985
1011
  resolve(createdFile);
986
- _context15.next = 19;
1012
+ _context16.next = 19;
987
1013
  break;
988
1014
  case 16:
989
- _context15.prev = 16;
990
- _context15.t0 = _context15["catch"](0);
991
- reject(_context15.t0);
1015
+ _context16.prev = 16;
1016
+ _context16.t0 = _context16["catch"](0);
1017
+ reject(_context16.t0);
992
1018
  case 19:
993
1019
  case "end":
994
- return _context15.stop();
1020
+ return _context16.stop();
995
1021
  }
996
- }, _callee15, null, [[0, 16]]);
1022
+ }, _callee16, null, [[0, 16]]);
997
1023
  })));
998
1024
  });
999
1025
  case 8:
1000
- file = _context16.sent;
1001
- return _context16.abrupt("return", file);
1026
+ file = _context17.sent;
1027
+ return _context17.abrupt("return", file);
1002
1028
  case 12:
1003
- _context16.prev = 12;
1004
- _context16.t0 = _context16["catch"](5);
1005
- errors.handleErrorResponse(_context16.t0);
1029
+ _context17.prev = 12;
1030
+ _context17.t0 = _context17["catch"](5);
1031
+ errors.handleErrorResponse(_context17.t0);
1006
1032
  case 15:
1007
1033
  case "end":
1008
- return _context16.stop();
1034
+ return _context17.stop();
1009
1035
  }
1010
- }, _callee16, null, [[5, 12]]);
1036
+ }, _callee17, null, [[5, 12]]);
1011
1037
  }));
1012
1038
  return function (_x16, _x17, _x18, _x19) {
1013
- return _ref16.apply(this, arguments);
1039
+ return _ref17.apply(this, arguments);
1014
1040
  };
1015
1041
  }());
1016
1042
  /**
@@ -1018,53 +1044,53 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1018
1044
  * @note see File.copy() for list of supported params
1019
1045
  */
1020
1046
  (0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
1021
- var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params, options) {
1022
- return _regenerator.default.wrap(function _callee17$(_context17) {
1023
- while (1) switch (_context17.prev = _context17.next) {
1047
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, data, params, options) {
1048
+ return _regenerator.default.wrap(function _callee18$(_context18) {
1049
+ while (1) switch (_context18.prev = _context18.next) {
1024
1050
  case 0:
1025
1051
  if (data) {
1026
- _context17.next = 2;
1052
+ _context18.next = 2;
1027
1053
  break;
1028
1054
  }
1029
1055
  throw new errors.MissingParameterError('Upload data was not provided');
1030
1056
  case 2:
1031
- return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
1057
+ return _context18.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
1032
1058
  case 3:
1033
1059
  case "end":
1034
- return _context17.stop();
1060
+ return _context18.stop();
1035
1061
  }
1036
- }, _callee17);
1062
+ }, _callee18);
1037
1063
  }));
1038
1064
  return function (_x21, _x22, _x23, _x24) {
1039
- return _ref19.apply(this, arguments);
1065
+ return _ref20.apply(this, arguments);
1040
1066
  };
1041
1067
  }());
1042
1068
  /**
1043
1069
  * @note see File.copy() for list of supported params
1044
1070
  */
1045
1071
  (0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
1046
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params, options) {
1047
- var _require3, openDiskFileReadStream, stream;
1048
- return _regenerator.default.wrap(function _callee18$(_context18) {
1049
- while (1) switch (_context18.prev = _context18.next) {
1072
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(destinationPath, sourceFilePath, params, options) {
1073
+ var _require4, openDiskFileReadStream, stream;
1074
+ return _regenerator.default.wrap(function _callee19$(_context19) {
1075
+ while (1) switch (_context19.prev = _context19.next) {
1050
1076
  case 0:
1051
1077
  if (!(0, _utils.isBrowser)()) {
1052
- _context18.next = 2;
1078
+ _context19.next = 2;
1053
1079
  break;
1054
1080
  }
1055
1081
  throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment');
1056
1082
  case 2:
1057
- _require3 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require3.openDiskFileReadStream;
1083
+ _require4 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require4.openDiskFileReadStream;
1058
1084
  stream = openDiskFileReadStream(sourceFilePath);
1059
- return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params, options));
1085
+ return _context19.abrupt("return", File.uploadStream(destinationPath, stream, params, options));
1060
1086
  case 5:
1061
1087
  case "end":
1062
- return _context18.stop();
1088
+ return _context19.stop();
1063
1089
  }
1064
- }, _callee18);
1090
+ }, _callee19);
1065
1091
  }));
1066
1092
  return function (_x25, _x26, _x27, _x28) {
1067
- return _ref20.apply(this, arguments);
1093
+ return _ref21.apply(this, arguments);
1068
1094
  };
1069
1095
  }());
1070
1096
  // Parameters:
@@ -1083,102 +1109,102 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1083
1109
  // structure - string - If copying folder, copy just the structure?
1084
1110
  // with_rename - boolean - Allow file rename instead of overwrite?
1085
1111
  (0, _defineProperty2.default)(File, "create", /*#__PURE__*/function () {
1086
- var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(path) {
1112
+ var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
1087
1113
  var params,
1088
1114
  options,
1089
1115
  response,
1090
- _args19 = arguments;
1091
- return _regenerator.default.wrap(function _callee19$(_context19) {
1092
- while (1) switch (_context19.prev = _context19.next) {
1116
+ _args20 = arguments;
1117
+ return _regenerator.default.wrap(function _callee20$(_context20) {
1118
+ while (1) switch (_context20.prev = _context20.next) {
1093
1119
  case 0:
1094
- params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
1095
- options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
1120
+ params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1121
+ options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
1096
1122
  if ((0, _utils.isObject)(params)) {
1097
- _context19.next = 4;
1123
+ _context20.next = 4;
1098
1124
  break;
1099
1125
  }
1100
1126
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
1101
1127
  case 4:
1102
1128
  params['path'] = path;
1103
1129
  if (params['path']) {
1104
- _context19.next = 7;
1130
+ _context20.next = 7;
1105
1131
  break;
1106
1132
  }
1107
1133
  throw new errors.MissingParameterError('Parameter missing: path');
1108
1134
  case 7:
1109
1135
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
1110
- _context19.next = 9;
1136
+ _context20.next = 9;
1111
1137
  break;
1112
1138
  }
1113
1139
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
1114
1140
  case 9:
1115
1141
  if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
1116
- _context19.next = 11;
1142
+ _context20.next = 11;
1117
1143
  break;
1118
1144
  }
1119
1145
  throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params['action'])));
1120
1146
  case 11:
1121
1147
  if (!(params['length'] && !(0, _utils.isInt)(params['length']))) {
1122
- _context19.next = 13;
1148
+ _context20.next = 13;
1123
1149
  break;
1124
1150
  }
1125
1151
  throw new errors.InvalidParameterError("Bad parameter: length must be of type Int, received ".concat((0, _utils.getType)(params['length'])));
1126
1152
  case 13:
1127
1153
  if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
1128
- _context19.next = 15;
1154
+ _context20.next = 15;
1129
1155
  break;
1130
1156
  }
1131
1157
  throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params['part'])));
1132
1158
  case 15:
1133
1159
  if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
1134
- _context19.next = 17;
1160
+ _context20.next = 17;
1135
1161
  break;
1136
1162
  }
1137
1163
  throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params['parts'])));
1138
1164
  case 17:
1139
1165
  if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
1140
- _context19.next = 19;
1166
+ _context20.next = 19;
1141
1167
  break;
1142
1168
  }
1143
1169
  throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params['provided_mtime'])));
1144
1170
  case 19:
1145
1171
  if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
1146
- _context19.next = 21;
1172
+ _context20.next = 21;
1147
1173
  break;
1148
1174
  }
1149
1175
  throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params['ref'])));
1150
1176
  case 21:
1151
1177
  if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
1152
- _context19.next = 23;
1178
+ _context20.next = 23;
1153
1179
  break;
1154
1180
  }
1155
1181
  throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params['restart'])));
1156
1182
  case 23:
1157
1183
  if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
1158
- _context19.next = 25;
1184
+ _context20.next = 25;
1159
1185
  break;
1160
1186
  }
1161
1187
  throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params['size'])));
1162
1188
  case 25:
1163
1189
  if (!(params['structure'] && !(0, _utils.isString)(params['structure']))) {
1164
- _context19.next = 27;
1190
+ _context20.next = 27;
1165
1191
  break;
1166
1192
  }
1167
1193
  throw new errors.InvalidParameterError("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(params['structure'])));
1168
1194
  case 27:
1169
- _context19.next = 29;
1195
+ _context20.next = 29;
1170
1196
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'POST', params, options);
1171
1197
  case 29:
1172
- response = _context19.sent;
1173
- return _context19.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1198
+ response = _context20.sent;
1199
+ return _context20.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1174
1200
  case 31:
1175
1201
  case "end":
1176
- return _context19.stop();
1202
+ return _context20.stop();
1177
1203
  }
1178
- }, _callee19);
1204
+ }, _callee20);
1179
1205
  }));
1180
1206
  return function (_x29) {
1181
- return _ref21.apply(this, arguments);
1207
+ return _ref22.apply(this, arguments);
1182
1208
  };
1183
1209
  }());
1184
1210
  // Parameters:
@@ -1187,54 +1213,54 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1187
1213
  // with_previews - boolean - Include file preview information?
1188
1214
  // with_priority_color - boolean - Include file priority color information?
1189
1215
  (0, _defineProperty2.default)(File, "find", /*#__PURE__*/function () {
1190
- var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
1216
+ var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(path) {
1191
1217
  var params,
1192
1218
  options,
1193
1219
  response,
1194
- _args20 = arguments;
1195
- return _regenerator.default.wrap(function _callee20$(_context20) {
1196
- while (1) switch (_context20.prev = _context20.next) {
1220
+ _args21 = arguments;
1221
+ return _regenerator.default.wrap(function _callee21$(_context21) {
1222
+ while (1) switch (_context21.prev = _context21.next) {
1197
1223
  case 0:
1198
- params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1199
- options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
1224
+ params = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
1225
+ options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
1200
1226
  if ((0, _utils.isObject)(params)) {
1201
- _context20.next = 4;
1227
+ _context21.next = 4;
1202
1228
  break;
1203
1229
  }
1204
1230
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
1205
1231
  case 4:
1206
1232
  params['path'] = path;
1207
1233
  if (params['path']) {
1208
- _context20.next = 7;
1234
+ _context21.next = 7;
1209
1235
  break;
1210
1236
  }
1211
1237
  throw new errors.MissingParameterError('Parameter missing: path');
1212
1238
  case 7:
1213
1239
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
1214
- _context20.next = 9;
1240
+ _context21.next = 9;
1215
1241
  break;
1216
1242
  }
1217
1243
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
1218
1244
  case 9:
1219
1245
  if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
1220
- _context20.next = 11;
1246
+ _context21.next = 11;
1221
1247
  break;
1222
1248
  }
1223
1249
  throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params['preview_size'])));
1224
1250
  case 11:
1225
- _context20.next = 13;
1251
+ _context21.next = 13;
1226
1252
  return _Api.default.sendRequest("/file_actions/metadata/".concat(encodeURIComponent(params['path'])), 'GET', params, options);
1227
1253
  case 13:
1228
- response = _context20.sent;
1229
- return _context20.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1254
+ response = _context21.sent;
1255
+ return _context21.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1230
1256
  case 15:
1231
1257
  case "end":
1232
- return _context20.stop();
1258
+ return _context21.stop();
1233
1259
  }
1234
- }, _callee20);
1260
+ }, _callee21);
1235
1261
  }));
1236
1262
  return function (_x30) {
1237
- return _ref22.apply(this, arguments);
1263
+ return _ref23.apply(this, arguments);
1238
1264
  };
1239
1265
  }());
1240
1266
  (0, _defineProperty2.default)(File, "get", function (path) {