files.com 1.0.213 → 1.0.214

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,7 +50,9 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
50
50
  var _this = this;
51
51
 
52
52
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
53
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
53
+
54
+ var _options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
55
+
54
56
  (0, _classCallCheck2.default)(this, File);
55
57
  (0, _defineProperty2.default)(this, "attributes", {});
56
58
  (0, _defineProperty2.default)(this, "options", {});
@@ -140,7 +142,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
140
142
  };
141
143
  }());
142
144
  (0, _defineProperty2.default)(this, "copyTo", /*#__PURE__*/function () {
143
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath) {
145
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath, options) {
144
146
  var params;
145
147
  return _regenerator.default.wrap(function _callee3$(_context3) {
146
148
  while (1) {
@@ -149,7 +151,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
149
151
  params = {
150
152
  destination: destinationFilePath
151
153
  };
152
- return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params));
154
+ return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
153
155
 
154
156
  case 2:
155
157
  case "end":
@@ -159,12 +161,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
159
161
  }, _callee3);
160
162
  }));
161
163
 
162
- return function (_x3) {
164
+ return function (_x3, _x4) {
163
165
  return _ref3.apply(this, arguments);
164
166
  };
165
167
  }());
166
168
  (0, _defineProperty2.default)(this, "moveTo", /*#__PURE__*/function () {
167
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath) {
169
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath, options) {
168
170
  var params;
169
171
  return _regenerator.default.wrap(function _callee4$(_context4) {
170
172
  while (1) {
@@ -173,7 +175,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
173
175
  params = {
174
176
  destination: destinationFilePath
175
177
  };
176
- return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params));
178
+ return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
177
179
 
178
180
  case 2:
179
181
  case "end":
@@ -183,7 +185,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
183
185
  }, _callee4);
184
186
  }));
185
187
 
186
- return function (_x4) {
188
+ return function (_x5, _x6) {
187
189
  return _ref4.apply(this, arguments);
188
190
  };
189
191
  }());
@@ -897,10 +899,10 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
897
899
  writable: false
898
900
  });
899
901
  });
900
- this.options = _objectSpread({}, options);
902
+ this.options = _objectSpread({}, _options);
901
903
  });
902
904
  (0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
903
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw) {
905
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw, options) {
904
906
  var params, response, partData;
905
907
  return _regenerator.default.wrap(function _callee11$(_context11) {
906
908
  while (1) {
@@ -910,7 +912,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
910
912
  action: 'put'
911
913
  });
912
914
  _context11.next = 3;
913
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params);
915
+ return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
914
916
 
915
917
  case 3:
916
918
  response = _context11.sent;
@@ -937,12 +939,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
937
939
  }, _callee11);
938
940
  }));
939
941
 
940
- return function (_x5, _x6) {
942
+ return function (_x7, _x8, _x9) {
941
943
  return _ref13.apply(this, arguments);
942
944
  };
943
945
  }());
944
946
  (0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
945
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart) {
947
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart, options) {
946
948
  var params, response, partData;
947
949
  return _regenerator.default.wrap(function _callee12$(_context12) {
948
950
  while (1) {
@@ -954,7 +956,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
954
956
  ref: firstFileUploadPart.ref
955
957
  };
956
958
  _context12.next = 3;
957
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params);
959
+ return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
958
960
 
959
961
  case 3:
960
962
  response = _context12.sent;
@@ -981,12 +983,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
981
983
  }, _callee12);
982
984
  }));
983
985
 
984
- return function (_x7, _x8, _x9) {
986
+ return function (_x10, _x11, _x12, _x13) {
985
987
  return _ref14.apply(this, arguments);
986
988
  };
987
989
  }());
988
990
  (0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
989
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart) {
991
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart, options) {
990
992
  var params;
991
993
  return _regenerator.default.wrap(function _callee13$(_context13) {
992
994
  while (1) {
@@ -996,7 +998,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
996
998
  action: 'end',
997
999
  ref: firstFileUploadPart.ref
998
1000
  };
999
- return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params));
1001
+ return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
1000
1002
 
1001
1003
  case 2:
1002
1004
  case "end":
@@ -1006,19 +1008,19 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1006
1008
  }, _callee13);
1007
1009
  }));
1008
1010
 
1009
- return function (_x10) {
1011
+ return function (_x14, _x15) {
1010
1012
  return _ref15.apply(this, arguments);
1011
1013
  };
1012
1014
  }());
