files.com 1.0.474 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/Files.js +1 -1
- package/lib/models/ActionNotificationExport.js +63 -49
- package/lib/models/ActionWebhookFailure.js +1 -1
- package/lib/models/ApiKey.js +113 -94
- package/lib/models/As2Partner.js +81 -62
- package/lib/models/As2Station.js +79 -60
- package/lib/models/Automation.js +90 -71
- package/lib/models/Behavior.js +114 -95
- package/lib/models/Bundle.js +90 -71
- package/lib/models/BundleNotification.js +75 -56
- package/lib/models/BundleRecipient.js +61 -47
- package/lib/models/Clickwrap.js +77 -58
- package/lib/models/ExternalEvent.js +71 -57
- package/lib/models/File.js +166 -154
- package/lib/models/FileComment.js +65 -46
- package/lib/models/FileCommentReaction.js +44 -30
- package/lib/models/Folder.js +58 -46
- package/lib/models/FormFieldSet.js +76 -57
- package/lib/models/GpgKey.js +79 -60
- package/lib/models/Group.js +78 -59
- package/lib/models/GroupUser.js +63 -44
- package/lib/models/HistoryExport.js +76 -62
- package/lib/models/InboxRecipient.js +61 -47
- package/lib/models/Lock.js +56 -44
- package/lib/models/Message.js +82 -63
- package/lib/models/MessageComment.js +78 -59
- package/lib/models/MessageCommentReaction.js +73 -59
- package/lib/models/MessageReaction.js +73 -59
- package/lib/models/Notification.js +84 -65
- package/lib/models/Permission.js +60 -46
- package/lib/models/Project.js +74 -55
- package/lib/models/PublicKey.js +78 -59
- package/lib/models/RemoteServer.js +147 -128
- package/lib/models/Request.js +76 -62
- package/lib/models/Session.js +53 -39
- package/lib/models/SftpHostKey.js +74 -55
- package/lib/models/ShareGroup.js +79 -60
- package/lib/models/Snapshot.js +75 -56
- package/lib/models/SsoStrategy.js +1 -1
- package/lib/models/Style.js +37 -23
- package/lib/models/User.js +104 -85
- package/lib/models/UserRequest.js +73 -59
- package/lib/models/WebhookTest.js +46 -32
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/ActionNotificationExport.js +2 -2
- package/src/models/ActionWebhookFailure.js +1 -1
- package/src/models/ApiKey.js +7 -5
- package/src/models/As2Partner.js +6 -4
- package/src/models/As2Station.js +6 -4
- package/src/models/Automation.js +7 -5
- package/src/models/Behavior.js +7 -5
- package/src/models/Bundle.js +7 -5
- package/src/models/BundleNotification.js +6 -4
- package/src/models/BundleRecipient.js +2 -2
- package/src/models/Clickwrap.js +6 -4
- package/src/models/ExternalEvent.js +2 -2
- package/src/models/File.js +3 -3
- package/src/models/FileComment.js +6 -4
- package/src/models/FileCommentReaction.js +3 -3
- package/src/models/Folder.js +2 -2
- package/src/models/FormFieldSet.js +6 -4
- package/src/models/GpgKey.js +6 -4
- package/src/models/Group.js +6 -4
- package/src/models/GroupUser.js +6 -4
- package/src/models/HistoryExport.js +2 -2
- package/src/models/InboxRecipient.js +2 -2
- package/src/models/Lock.js +3 -3
- package/src/models/Message.js +6 -4
- package/src/models/MessageComment.js +6 -4
- package/src/models/MessageCommentReaction.js +3 -3
- package/src/models/MessageReaction.js +3 -3
- package/src/models/Notification.js +6 -4
- package/src/models/Permission.js +3 -3
- package/src/models/Project.js +6 -4
- package/src/models/PublicKey.js +6 -4
- package/src/models/RemoteServer.js +6 -4
- package/src/models/Request.js +3 -3
- package/src/models/Session.js +3 -3
- package/src/models/SftpHostKey.js +6 -4
- package/src/models/ShareGroup.js +6 -4
- package/src/models/Snapshot.js +6 -4
- package/src/models/SsoStrategy.js +1 -1
- package/src/models/Style.js +6 -3
- package/src/models/User.js +9 -7
- package/src/models/UserRequest.js +3 -3
- package/src/models/WebhookTest.js +2 -2
@@ -180,7 +180,7 @@ var FileComment = /*#__PURE__*/(0, _createClass2.default)(function FileComment()
|
|
180
180
|
return _Api.default.sendRequest("/file_comments/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
181
181
|
case 16:
|
182
182
|
response = _context2.sent;
|
183
|
-
return _context2.abrupt("return"
|
183
|
+
return _context2.abrupt("return");
|
184
184
|
case 18:
|
185
185
|
case "end":
|
186
186
|
return _context2.stop();
|
@@ -191,19 +191,38 @@ var FileComment = /*#__PURE__*/(0, _createClass2.default)(function FileComment()
|
|
191
191
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
192
192
|
return _this.delete(params);
|
193
193
|
});
|
194
|
-
(0, _defineProperty2.default)(this, "save", function () {
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
194
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
195
|
+
var newObject, _newObject;
|
196
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
197
|
+
while (1) switch (_context3.prev = _context3.next) {
|
198
|
+
case 0:
|
199
|
+
if (!_this.attributes['id']) {
|
200
|
+
_context3.next = 8;
|
201
|
+
break;
|
202
|
+
}
|
203
|
+
_context3.next = 3;
|
204
|
+
return _this.update(_this.attributes);
|
205
|
+
case 3:
|
206
|
+
newObject = _context3.sent;
|
207
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
208
|
+
return _context3.abrupt("return", true);
|
209
|
+
case 8:
|
210
|
+
_context3.next = 10;
|
211
|
+
return FileComment.create(_this.attributes, _this.options);
|
212
|
+
case 10:
|
213
|
+
_newObject = _context3.sent;
|
214
|
+
_this.attributes = _objectSpread({}, _newObject.attributes);
|
215
|
+
return _context3.abrupt("return", true);
|
216
|
+
case 13:
|
217
|
+
case "end":
|
218
|
+
return _context3.stop();
|
219
|
+
}
|
220
|
+
}, _callee3);
|
221
|
+
})));
|
222
|
+
Object.entries(attributes).forEach(function (_ref4) {
|
223
|
+
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
224
|
+
key = _ref5[0],
|
225
|
+
value = _ref5[1];
|
207
226
|
var normalizedKey = key.replace('?', '');
|
208
227
|
_this.attributes[normalizedKey] = value;
|
209
228
|
Object.defineProperty(_this, normalizedKey, {
|
@@ -219,112 +238,112 @@ _class = FileComment;
|
|
219
238
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
220
239
|
// path (required) - string - Path to operate on.
|
221
240
|
(0, _defineProperty2.default)(FileComment, "listFor", /*#__PURE__*/function () {
|
222
|
-
var
|
241
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(path) {
|
223
242
|
var _response$data;
|
224
243
|
var params,
|
225
244
|
options,
|
226
245
|
response,
|
227
|
-
|
228
|
-
return _regenerator.default.wrap(function
|
229
|
-
while (1) switch (
|
246
|
+
_args4 = arguments;
|
247
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
248
|
+
while (1) switch (_context4.prev = _context4.next) {
|
230
249
|
case 0:
|
231
|
-
params =
|
232
|
-
options =
|
250
|
+
params = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
251
|
+
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
|
233
252
|
if ((0, _utils.isObject)(params)) {
|
234
|
-
|
253
|
+
_context4.next = 4;
|
235
254
|
break;
|
236
255
|
}
|
237
256
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
238
257
|
case 4:
|
239
258
|
params['path'] = path;
|
240
259
|
if (params['path']) {
|
241
|
-
|
260
|
+
_context4.next = 7;
|
242
261
|
break;
|
243
262
|
}
|
244
263
|
throw new errors.MissingParameterError('Parameter missing: path');
|
245
264
|
case 7:
|
246
265
|
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
247
|
-
|
266
|
+
_context4.next = 9;
|
248
267
|
break;
|
249
268
|
}
|
250
269
|
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
251
270
|
case 9:
|
252
271
|
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
253
|
-
|
272
|
+
_context4.next = 11;
|
254
273
|
break;
|
255
274
|
}
|
256
275
|
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
257
276
|
case 11:
|
258
277
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
259
|
-
|
278
|
+
_context4.next = 13;
|
260
279
|
break;
|
261
280
|
}
|
262
281
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
263
282
|
case 13:
|
264
|
-
|
283
|
+
_context4.next = 15;
|
265
284
|
return _Api.default.sendRequest("/file_comments/files/".concat(encodeURIComponent(params['path'])), 'GET', params, options);
|
266
285
|
case 15:
|
267
|
-
response =
|
268
|
-
return
|
286
|
+
response = _context4.sent;
|
287
|
+
return _context4.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
269
288
|
return new _class(obj, options);
|
270
289
|
})) || []);
|
271
290
|
case 17:
|
272
291
|
case "end":
|
273
|
-
return
|
292
|
+
return _context4.stop();
|
274
293
|
}
|
275
|
-
},
|
294
|
+
}, _callee4);
|
276
295
|
}));
|
277
296
|
return function (_x) {
|
278
|
-
return
|
297
|
+
return _ref6.apply(this, arguments);
|
279
298
|
};
|
280
299
|
}());
|
281
300
|
// Parameters:
|
282
301
|
// body (required) - string - Comment body.
|
283
302
|
// path (required) - string - File path.
|
284
|
-
(0, _defineProperty2.default)(FileComment, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
303
|
+
(0, _defineProperty2.default)(FileComment, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
285
304
|
var params,
|
286
305
|
options,
|
287
306
|
response,
|
288
|
-
|
289
|
-
return _regenerator.default.wrap(function
|
290
|
-
while (1) switch (
|
307
|
+
_args5 = arguments;
|
308
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
309
|
+
while (1) switch (_context5.prev = _context5.next) {
|
291
310
|
case 0:
|
292
|
-
params =
|
293
|
-
options =
|
311
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
312
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
294
313
|
if (params['body']) {
|
295
|
-
|
314
|
+
_context5.next = 4;
|
296
315
|
break;
|
297
316
|
}
|
298
317
|
throw new errors.MissingParameterError('Parameter missing: body');
|
299
318
|
case 4:
|
300
319
|
if (params['path']) {
|
301
|
-
|
320
|
+
_context5.next = 6;
|
302
321
|
break;
|
303
322
|
}
|
304
323
|
throw new errors.MissingParameterError('Parameter missing: path');
|
305
324
|
case 6:
|
306
325
|
if (!(params['body'] && !(0, _utils.isString)(params['body']))) {
|
307
|
-
|
326
|
+
_context5.next = 8;
|
308
327
|
break;
|
309
328
|
}
|
310
329
|
throw new errors.InvalidParameterError("Bad parameter: body must be of type String, received ".concat((0, _utils.getType)(params['body'])));
|
311
330
|
case 8:
|
312
331
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
313
|
-
|
332
|
+
_context5.next = 10;
|
314
333
|
break;
|
315
334
|
}
|
316
335
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
317
336
|
case 10:
|
318
|
-
|
337
|
+
_context5.next = 12;
|
319
338
|
return _Api.default.sendRequest("/file_comments", 'POST', params, options);
|
320
339
|
case 12:
|
321
|
-
response =
|
322
|
-
return
|
340
|
+
response = _context5.sent;
|
341
|
+
return _context5.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
|
323
342
|
case 14:
|
324
343
|
case "end":
|
325
|
-
return
|
344
|
+
return _context5.stop();
|
326
345
|
}
|
327
|
-
},
|
346
|
+
}, _callee5);
|
328
347
|
})));
|
329
348
|
var _default = exports.default = FileComment;
|
330
349
|
module.exports = FileComment;
|
@@ -106,7 +106,7 @@ var FileCommentReaction = /*#__PURE__*/(0, _createClass2.default)(function FileC
|
|
106
106
|
return _Api.default.sendRequest("/file_comment_reactions/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
107
107
|
case 16:
|
108
108
|
response = _context.sent;
|
109
|
-
return _context.abrupt("return"
|
109
|
+
return _context.abrupt("return");
|
110
110
|
case 18:
|
111
111
|
case "end":
|
112
112
|
return _context.stop();
|
@@ -117,19 +117,33 @@ var FileCommentReaction = /*#__PURE__*/(0, _createClass2.default)(function FileC
|
|
117
117
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
118
118
|
return _this.delete(params);
|
119
119
|
});
|
120
|
-
(0, _defineProperty2.default)(this, "save", function () {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
120
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
121
|
+
var newObject;
|
122
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
123
|
+
while (1) switch (_context2.prev = _context2.next) {
|
124
|
+
case 0:
|
125
|
+
if (!_this.attributes['id']) {
|
126
|
+
_context2.next = 4;
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
throw new errors.NotImplementedError('The FileCommentReaction object doesn\'t support updates.');
|
130
|
+
case 4:
|
131
|
+
_context2.next = 6;
|
132
|
+
return FileCommentReaction.create(_this.attributes, _this.options);
|
133
|
+
case 6:
|
134
|
+
newObject = _context2.sent;
|
135
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
136
|
+
return _context2.abrupt("return", true);
|
137
|
+
case 9:
|
138
|
+
case "end":
|
139
|
+
return _context2.stop();
|
140
|
+
}
|
141
|
+
}, _callee2);
|
142
|
+
})));
|
143
|
+
Object.entries(attributes).forEach(function (_ref3) {
|
144
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
145
|
+
key = _ref4[0],
|
146
|
+
value = _ref4[1];
|
133
147
|
var normalizedKey = key.replace('?', '');
|
134
148
|
_this.attributes[normalizedKey] = value;
|
135
149
|
Object.defineProperty(_this, normalizedKey, {
|
@@ -144,56 +158,56 @@ _class = FileCommentReaction;
|
|
144
158
|
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
145
159
|
// file_comment_id (required) - int64 - ID of file comment to attach reaction to.
|
146
160
|
// emoji (required) - string - Emoji to react with.
|
147
|
-
(0, _defineProperty2.default)(FileCommentReaction, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
161
|
+
(0, _defineProperty2.default)(FileCommentReaction, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
148
162
|
var params,
|
149
163
|
options,
|
150
164
|
response,
|
151
|
-
|
152
|
-
return _regenerator.default.wrap(function
|
153
|
-
while (1) switch (
|
165
|
+
_args3 = arguments;
|
166
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
167
|
+
while (1) switch (_context3.prev = _context3.next) {
|
154
168
|
case 0:
|
155
|
-
params =
|
156
|
-
options =
|
169
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
170
|
+
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
157
171
|
if (params['file_comment_id']) {
|
158
|
-
|
172
|
+
_context3.next = 4;
|
159
173
|
break;
|
160
174
|
}
|
161
175
|
throw new errors.MissingParameterError('Parameter missing: file_comment_id');
|
162
176
|
case 4:
|
163
177
|
if (params['emoji']) {
|
164
|
-
|
178
|
+
_context3.next = 6;
|
165
179
|
break;
|
166
180
|
}
|
167
181
|
throw new errors.MissingParameterError('Parameter missing: emoji');
|
168
182
|
case 6:
|
169
183
|
if (!(params['user_id'] && !(0, _utils.isInt)(params['user_id']))) {
|
170
|
-
|
184
|
+
_context3.next = 8;
|
171
185
|
break;
|
172
186
|
}
|
173
187
|
throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params['user_id'])));
|
174
188
|
case 8:
|
175
189
|
if (!(params['file_comment_id'] && !(0, _utils.isInt)(params['file_comment_id']))) {
|
176
|
-
|
190
|
+
_context3.next = 10;
|
177
191
|
break;
|
178
192
|
}
|
179
193
|
throw new errors.InvalidParameterError("Bad parameter: file_comment_id must be of type Int, received ".concat((0, _utils.getType)(params['file_comment_id'])));
|
180
194
|
case 10:
|
181
195
|
if (!(params['emoji'] && !(0, _utils.isString)(params['emoji']))) {
|
182
|
-
|
196
|
+
_context3.next = 12;
|
183
197
|
break;
|
184
198
|
}
|
185
199
|
throw new errors.InvalidParameterError("Bad parameter: emoji must be of type String, received ".concat((0, _utils.getType)(params['emoji'])));
|
186
200
|
case 12:
|
187
|
-
|
201
|
+
_context3.next = 14;
|
188
202
|
return _Api.default.sendRequest("/file_comment_reactions", 'POST', params, options);
|
189
203
|
case 14:
|
190
|
-
response =
|
191
|
-
return
|
204
|
+
response = _context3.sent;
|
205
|
+
return _context3.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
|
192
206
|
case 16:
|
193
207
|
case "end":
|
194
|
-
return
|
208
|
+
return _context3.stop();
|
195
209
|
}
|
196
|
-
},
|
210
|
+
}, _callee3);
|
197
211
|
})));
|
198
212
|
var _default = exports.default = FileCommentReaction;
|
199
213
|
module.exports = FileCommentReaction;
|
package/lib/models/Folder.js
CHANGED
@@ -5,8 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports.default = void 0;
|
7
7
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
8
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
9
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
@@ -161,15 +161,27 @@ var Folder = /*#__PURE__*/(0, _createClass2.default)(function Folder() {
|
|
161
161
|
(0, _defineProperty2.default)(this, "setMkdirParents", function (value) {
|
162
162
|
_this.attributes.mkdir_parents = value;
|
163
163
|
});
|
164
|
-
(0, _defineProperty2.default)(this, "save", function () {
|
165
|
-
var newObject
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
164
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
165
|
+
var newObject;
|
166
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
167
|
+
while (1) switch (_context.prev = _context.next) {
|
168
|
+
case 0:
|
169
|
+
_context.next = 2;
|
170
|
+
return Folder.create(_this.attributes.path, _this.attributes, _this.options);
|
171
|
+
case 2:
|
172
|
+
newObject = _context.sent;
|
173
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
174
|
+
return _context.abrupt("return", true);
|
175
|
+
case 5:
|
176
|
+
case "end":
|
177
|
+
return _context.stop();
|
178
|
+
}
|
179
|
+
}, _callee);
|
180
|
+
})));
|
181
|
+
Object.entries(attributes).forEach(function (_ref2) {
|
182
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
183
|
+
key = _ref3[0],
|
184
|
+
value = _ref3[1];
|
173
185
|
var normalizedKey = key.replace('?', '');
|
174
186
|
_this.attributes[normalizedKey] = value;
|
175
187
|
Object.defineProperty(_this, normalizedKey, {
|
@@ -191,83 +203,83 @@ var Folder = /*#__PURE__*/(0, _createClass2.default)(function Folder() {
|
|
191
203
|
// with_previews - boolean - Include file previews?
|
192
204
|
// with_priority_color - boolean - Include file priority color information?
|
193
205
|
(0, _defineProperty2.default)(Folder, "listFor", /*#__PURE__*/function () {
|
194
|
-
var
|
206
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(path) {
|
195
207
|
var _response$data;
|
196
208
|
var params,
|
197
209
|
options,
|
198
210
|
response,
|
199
211
|
File,
|
200
|
-
|
201
|
-
return _regenerator.default.wrap(function
|
202
|
-
while (1) switch (
|
212
|
+
_args2 = arguments;
|
213
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
214
|
+
while (1) switch (_context2.prev = _context2.next) {
|
203
215
|
case 0:
|
204
|
-
params =
|
205
|
-
options =
|
216
|
+
params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
217
|
+
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
206
218
|
if ((0, _utils.isObject)(params)) {
|
207
|
-
|
219
|
+
_context2.next = 4;
|
208
220
|
break;
|
209
221
|
}
|
210
222
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
211
223
|
case 4:
|
212
224
|
params['path'] = path;
|
213
225
|
if (params['path']) {
|
214
|
-
|
226
|
+
_context2.next = 7;
|
215
227
|
break;
|
216
228
|
}
|
217
229
|
throw new errors.MissingParameterError('Parameter missing: path');
|
218
230
|
case 7:
|
219
231
|
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
220
|
-
|
232
|
+
_context2.next = 9;
|
221
233
|
break;
|
222
234
|
}
|
223
235
|
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
224
236
|
case 9:
|
225
237
|
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
226
|
-
|
238
|
+
_context2.next = 11;
|
227
239
|
break;
|
228
240
|
}
|
229
241
|
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
230
242
|
case 11:
|
231
243
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
232
|
-
|
244
|
+
_context2.next = 13;
|
233
245
|
break;
|
234
246
|
}
|
235
247
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
236
248
|
case 13:
|
237
249
|
if (!(params['filter'] && !(0, _utils.isString)(params['filter']))) {
|
238
|
-
|
250
|
+
_context2.next = 15;
|
239
251
|
break;
|
240
252
|
}
|
241
253
|
throw new errors.InvalidParameterError("Bad parameter: filter must be of type String, received ".concat((0, _utils.getType)(params['filter'])));
|
242
254
|
case 15:
|
243
255
|
if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
|
244
|
-
|
256
|
+
_context2.next = 17;
|
245
257
|
break;
|
246
258
|
}
|
247
259
|
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params['preview_size'])));
|
248
260
|
case 17:
|
249
261
|
if (!(params['search'] && !(0, _utils.isString)(params['search']))) {
|
250
|
-
|
262
|
+
_context2.next = 19;
|
251
263
|
break;
|
252
264
|
}
|
253
265
|
throw new errors.InvalidParameterError("Bad parameter: search must be of type String, received ".concat((0, _utils.getType)(params['search'])));
|
254
266
|
case 19:
|
255
|
-
|
267
|
+
_context2.next = 21;
|
256
268
|
return _Api.default.sendRequest("/folders/".concat(encodeURIComponent(params['path'])), 'GET', params, options);
|
257
269
|
case 21:
|
258
|
-
response =
|
270
|
+
response = _context2.sent;
|
259
271
|
File = require("./File.js").default;
|
260
|
-
return
|
272
|
+
return _context2.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
261
273
|
return new File(obj, options);
|
262
274
|
})) || []);
|
263
275
|
case 24:
|
264
276
|
case "end":
|
265
|
-
return
|
277
|
+
return _context2.stop();
|
266
278
|
}
|
267
|
-
},
|
279
|
+
}, _callee2);
|
268
280
|
}));
|
269
281
|
return function (_x) {
|
270
|
-
return
|
282
|
+
return _ref4.apply(this, arguments);
|
271
283
|
};
|
272
284
|
}());
|
273
285
|
// Parameters:
|
@@ -275,56 +287,56 @@ var Folder = /*#__PURE__*/(0, _createClass2.default)(function Folder() {
|
|
275
287
|
// mkdir_parents - boolean - Create parent directories if they do not exist?
|
276
288
|
// provided_mtime - string - User provided modification time.
|
277
289
|
(0, _defineProperty2.default)(Folder, "create", /*#__PURE__*/function () {
|
278
|
-
var
|
290
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(path) {
|
279
291
|
var params,
|
280
292
|
options,
|
281
293
|
response,
|
282
294
|
File,
|
283
|
-
|
284
|
-
return _regenerator.default.wrap(function
|
285
|
-
while (1) switch (
|
295
|
+
_args3 = arguments;
|
296
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
297
|
+
while (1) switch (_context3.prev = _context3.next) {
|
286
298
|
case 0:
|
287
|
-
params =
|
288
|
-
options =
|
299
|
+
params = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
300
|
+
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
289
301
|
if ((0, _utils.isObject)(params)) {
|
290
|
-
|
302
|
+
_context3.next = 4;
|
291
303
|
break;
|
292
304
|
}
|
293
305
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
294
306
|
case 4:
|
295
307
|
params['path'] = path;
|
296
308
|
if (params['path']) {
|
297
|
-
|
309
|
+
_context3.next = 7;
|
298
310
|
break;
|
299
311
|
}
|
300
312
|
throw new errors.MissingParameterError('Parameter missing: path');
|
301
313
|
case 7:
|
302
314
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
303
|
-
|
315
|
+
_context3.next = 9;
|
304
316
|
break;
|
305
317
|
}
|
306
318
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
307
319
|
case 9:
|
308
320
|
if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
|
309
|
-
|
321
|
+
_context3.next = 11;
|
310
322
|
break;
|
311
323
|
}
|
312
324
|
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params['provided_mtime'])));
|
313
325
|
case 11:
|
314
|
-
|
326
|
+
_context3.next = 13;
|
315
327
|
return _Api.default.sendRequest("/folders/".concat(encodeURIComponent(params['path'])), 'POST', params, options);
|
316
328
|
case 13:
|
317
|
-
response =
|
329
|
+
response = _context3.sent;
|
318
330
|
File = require("./File.js").default;
|
319
|
-
return
|
331
|
+
return _context3.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
|
320
332
|
case 16:
|
321
333
|
case "end":
|
322
|
-
return
|
334
|
+
return _context3.stop();
|
323
335
|
}
|
324
|
-
},
|
336
|
+
}, _callee3);
|
325
337
|
}));
|
326
338
|
return function (_x2) {
|
327
|
-
return
|
339
|
+
return _ref5.apply(this, arguments);
|
328
340
|
};
|
329
341
|
}());
|
330
342
|
var _default = exports.default = Folder;
|