files.com 1.2.296 → 1.2.297
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/_VERSION +1 -1
- package/docs/Errors.md +5 -0
- package/docs/models/AccountLineItem.md +1 -0
- package/docs/models/Invoice.md +1 -0
- package/docs/models/InvoiceLineItem.md +2 -0
- package/docs/models/Payment.md +1 -0
- package/docs/models/Sync.md +68 -2
- package/docs/models/SyncRun.md +8 -6
- package/lib/Errors.js +500 -440
- package/lib/Files.js +1 -1
- package/lib/models/InvoiceLineItem.js +4 -0
- package/lib/models/Sync.js +174 -118
- package/lib/models/SyncRun.js +23 -28
- package/package.json +1 -1
- package/src/Errors.js +5 -0
- package/src/Files.js +1 -1
- package/src/models/InvoiceLineItem.js +3 -0
- package/src/models/Sync.js +33 -0
- package/src/models/SyncRun.js +11 -14
package/lib/models/Sync.js
CHANGED
|
@@ -208,8 +208,15 @@ var Sync = /*#__PURE__*/(0, _createClass2.default)(function Sync() {
|
|
|
208
208
|
(0, _defineProperty2.default)(this, "setHolidayRegion", function (value) {
|
|
209
209
|
_this.attributes.holiday_region = value;
|
|
210
210
|
});
|
|
211
|
-
//
|
|
212
|
-
(0, _defineProperty2.default)(this, "
|
|
211
|
+
// SyncRun # The latest run of this sync
|
|
212
|
+
(0, _defineProperty2.default)(this, "getLatestSyncRun", function () {
|
|
213
|
+
return _this.attributes.latest_sync_run;
|
|
214
|
+
});
|
|
215
|
+
(0, _defineProperty2.default)(this, "setLatestSyncRun", function (value) {
|
|
216
|
+
_this.attributes.latest_sync_run = value;
|
|
217
|
+
});
|
|
218
|
+
// Dry Run Sync
|
|
219
|
+
(0, _defineProperty2.default)(this, "dryRun", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
213
220
|
var params,
|
|
214
221
|
_args = arguments;
|
|
215
222
|
return _regenerator.default.wrap(function (_context) {
|
|
@@ -250,13 +257,62 @@ var Sync = /*#__PURE__*/(0, _createClass2.default)(function Sync() {
|
|
|
250
257
|
throw new errors.MissingParameterError('Parameter missing: id');
|
|
251
258
|
case 5:
|
|
252
259
|
_context.next = 6;
|
|
253
|
-
return _Api.default.sendRequest("/syncs/".concat(encodeURIComponent(params.id), "/
|
|
260
|
+
return _Api.default.sendRequest("/syncs/".concat(encodeURIComponent(params.id), "/dry_run"), 'POST', params, _this.options);
|
|
254
261
|
case 6:
|
|
255
262
|
case "end":
|
|
256
263
|
return _context.stop();
|
|
257
264
|
}
|
|
258
265
|
}, _callee);
|
|
259
266
|
})));
|
|
267
|
+
// Manually Run Sync
|
|
268
|
+
(0, _defineProperty2.default)(this, "manualRun", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
269
|
+
var params,
|
|
270
|
+
_args2 = arguments;
|
|
271
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
272
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
273
|
+
case 0:
|
|
274
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
275
|
+
if (_this.attributes.id) {
|
|
276
|
+
_context2.next = 1;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
|
280
|
+
case 1:
|
|
281
|
+
if ((0, _utils.isObject)(params)) {
|
|
282
|
+
_context2.next = 2;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
286
|
+
case 2:
|
|
287
|
+
params.id = _this.attributes.id;
|
|
288
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
289
|
+
_context2.next = 3;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
293
|
+
case 3:
|
|
294
|
+
if (params.id) {
|
|
295
|
+
_context2.next = 5;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
if (!_this.attributes.id) {
|
|
299
|
+
_context2.next = 4;
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
params.id = _this.id;
|
|
303
|
+
_context2.next = 5;
|
|
304
|
+
break;
|
|
305
|
+
case 4:
|
|
306
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
307
|
+
case 5:
|
|
308
|
+
_context2.next = 6;
|
|
309
|
+
return _Api.default.sendRequest("/syncs/".concat(encodeURIComponent(params.id), "/manual_run"), 'POST', params, _this.options);
|
|
310
|
+
case 6:
|
|
311
|
+
case "end":
|
|
312
|
+
return _context2.stop();
|
|
313
|
+
}
|
|
314
|
+
}, _callee2);
|
|
315
|
+
})));
|
|
260
316
|
// Parameters:
|
|
261
317
|
// name - string - Name for this sync job
|
|
262
318
|
// description - string - Description for this sync job
|
|
@@ -277,232 +333,232 @@ var Sync = /*#__PURE__*/(0, _createClass2.default)(function Sync() {
|
|
|
277
333
|
// schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
|
|
278
334
|
// schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
|
|
279
335
|
// schedule_times_of_day - array(string) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. Times of day in HH:MM format.
|
|
280
|
-
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
336
|
+
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
281
337
|
var params,
|
|
282
338
|
response,
|
|
283
|
-
|
|
284
|
-
return _regenerator.default.wrap(function (
|
|
285
|
-
while (1) switch (
|
|
339
|
+
_args3 = arguments;
|
|
340
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
341
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
286
342
|
case 0:
|
|
287
|
-
params =
|
|
343
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
288
344
|
if (_this.attributes.id) {
|
|
289
|
-
|
|
345
|
+
_context3.next = 1;
|
|
290
346
|
break;
|
|
291
347
|
}
|
|
292
348
|
throw new errors.EmptyPropertyError('Current object has no id');
|
|
293
349
|
case 1:
|
|
294
350
|
if ((0, _utils.isObject)(params)) {
|
|
295
|
-
|
|
351
|
+
_context3.next = 2;
|
|
296
352
|
break;
|
|
297
353
|
}
|
|
298
354
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
299
355
|
case 2:
|
|
300
356
|
params.id = _this.attributes.id;
|
|
301
357
|
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
302
|
-
|
|
358
|
+
_context3.next = 3;
|
|
303
359
|
break;
|
|
304
360
|
}
|
|
305
361
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
306
362
|
case 3:
|
|
307
363
|
if (!(params.name && !(0, _utils.isString)(params.name))) {
|
|
308
|
-
|
|
364
|
+
_context3.next = 4;
|
|
309
365
|
break;
|
|
310
366
|
}
|
|
311
367
|
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
|
|
312
368
|
case 4:
|
|
313
369
|
if (!(params.description && !(0, _utils.isString)(params.description))) {
|
|
314
|
-
|
|
370
|
+
_context3.next = 5;
|
|
315
371
|
break;
|
|
316
372
|
}
|
|
317
373
|
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params.description)));
|
|
318
374
|
case 5:
|
|
319
375
|
if (!(params.src_path && !(0, _utils.isString)(params.src_path))) {
|
|
320
|
-
|
|
376
|
+
_context3.next = 6;
|
|
321
377
|
break;
|
|
322
378
|
}
|
|
323
379
|
throw new errors.InvalidParameterError("Bad parameter: src_path must be of type String, received ".concat((0, _utils.getType)(params.src_path)));
|
|
324
380
|
case 6:
|
|
325
381
|
if (!(params.dest_path && !(0, _utils.isString)(params.dest_path))) {
|
|
326
|
-
|
|
382
|
+
_context3.next = 7;
|
|
327
383
|
break;
|
|
328
384
|
}
|
|
329
385
|
throw new errors.InvalidParameterError("Bad parameter: dest_path must be of type String, received ".concat((0, _utils.getType)(params.dest_path)));
|
|
330
386
|
case 7:
|
|
331
387
|
if (!(params.src_remote_server_id && !(0, _utils.isInt)(params.src_remote_server_id))) {
|
|
332
|
-
|
|
388
|
+
_context3.next = 8;
|
|
333
389
|
break;
|
|
334
390
|
}
|
|
335
391
|
throw new errors.InvalidParameterError("Bad parameter: src_remote_server_id must be of type Int, received ".concat((0, _utils.getType)(params.src_remote_server_id)));
|
|
336
392
|
case 8:
|
|
337
393
|
if (!(params.dest_remote_server_id && !(0, _utils.isInt)(params.dest_remote_server_id))) {
|
|
338
|
-
|
|
394
|
+
_context3.next = 9;
|
|
339
395
|
break;
|
|
340
396
|
}
|
|
341
397
|
throw new errors.InvalidParameterError("Bad parameter: dest_remote_server_id must be of type Int, received ".concat((0, _utils.getType)(params.dest_remote_server_id)));
|
|
342
398
|
case 9:
|
|
343
399
|
if (!(params.interval && !(0, _utils.isString)(params.interval))) {
|
|
344
|
-
|
|
400
|
+
_context3.next = 10;
|
|
345
401
|
break;
|
|
346
402
|
}
|
|
347
403
|
throw new errors.InvalidParameterError("Bad parameter: interval must be of type String, received ".concat((0, _utils.getType)(params.interval)));
|
|
348
404
|
case 10:
|
|
349
405
|
if (!(params.trigger && !(0, _utils.isString)(params.trigger))) {
|
|
350
|
-
|
|
406
|
+
_context3.next = 11;
|
|
351
407
|
break;
|
|
352
408
|
}
|
|
353
409
|
throw new errors.InvalidParameterError("Bad parameter: trigger must be of type String, received ".concat((0, _utils.getType)(params.trigger)));
|
|
354
410
|
case 11:
|
|
355
411
|
if (!(params.trigger_file && !(0, _utils.isString)(params.trigger_file))) {
|
|
356
|
-
|
|
412
|
+
_context3.next = 12;
|
|
357
413
|
break;
|
|
358
414
|
}
|
|
359
415
|
throw new errors.InvalidParameterError("Bad parameter: trigger_file must be of type String, received ".concat((0, _utils.getType)(params.trigger_file)));
|
|
360
416
|
case 12:
|
|
361
417
|
if (!(params.holiday_region && !(0, _utils.isString)(params.holiday_region))) {
|
|
362
|
-
|
|
418
|
+
_context3.next = 13;
|
|
363
419
|
break;
|
|
364
420
|
}
|
|
365
421
|
throw new errors.InvalidParameterError("Bad parameter: holiday_region must be of type String, received ".concat((0, _utils.getType)(params.holiday_region)));
|
|
366
422
|
case 13:
|
|
367
423
|
if (!(params.sync_interval_minutes && !(0, _utils.isInt)(params.sync_interval_minutes))) {
|
|
368
|
-
|
|
424
|
+
_context3.next = 14;
|
|
369
425
|
break;
|
|
370
426
|
}
|
|
371
427
|
throw new errors.InvalidParameterError("Bad parameter: sync_interval_minutes must be of type Int, received ".concat((0, _utils.getType)(params.sync_interval_minutes)));
|
|
372
428
|
case 14:
|
|
373
429
|
if (!(params.recurring_day && !(0, _utils.isInt)(params.recurring_day))) {
|
|
374
|
-
|
|
430
|
+
_context3.next = 15;
|
|
375
431
|
break;
|
|
376
432
|
}
|
|
377
433
|
throw new errors.InvalidParameterError("Bad parameter: recurring_day must be of type Int, received ".concat((0, _utils.getType)(params.recurring_day)));
|
|
378
434
|
case 15:
|
|
379
435
|
if (!(params.schedule_time_zone && !(0, _utils.isString)(params.schedule_time_zone))) {
|
|
380
|
-
|
|
436
|
+
_context3.next = 16;
|
|
381
437
|
break;
|
|
382
438
|
}
|
|
383
439
|
throw new errors.InvalidParameterError("Bad parameter: schedule_time_zone must be of type String, received ".concat((0, _utils.getType)(params.schedule_time_zone)));
|
|
384
440
|
case 16:
|
|
385
441
|
if (!(params.schedule_days_of_week && !(0, _utils.isArray)(params.schedule_days_of_week))) {
|
|
386
|
-
|
|
442
|
+
_context3.next = 17;
|
|
387
443
|
break;
|
|
388
444
|
}
|
|
389
445
|
throw new errors.InvalidParameterError("Bad parameter: schedule_days_of_week must be of type Array, received ".concat((0, _utils.getType)(params.schedule_days_of_week)));
|
|
390
446
|
case 17:
|
|
391
447
|
if (!(params.schedule_times_of_day && !(0, _utils.isArray)(params.schedule_times_of_day))) {
|
|
392
|
-
|
|
448
|
+
_context3.next = 18;
|
|
393
449
|
break;
|
|
394
450
|
}
|
|
395
451
|
throw new errors.InvalidParameterError("Bad parameter: schedule_times_of_day must be of type Array, received ".concat((0, _utils.getType)(params.schedule_times_of_day)));
|
|
396
452
|
case 18:
|
|
397
453
|
if (params.id) {
|
|
398
|
-
|
|
454
|
+
_context3.next = 20;
|
|
399
455
|
break;
|
|
400
456
|
}
|
|
401
457
|
if (!_this.attributes.id) {
|
|
402
|
-
|
|
458
|
+
_context3.next = 19;
|
|
403
459
|
break;
|
|
404
460
|
}
|
|
405
461
|
params.id = _this.id;
|
|
406
|
-
|
|
462
|
+
_context3.next = 20;
|
|
407
463
|
break;
|
|
408
464
|
case 19:
|
|
409
465
|
throw new errors.MissingParameterError('Parameter missing: id');
|
|
410
466
|
case 20:
|
|
411
|
-
|
|
467
|
+
_context3.next = 21;
|
|
412
468
|
return _Api.default.sendRequest("/syncs/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
|
|
413
469
|
case 21:
|
|
414
|
-
response =
|
|
415
|
-
return
|
|
470
|
+
response = _context3.sent;
|
|
471
|
+
return _context3.abrupt("return", new Sync(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
416
472
|
case 22:
|
|
417
473
|
case "end":
|
|
418
|
-
return
|
|
474
|
+
return _context3.stop();
|
|
419
475
|
}
|
|
420
|
-
},
|
|
476
|
+
}, _callee3);
|
|
421
477
|
})));
|
|
422
|
-
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
478
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
423
479
|
var params,
|
|
424
|
-
|
|
425
|
-
return _regenerator.default.wrap(function (
|
|
426
|
-
while (1) switch (
|
|
480
|
+
_args4 = arguments;
|
|
481
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
482
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
427
483
|
case 0:
|
|
428
|
-
params =
|
|
484
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
429
485
|
if (_this.attributes.id) {
|
|
430
|
-
|
|
486
|
+
_context4.next = 1;
|
|
431
487
|
break;
|
|
432
488
|
}
|
|
433
489
|
throw new errors.EmptyPropertyError('Current object has no id');
|
|
434
490
|
case 1:
|
|
435
491
|
if ((0, _utils.isObject)(params)) {
|
|
436
|
-
|
|
492
|
+
_context4.next = 2;
|
|
437
493
|
break;
|
|
438
494
|
}
|
|
439
495
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
440
496
|
case 2:
|
|
441
497
|
params.id = _this.attributes.id;
|
|
442
498
|
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
443
|
-
|
|
499
|
+
_context4.next = 3;
|
|
444
500
|
break;
|
|
445
501
|
}
|
|
446
502
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
447
503
|
case 3:
|
|
448
504
|
if (params.id) {
|
|
449
|
-
|
|
505
|
+
_context4.next = 5;
|
|
450
506
|
break;
|
|
451
507
|
}
|
|
452
508
|
if (!_this.attributes.id) {
|
|
453
|
-
|
|
509
|
+
_context4.next = 4;
|
|
454
510
|
break;
|
|
455
511
|
}
|
|
456
512
|
params.id = _this.id;
|
|
457
|
-
|
|
513
|
+
_context4.next = 5;
|
|
458
514
|
break;
|
|
459
515
|
case 4:
|
|
460
516
|
throw new errors.MissingParameterError('Parameter missing: id');
|
|
461
517
|
case 5:
|
|
462
|
-
|
|
518
|
+
_context4.next = 6;
|
|
463
519
|
return _Api.default.sendRequest("/syncs/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
|
|
464
520
|
case 6:
|
|
465
521
|
case "end":
|
|
466
|
-
return
|
|
522
|
+
return _context4.stop();
|
|
467
523
|
}
|
|
468
|
-
},
|
|
524
|
+
}, _callee4);
|
|
469
525
|
})));
|
|
470
526
|
(0, _defineProperty2.default)(this, "destroy", function () {
|
|
471
527
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
472
528
|
return _this.delete(params);
|
|
473
529
|
});
|
|
474
|
-
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
530
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
475
531
|
var _newObject, newObject;
|
|
476
|
-
return _regenerator.default.wrap(function (
|
|
477
|
-
while (1) switch (
|
|
532
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
533
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
478
534
|
case 0:
|
|
479
535
|
if (!_this.attributes.id) {
|
|
480
|
-
|
|
536
|
+
_context5.next = 2;
|
|
481
537
|
break;
|
|
482
538
|
}
|
|
483
|
-
|
|
539
|
+
_context5.next = 1;
|
|
484
540
|
return _this.update(_this.attributes);
|
|
485
541
|
case 1:
|
|
486
|
-
_newObject =
|
|
542
|
+
_newObject = _context5.sent;
|
|
487
543
|
_this.attributes = _objectSpread({}, _newObject.attributes);
|
|
488
|
-
return
|
|
544
|
+
return _context5.abrupt("return", true);
|
|
489
545
|
case 2:
|
|
490
|
-
|
|
546
|
+
_context5.next = 3;
|
|
491
547
|
return Sync.create(_this.attributes, _this.options);
|
|
492
548
|
case 3:
|
|
493
|
-
newObject =
|
|
549
|
+
newObject = _context5.sent;
|
|
494
550
|
_this.attributes = _objectSpread({}, newObject.attributes);
|
|
495
|
-
return
|
|
551
|
+
return _context5.abrupt("return", true);
|
|
496
552
|
case 4:
|
|
497
553
|
case "end":
|
|
498
|
-
return
|
|
554
|
+
return _context5.stop();
|
|
499
555
|
}
|
|
500
|
-
},
|
|
556
|
+
}, _callee5);
|
|
501
557
|
})));
|
|
502
|
-
Object.entries(attributes).forEach(function (
|
|
503
|
-
var
|
|
504
|
-
key =
|
|
505
|
-
value =
|
|
558
|
+
Object.entries(attributes).forEach(function (_ref6) {
|
|
559
|
+
var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
|
|
560
|
+
key = _ref7[0],
|
|
561
|
+
value = _ref7[1];
|
|
506
562
|
var normalizedKey = key.replace('?', '');
|
|
507
563
|
_this.attributes[normalizedKey] = value;
|
|
508
564
|
Object.defineProperty(_this, normalizedKey, {
|
|
@@ -516,41 +572,41 @@ _Sync = Sync;
|
|
|
516
572
|
// Parameters:
|
|
517
573
|
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
518
574
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
519
|
-
(0, _defineProperty2.default)(Sync, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
575
|
+
(0, _defineProperty2.default)(Sync, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
520
576
|
var _response$data;
|
|
521
577
|
var params,
|
|
522
578
|
options,
|
|
523
579
|
response,
|
|
524
|
-
|
|
525
|
-
return _regenerator.default.wrap(function (
|
|
526
|
-
while (1) switch (
|
|
580
|
+
_args6 = arguments;
|
|
581
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
582
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
527
583
|
case 0:
|
|
528
|
-
params =
|
|
529
|
-
options =
|
|
584
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
585
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
530
586
|
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
|
531
|
-
|
|
587
|
+
_context6.next = 1;
|
|
532
588
|
break;
|
|
533
589
|
}
|
|
534
590
|
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
|
535
591
|
case 1:
|
|
536
592
|
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
|
537
|
-
|
|
593
|
+
_context6.next = 2;
|
|
538
594
|
break;
|
|
539
595
|
}
|
|
540
596
|
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
|
541
597
|
case 2:
|
|
542
|
-
|
|
598
|
+
_context6.next = 3;
|
|
543
599
|
return _Api.default.sendRequest('/syncs', 'GET', params, options);
|
|
544
600
|
case 3:
|
|
545
|
-
response =
|
|
546
|
-
return
|
|
601
|
+
response = _context6.sent;
|
|
602
|
+
return _context6.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
|
547
603
|
return new _Sync(obj, options);
|
|
548
604
|
})) || []);
|
|
549
605
|
case 4:
|
|
550
606
|
case "end":
|
|
551
|
-
return
|
|
607
|
+
return _context6.stop();
|
|
552
608
|
}
|
|
553
|
-
},
|
|
609
|
+
}, _callee6);
|
|
554
610
|
})));
|
|
555
611
|
(0, _defineProperty2.default)(Sync, "all", function () {
|
|
556
612
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -560,48 +616,48 @@ _Sync = Sync;
|
|
|
560
616
|
// Parameters:
|
|
561
617
|
// id (required) - int64 - Sync ID.
|
|
562
618
|
(0, _defineProperty2.default)(Sync, "find", /*#__PURE__*/function () {
|
|
563
|
-
var
|
|
619
|
+
var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(id) {
|
|
564
620
|
var params,
|
|
565
621
|
options,
|
|
566
622
|
response,
|
|
567
|
-
|
|
568
|
-
return _regenerator.default.wrap(function (
|
|
569
|
-
while (1) switch (
|
|
623
|
+
_args7 = arguments;
|
|
624
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
625
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
570
626
|
case 0:
|
|
571
|
-
params =
|
|
572
|
-
options =
|
|
627
|
+
params = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
628
|
+
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
573
629
|
if ((0, _utils.isObject)(params)) {
|
|
574
|
-
|
|
630
|
+
_context7.next = 1;
|
|
575
631
|
break;
|
|
576
632
|
}
|
|
577
633
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
578
634
|
case 1:
|
|
579
635
|
params.id = id;
|
|
580
636
|
if (params.id) {
|
|
581
|
-
|
|
637
|
+
_context7.next = 2;
|
|
582
638
|
break;
|
|
583
639
|
}
|
|
584
640
|
throw new errors.MissingParameterError('Parameter missing: id');
|
|
585
641
|
case 2:
|
|
586
642
|
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
587
|
-
|
|
643
|
+
_context7.next = 3;
|
|
588
644
|
break;
|
|
589
645
|
}
|
|
590
646
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
591
647
|
case 3:
|
|
592
|
-
|
|
648
|
+
_context7.next = 4;
|
|
593
649
|
return _Api.default.sendRequest("/syncs/".concat(encodeURIComponent(params.id)), 'GET', params, options);
|
|
594
650
|
case 4:
|
|
595
|
-
response =
|
|
596
|
-
return
|
|
651
|
+
response = _context7.sent;
|
|
652
|
+
return _context7.abrupt("return", new _Sync(response === null || response === void 0 ? void 0 : response.data, options));
|
|
597
653
|
case 5:
|
|
598
654
|
case "end":
|
|
599
|
-
return
|
|
655
|
+
return _context7.stop();
|
|
600
656
|
}
|
|
601
|
-
},
|
|
657
|
+
}, _callee7);
|
|
602
658
|
}));
|
|
603
659
|
return function (_x) {
|
|
604
|
-
return
|
|
660
|
+
return _ref9.apply(this, arguments);
|
|
605
661
|
};
|
|
606
662
|
}());
|
|
607
663
|
(0, _defineProperty2.default)(Sync, "get", function (id) {
|
|
@@ -629,116 +685,116 @@ _Sync = Sync;
|
|
|
629
685
|
// schedule_time_zone - string - If trigger is `custom_schedule`, Custom schedule Time Zone for when the sync should be run.
|
|
630
686
|
// schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
|
|
631
687
|
// schedule_times_of_day - array(string) - If trigger is `custom_schedule`, Custom schedule description for when the sync should be run. Times of day in HH:MM format.
|
|
632
|
-
(0, _defineProperty2.default)(Sync, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
688
|
+
(0, _defineProperty2.default)(Sync, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
633
689
|
var params,
|
|
634
690
|
options,
|
|
635
691
|
response,
|
|
636
|
-
|
|
637
|
-
return _regenerator.default.wrap(function (
|
|
638
|
-
while (1) switch (
|
|
692
|
+
_args8 = arguments;
|
|
693
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
694
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
639
695
|
case 0:
|
|
640
|
-
params =
|
|
641
|
-
options =
|
|
696
|
+
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
697
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
642
698
|
if (!(params.name && !(0, _utils.isString)(params.name))) {
|
|
643
|
-
|
|
699
|
+
_context8.next = 1;
|
|
644
700
|
break;
|
|
645
701
|
}
|
|
646
702
|
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
|
|
647
703
|
case 1:
|
|
648
704
|
if (!(params.description && !(0, _utils.isString)(params.description))) {
|
|
649
|
-
|
|
705
|
+
_context8.next = 2;
|
|
650
706
|
break;
|
|
651
707
|
}
|
|
652
708
|
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params.description)));
|
|
653
709
|
case 2:
|
|
654
710
|
if (!(params.src_path && !(0, _utils.isString)(params.src_path))) {
|
|
655
|
-
|
|
711
|
+
_context8.next = 3;
|
|
656
712
|
break;
|
|
657
713
|
}
|
|
658
714
|
throw new errors.InvalidParameterError("Bad parameter: src_path must be of type String, received ".concat((0, _utils.getType)(params.src_path)));
|
|
659
715
|
case 3:
|
|
660
716
|
if (!(params.dest_path && !(0, _utils.isString)(params.dest_path))) {
|
|
661
|
-
|
|
717
|
+
_context8.next = 4;
|
|
662
718
|
break;
|
|
663
719
|
}
|
|
664
720
|
throw new errors.InvalidParameterError("Bad parameter: dest_path must be of type String, received ".concat((0, _utils.getType)(params.dest_path)));
|
|
665
721
|
case 4:
|
|
666
722
|
if (!(params.src_remote_server_id && !(0, _utils.isInt)(params.src_remote_server_id))) {
|
|
667
|
-
|
|
723
|
+
_context8.next = 5;
|
|
668
724
|
break;
|
|
669
725
|
}
|
|
670
726
|
throw new errors.InvalidParameterError("Bad parameter: src_remote_server_id must be of type Int, received ".concat((0, _utils.getType)(params.src_remote_server_id)));
|
|
671
727
|
case 5:
|
|
672
728
|
if (!(params.dest_remote_server_id && !(0, _utils.isInt)(params.dest_remote_server_id))) {
|
|
673
|
-
|
|
729
|
+
_context8.next = 6;
|
|
674
730
|
break;
|
|
675
731
|
}
|
|
676
732
|
throw new errors.InvalidParameterError("Bad parameter: dest_remote_server_id must be of type Int, received ".concat((0, _utils.getType)(params.dest_remote_server_id)));
|
|
677
733
|
case 6:
|
|
678
734
|
if (!(params.interval && !(0, _utils.isString)(params.interval))) {
|
|
679
|
-
|
|
735
|
+
_context8.next = 7;
|
|
680
736
|
break;
|
|
681
737
|
}
|
|
682
738
|
throw new errors.InvalidParameterError("Bad parameter: interval must be of type String, received ".concat((0, _utils.getType)(params.interval)));
|
|
683
739
|
case 7:
|
|
684
740
|
if (!(params.trigger && !(0, _utils.isString)(params.trigger))) {
|
|
685
|
-
|
|
741
|
+
_context8.next = 8;
|
|
686
742
|
break;
|
|
687
743
|
}
|
|
688
744
|
throw new errors.InvalidParameterError("Bad parameter: trigger must be of type String, received ".concat((0, _utils.getType)(params.trigger)));
|
|
689
745
|
case 8:
|
|
690
746
|
if (!(params.trigger_file && !(0, _utils.isString)(params.trigger_file))) {
|
|
691
|
-
|
|
747
|
+
_context8.next = 9;
|
|
692
748
|
break;
|
|
693
749
|
}
|
|
694
750
|
throw new errors.InvalidParameterError("Bad parameter: trigger_file must be of type String, received ".concat((0, _utils.getType)(params.trigger_file)));
|
|
695
751
|
case 9:
|
|
696
752
|
if (!(params.holiday_region && !(0, _utils.isString)(params.holiday_region))) {
|
|
697
|
-
|
|
753
|
+
_context8.next = 10;
|
|
698
754
|
break;
|
|
699
755
|
}
|
|
700
756
|
throw new errors.InvalidParameterError("Bad parameter: holiday_region must be of type String, received ".concat((0, _utils.getType)(params.holiday_region)));
|
|
701
757
|
case 10:
|
|
702
758
|
if (!(params.sync_interval_minutes && !(0, _utils.isInt)(params.sync_interval_minutes))) {
|
|
703
|
-
|
|
759
|
+
_context8.next = 11;
|
|
704
760
|
break;
|
|
705
761
|
}
|
|
706
762
|
throw new errors.InvalidParameterError("Bad parameter: sync_interval_minutes must be of type Int, received ".concat((0, _utils.getType)(params.sync_interval_minutes)));
|
|
707
763
|
case 11:
|
|
708
764
|
if (!(params.recurring_day && !(0, _utils.isInt)(params.recurring_day))) {
|
|
709
|
-
|
|
765
|
+
_context8.next = 12;
|
|
710
766
|
break;
|
|
711
767
|
}
|
|
712
768
|
throw new errors.InvalidParameterError("Bad parameter: recurring_day must be of type Int, received ".concat((0, _utils.getType)(params.recurring_day)));
|
|
713
769
|
case 12:
|
|
714
770
|
if (!(params.schedule_time_zone && !(0, _utils.isString)(params.schedule_time_zone))) {
|
|
715
|
-
|
|
771
|
+
_context8.next = 13;
|
|
716
772
|
break;
|
|
717
773
|
}
|
|
718
774
|
throw new errors.InvalidParameterError("Bad parameter: schedule_time_zone must be of type String, received ".concat((0, _utils.getType)(params.schedule_time_zone)));
|
|
719
775
|
case 13:
|
|
720
776
|
if (!(params.schedule_days_of_week && !(0, _utils.isArray)(params.schedule_days_of_week))) {
|
|
721
|
-
|
|
777
|
+
_context8.next = 14;
|
|
722
778
|
break;
|
|
723
779
|
}
|
|
724
780
|
throw new errors.InvalidParameterError("Bad parameter: schedule_days_of_week must be of type Array, received ".concat((0, _utils.getType)(params.schedule_days_of_week)));
|
|
725
781
|
case 14:
|
|
726
782
|
if (!(params.schedule_times_of_day && !(0, _utils.isArray)(params.schedule_times_of_day))) {
|
|
727
|
-
|
|
783
|
+
_context8.next = 15;
|
|
728
784
|
break;
|
|
729
785
|
}
|
|
730
786
|
throw new errors.InvalidParameterError("Bad parameter: schedule_times_of_day must be of type Array, received ".concat((0, _utils.getType)(params.schedule_times_of_day)));
|
|
731
787
|
case 15:
|
|
732
|
-
|
|
788
|
+
_context8.next = 16;
|
|
733
789
|
return _Api.default.sendRequest('/syncs', 'POST', params, options);
|
|
734
790
|
case 16:
|
|
735
|
-
response =
|
|
736
|
-
return
|
|
791
|
+
response = _context8.sent;
|
|
792
|
+
return _context8.abrupt("return", new _Sync(response === null || response === void 0 ? void 0 : response.data, options));
|
|
737
793
|
case 17:
|
|
738
794
|
case "end":
|
|
739
|
-
return
|
|
795
|
+
return _context8.stop();
|
|
740
796
|
}
|
|
741
|
-
},
|
|
797
|
+
}, _callee8);
|
|
742
798
|
})));
|
|
743
799
|
var _default = exports.default = Sync;
|
|
744
800
|
module.exports = Sync;
|