1013
1015
  (0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
1014
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params) {
1016
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params, options) {
1015
1017
  var firstFileUploadPart, file;
1016
1018
  return _regenerator.default.wrap(function _callee16$(_context16) {
1017
1019
  while (1) {
1018
1020
  switch (_context16.prev = _context16.next) {
1019
1021
  case 0:
1020
1022
  _context16.next = 2;
1021
- return File._openUpload(destinationPath, params);
1023
+ return File._openUpload(destinationPath, params, options);
1022
1024
 
1023
1025
  case 2:
1024
1026
  firstFileUploadPart = _context16.sent;
@@ -1064,7 +1066,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1064
1066
  chunks.push(lastChunkForPart);
1065
1067
  buffer = _safeBuffer.Buffer.concat(chunks);
1066
1068
  _context14.next = 12;
1067
- return File._continueUpload(destinationPath, ++part, firstFileUploadPart);
1069
+ return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
1068
1070
 
1069
1071
  case 12:
1070
1072
  nextFileUploadPart = _context14.sent;
@@ -1096,7 +1098,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1096
1098
  }, _callee14, null, [[0, 23]]);
1097
1099
  }));
1098
1100
 
1099
- return function (_x14) {
1101
+ return function (_x20) {
1100
1102
  return _ref17.apply(this, arguments);
1101
1103
  };
1102
1104
  }());
@@ -1115,7 +1117,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1115
1117
 
1116
1118
  buffer = _safeBuffer.Buffer.concat(chunks);
1117
1119
  _context15.next = 5;
1118
- return File._continueUpload(destinationPath, ++part, firstFileUploadPart);
1120
+ return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
1119
1121
 
1120
1122
  case 5:
1121
1123
  nextFileUploadPart = _context15.sent;
@@ -1127,11 +1129,11 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1127
1129
 
1128
1130
  case 9:
1129
1131
  _context15.next = 11;
1130
- return File._completeUpload(firstFileUploadPart);
1132
+ return File._completeUpload(firstFileUploadPart, options);
1131
1133
 
1132
1134
  case 11:
1133
1135
  response = _context15.sent;
1134
- createdFile = new File(response.data);
1136
+ createdFile = new File(response.data, options);
1135
1137
  resolve(createdFile);
1136
1138
  _context15.next = 19;
1137
1139
  break;
@@ -1167,12 +1169,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1167
1169
  }, _callee16, null, [[5, 12]]);
1168
1170
  }));
1169
1171
 
1170
- return function (_x11, _x12, _x13) {
1172
+ return function (_x16, _x17, _x18, _x19) {
1171
1173
  return _ref16.apply(this, arguments);
1172
1174
  };
1173
1175
  }());
1174
1176
  (0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
1175
- var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params) {
1177
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params, options) {
1176
1178
  return _regenerator.default.wrap(function _callee17$(_context17) {
1177
1179
  while (1) {
1178
1180
  switch (_context17.prev = _context17.next) {
@@ -1185,7 +1187,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1185
1187
  throw new errors.MissingParameterError('Upload data was not provided');
1186
1188
 
1187
1189
  case 2:
1188
- return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params));
1190
+ return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
1189
1191
 
1190
1192
  case 3:
1191
1193
  case "end":
@@ -1195,12 +1197,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1195
1197
  }, _callee17);
1196
1198
  }));
1197
1199
 
1198
- return function (_x15, _x16, _x17) {
1200
+ return function (_x21, _x22, _x23, _x24) {
1199
1201
  return _ref19.apply(this, arguments);
1200
1202
  };
1201
1203
  }());
1202
1204
  (0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
1203
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params) {
1205
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params, options) {
1204
1206
  var _require3, openDiskFileReadStream, stream;
1205
1207
 
1206
1208
  return _regenerator.default.wrap(function _callee18$(_context18) {
@@ -1217,7 +1219,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1217
1219
  case 2:
1218
1220
  _require3 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require3.openDiskFileReadStream;
1219
1221
  stream = openDiskFileReadStream(sourceFilePath);
1220
- return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params));
1222
+ return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params, options));
1221
1223
 
1222
1224
  case 5:
1223
1225
  case "end":
@@ -1227,7 +1229,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1227
1229
  }, _callee18);
1228
1230
  }));
1229
1231
 
1230
- return function (_x18, _x19, _x20) {
1232
+ return function (_x25, _x26, _x27, _x28) {
1231
1233
  return _ref20.apply(this, arguments);
1232
1234
  };
1233
1235
  }());
@@ -1357,7 +1359,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1357
1359
  }, _callee19);
1358
1360
  }));
1359
1361
 
1360
- return function (_x21) {
1362
+ return function (_x29) {
1361
1363
  return _ref21.apply(this, arguments);
1362
1364
  };
1363
1365
  }());
@@ -1423,7 +1425,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1423
1425
  }, _callee20);
1424
1426
  }));
1425
1427
 
1426
- return function (_x22) {
1428
+ return function (_x30) {
1427
1429
  return _ref22.apply(this, arguments);
1428
1430
  };
1429
1431
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.213",
3
+ "version": "1.0.214",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Api.js CHANGED
@@ -37,7 +37,14 @@ class Api {
37
37
  : `${baseUrl}${Files.getEndpointPrefix()}${path}`
38
38
 
39
39
  Logger.debug(`Sending request: ${verb} ${url}`)
40
- Logger.debug('Sending options:', options)
40
+
41
+ Logger.debug('Sending options:', {
42
+ ...options,
43
+ headers: {
44
+ ...options.headers,
45
+ 'X-FilesAPI-Key': '<redacted>',
46
+ },
47
+ })
41
48
 
42
49
  Api._configureAutoRetry()
43
50
 
@@ -78,7 +85,7 @@ class Api {
78
85
  }
79
86
 
80
87
  static _autoPaginate = async (path, verb, params, options, response, metadata) => {
81
- if (Files.getAutoPaginate()) {
88
+ if (options.autoPaginate ?? Files.getAutoPaginate()) {
82
89
  const nextCursor = response?.headers?.['x-files-cursor']
83
90
 
84
91
  const {
package/src/Errors.js CHANGED
@@ -94,6 +94,7 @@ export class BadRequest_DestinationSameError extends BadRequestError { construct
94
94
  export class BadRequest_FolderMustNotBeAFileError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_FolderMustNotBeAFileError' } } errorClasses.BadRequest_FolderMustNotBeAFileError = BadRequest_FolderMustNotBeAFileError
95
95
  export class BadRequest_InvalidBodyError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidBodyError' } } errorClasses.BadRequest_InvalidBodyError = BadRequest_InvalidBodyError
96
96
  export class BadRequest_InvalidCursorError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidCursorError' } } errorClasses.BadRequest_InvalidCursorError = BadRequest_InvalidCursorError
97
+ export class BadRequest_InvalidCursorTypeForSortError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidCursorTypeForSortError' } } errorClasses.BadRequest_InvalidCursorTypeForSortError = BadRequest_InvalidCursorTypeForSortError
97
98
  export class BadRequest_InvalidEtagsError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidEtagsError' } } errorClasses.BadRequest_InvalidEtagsError = BadRequest_InvalidEtagsError
98
99
  export class BadRequest_InvalidFilterCombinationError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidFilterCombinationError' } } errorClasses.BadRequest_InvalidFilterCombinationError = BadRequest_InvalidFilterCombinationError
99
100
  export class BadRequest_InvalidFilterFieldError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidFilterFieldError' } } errorClasses.BadRequest_InvalidFilterFieldError = BadRequest_InvalidFilterFieldError
@@ -28,9 +28,9 @@ class File {
28
28
  }
29
29
 
30
30
  isLoaded = () => !!this.attributes.path
31
- static _openUpload = async (path, paramsRaw) => {
31
+ static _openUpload = async (path, paramsRaw, options) => {
32
32
  const params = { ...paramsRaw, action: 'put' }
33
- const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params)
33
+ const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params, options)
34
34
 
35
35
  if (!response) {
36
36
  return null
@@ -45,14 +45,14 @@ class File {
45
45
  return new FileUploadPart(partData)
46
46
  }
47
47
 
48
- static _continueUpload = async (path, partNumber, firstFileUploadPart) => {
48
+ static _continueUpload = async (path, partNumber, firstFileUploadPart, options) => {
49
49
  const params = {
50
50
  action: 'put',
51
51
  part: partNumber,
52
52
  ref: firstFileUploadPart.ref,
53
53
  }
54
54
 
55
- const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params)
55
+ const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params, options)
56
56
 
57
57
  if (!response) {
58
58
  return null
@@ -67,20 +67,20 @@ class File {
67
67
  return new FileUploadPart(partData)
68
68
  }
69
69
 
70
- static _completeUpload = async firstFileUploadPart => {
70
+ static _completeUpload = async (firstFileUploadPart, options) => {
71
71
  const params = {
72
72
  action: 'end',
73
73
  ref: firstFileUploadPart.ref,
74
74
  }
75
75
 
76
- return Api.sendRequest(`/files/${encodeURIComponent(firstFileUploadPart.path)}`, 'POST', params)
76
+ return Api.sendRequest(`/files/${encodeURIComponent(firstFileUploadPart.path)}`, 'POST', params, options)
77
77
  }
78
78
 
79
79
  /**
80
80
  * @note see File.copy() for list of supported params
81
81
  */
82
- static uploadStream = async (destinationPath, readableStream, params) => {
83
- const firstFileUploadPart = await File._openUpload(destinationPath, params)
82
+ static uploadStream = async (destinationPath, readableStream, params, options) => {
83
+ const firstFileUploadPart = await File._openUpload(destinationPath, params, options)
84
84
 
85
85
  if (!firstFileUploadPart) {
86
86
  return
@@ -111,7 +111,7 @@ class File {
111
111
  chunks.push(lastChunkForPart)
112
112
 
113
113
  const buffer = Buffer.concat(chunks)
114
- const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart)
114
+ const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
115
115
 
116
116
  concurrentUploads.push(Api.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer))
117
117
 
@@ -132,15 +132,15 @@ class File {
132
132
  try {
133
133
  if (chunks.length > 0) {
134
134
  const buffer = Buffer.concat(chunks)
135
- const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart)
135
+ const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
136
136
 
137
137
  concurrentUploads.push(Api.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer))
138
138
  }
139
139
 
140
140
  await Promise.all(concurrentUploads)
141
141
 
142
- const response = await File._completeUpload(firstFileUploadPart)
143
- const createdFile = new File(response.data)
142
+ const response = await File._completeUpload(firstFileUploadPart, options)
143
+ const createdFile = new File(response.data, options)
144
144
 
145
145
  resolve(createdFile)
146
146
  } catch (error) {
@@ -159,18 +159,18 @@ class File {
159
159
  * data - string, Buffer, Stream, any object implementing Symbol.iterator or Symbol.asyncIterator
160
160
  * @note see File.copy() for list of supported params
161
161
  */
162
- static uploadData = async (destinationPath, data, params) => {
162
+ static uploadData = async (destinationPath, data, params, options) => {
163
163
  if (!data) {
164
164
  throw new errors.MissingParameterError('Upload data was not provided')
165
165
  }
166
166
 
167
- return File.uploadStream(destinationPath, Readable.from(data), params)
167
+ return File.uploadStream(destinationPath, Readable.from(data), params, options)
168
168
  }
169
169
 
170
170
  /**
171
171
  * @note see File.copy() for list of supported params
172
172
  */
173
- static uploadFile = async (destinationPath, sourceFilePath, params) => {
173
+ static uploadFile = async (destinationPath, sourceFilePath, params, options) => {
174
174
  if (isBrowser()) {
175
175
  throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment')
176
176
  }
@@ -178,7 +178,7 @@ class File {
178
178
  const { openDiskFileReadStream } = require('../isomorphic/File.node.js')
179
179
  const stream = openDiskFileReadStream(sourceFilePath)
180
180
 
181
- return File.uploadStream(destinationPath, stream, params)
181
+ return File.uploadStream(destinationPath, stream, params, options)
182
182
  }
183
183
 
184
184
  downloadToStream = async writableStream => {
@@ -211,14 +211,14 @@ class File {
211
211
  return saveUrlToFile(downloadUri, destinationPath)
212
212
  }
213
213
 
214
- copyTo = async destinationFilePath => {
214
+ copyTo = async (destinationFilePath, options) => {
215
215
  const params = { destination: destinationFilePath }
216
- return Api.sendRequest(`/file_actions/copy/${encodeURIComponent(this.path)}`, 'POST', params)
216
+ return Api.sendRequest(`/file_actions/copy/${encodeURIComponent(this.path)}`, 'POST', params, options)
217
217
  }
218
218
 
219
- moveTo = async destinationFilePath => {
219
+ moveTo = async (destinationFilePath, options) => {
220
220
  const params = { destination: destinationFilePath }
221
- return Api.sendRequest(`/file_actions/move/${encodeURIComponent(this.path)}`, 'POST', params)
221
+ return Api.sendRequest(`/file_actions/move/${encodeURIComponent(this.path)}`, 'POST', params, options)
222
222
  }
223
223
 
224
224
  // string # File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
package/test/src/index.js CHANGED
@@ -46,6 +46,7 @@ const testSuite = async () => {
46
46
  Files.configureNetwork({
47
47
  autoPaginate: false,
48
48
  })
49
+
49
50
  const firstPageItems = await Folder.listFor('/', { per_page: 1 })
50
51
 
51
52
  assert(firstPageItems.length === 1)
@@ -53,6 +54,7 @@ const testSuite = async () => {
53
54
  Files.configureNetwork({
54
55
  autoPaginate: true,
55
56
  })
57
+
56
58
  // note: this test will fail if the root folder has <= 1 file or folder
57
59
  const allPageItems = await Folder.listFor('/', { per_page: 1 })
58
60