files.com 1.0.271 → 1.0.273
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/_VERSION +1 -1
- package/docs/models/Bundle.md +2 -0
- package/docs/models/Site.md +5 -1
- package/docs/models/Snapshot.md +18 -2
- package/lib/models/Bundle.js +10 -3
- package/lib/models/Site.js +5 -0
- package/lib/models/Snapshot.js +67 -14
- package/package.json +1 -1
- package/src/models/Bundle.js +5 -0
- package/src/models/Site.js +4 -0
- package/src/models/Snapshot.js +38 -2
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.273
|
package/docs/models/Bundle.md
CHANGED
|
@@ -159,6 +159,7 @@ await Bundle.create({
|
|
|
159
159
|
'skip_email': true,
|
|
160
160
|
'skip_name': true,
|
|
161
161
|
'skip_company': true,
|
|
162
|
+
'snapshot_id': 1,
|
|
162
163
|
})
|
|
163
164
|
```
|
|
164
165
|
|
|
@@ -188,6 +189,7 @@ await Bundle.create({
|
|
|
188
189
|
* `skip_email` (boolean): BundleRegistrations can be saved without providing email?
|
|
189
190
|
* `skip_name` (boolean): BundleRegistrations can be saved without providing name?
|
|
190
191
|
* `skip_company` (boolean): BundleRegistrations can be saved without providing company?
|
|
192
|
+
* `snapshot_id` (int64): ID of the snapshot containing this bundle's contents.
|
|
191
193
|
* `watermark_attachment_file` (file): Preview watermark image applied to all bundle items.
|
|
192
194
|
|
|
193
195
|
---
|
package/docs/models/Site.md
CHANGED
|
@@ -213,7 +213,8 @@
|
|
|
213
213
|
"welcome_email_enabled": true,
|
|
214
214
|
"welcome_screen": "user_controlled",
|
|
215
215
|
"windows_mode_ftp": true,
|
|
216
|
-
"disable_users_from_inactivity_period_days": 1
|
|
216
|
+
"disable_users_from_inactivity_period_days": 1,
|
|
217
|
+
"group_admins_can_set_user_password": true
|
|
217
218
|
}
|
|
218
219
|
```
|
|
219
220
|
|
|
@@ -358,6 +359,7 @@
|
|
|
358
359
|
* `welcome_screen` (string): Does the welcome screen appear?
|
|
359
360
|
* `windows_mode_ftp` (boolean): Does FTP user Windows emulation mode?
|
|
360
361
|
* `disable_users_from_inactivity_period_days` (int64): If greater than zero, users will unable to login if they do not show activity within this number of days.
|
|
362
|
+
* `group_admins_can_set_user_password` (boolean): Allow group admins set password authentication method
|
|
361
363
|
|
|
362
364
|
---
|
|
363
365
|
|
|
@@ -461,6 +463,7 @@ await Site.update({
|
|
|
461
463
|
'sftp_host_key_type': "default",
|
|
462
464
|
'active_sftp_host_key_id': 1,
|
|
463
465
|
'bundle_watermark_value': {"key":"example value"},
|
|
466
|
+
'group_admins_can_set_user_password': true,
|
|
464
467
|
'allowed_2fa_method_sms': true,
|
|
465
468
|
'allowed_2fa_method_u2f': true,
|
|
466
469
|
'allowed_2fa_method_totp': true,
|
|
@@ -591,6 +594,7 @@ await Site.update({
|
|
|
591
594
|
* `sftp_host_key_type` (string): Sftp Host Key Type
|
|
592
595
|
* `active_sftp_host_key_id` (int64): Id of the currently selected custom SFTP Host Key
|
|
593
596
|
* `bundle_watermark_value` (object): Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
|
|
597
|
+
* `group_admins_can_set_user_password` (boolean): Allow group admins set password authentication method
|
|
594
598
|
* `allowed_2fa_method_sms` (boolean): Is SMS two factor authentication allowed?
|
|
595
599
|
* `allowed_2fa_method_u2f` (boolean): Is U2F two factor authentication allowed?
|
|
596
600
|
* `allowed_2fa_method_totp` (boolean): Is TOTP two factor authentication allowed?
|
package/docs/models/Snapshot.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* `name` (string): A name for the snapshot.
|
|
18
18
|
* `user_id` (int64): The user that created this snapshot, if applicable.
|
|
19
19
|
* `bundle_id` (int64): The bundle using this snapshot, if applicable.
|
|
20
|
+
* `paths` (array(string)): An array of paths to add to the snapshot.
|
|
20
21
|
* `id` (int64): Snapshot ID.
|
|
21
22
|
|
|
22
23
|
---
|
|
@@ -53,10 +54,19 @@ await Snapshot.find(id)
|
|
|
53
54
|
## Create Snapshot
|
|
54
55
|
|
|
55
56
|
```
|
|
56
|
-
await Snapshot.create
|
|
57
|
+
await Snapshot.create({
|
|
58
|
+
'expires_at': "2000-01-01T01:00:00Z",
|
|
59
|
+
'name': "My Snapshot",
|
|
60
|
+
})
|
|
57
61
|
```
|
|
58
62
|
|
|
59
63
|
|
|
64
|
+
### Parameters
|
|
65
|
+
|
|
66
|
+
* `expires_at` (string): When the snapshot expires.
|
|
67
|
+
* `name` (string): A name for the snapshot.
|
|
68
|
+
* `paths` (array(string)): An array of paths to add to the snapshot.
|
|
69
|
+
|
|
60
70
|
---
|
|
61
71
|
|
|
62
72
|
## Update Snapshot
|
|
@@ -64,12 +74,18 @@ await Snapshot.create
|
|
|
64
74
|
```
|
|
65
75
|
const [snapshot] = await Snapshot.list()
|
|
66
76
|
|
|
67
|
-
await snapshot.update(
|
|
77
|
+
await snapshot.update({
|
|
78
|
+
'expires_at': "2000-01-01T01:00:00Z",
|
|
79
|
+
'name': "My Snapshot",
|
|
80
|
+
})
|
|
68
81
|
```
|
|
69
82
|
|
|
70
83
|
### Parameters
|
|
71
84
|
|
|
72
85
|
* `id` (int64): Required - Snapshot ID.
|
|
86
|
+
* `expires_at` (string): When the snapshot expires.
|
|
87
|
+
* `name` (string): A name for the snapshot.
|
|
88
|
+
* `paths` (array(string)): An array of paths to add to the snapshot.
|
|
73
89
|
|
|
74
90
|
### Example Response
|
|
75
91
|
|
package/lib/models/Bundle.js
CHANGED
|
@@ -716,6 +716,7 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
|
|
|
716
716
|
// skip_email - boolean - BundleRegistrations can be saved without providing email?
|
|
717
717
|
// skip_name - boolean - BundleRegistrations can be saved without providing name?
|
|
718
718
|
// skip_company - boolean - BundleRegistrations can be saved without providing company?
|
|
719
|
+
// snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
|
|
719
720
|
// watermark_attachment_file - file - Preview watermark image applied to all bundle items.
|
|
720
721
|
(0, _defineProperty2.default)(Bundle, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
721
722
|
var params,
|
|
@@ -811,12 +812,18 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
|
|
|
811
812
|
}
|
|
812
813
|
throw new errors.InvalidParameterError("Bad parameter: inbox_id must be of type Int, received ".concat((0, _utils.getType)(params['inbox_id'])));
|
|
813
814
|
case 30:
|
|
814
|
-
|
|
815
|
-
|
|
815
|
+
if (!(params['snapshot_id'] && !(0, _utils.isInt)(params['snapshot_id']))) {
|
|
816
|
+
_context6.next = 32;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
throw new errors.InvalidParameterError("Bad parameter: snapshot_id must be of type Int, received ".concat((0, _utils.getType)(params['snapshot_id'])));
|
|
816
820
|
case 32:
|
|
821
|
+
_context6.next = 34;
|
|
822
|
+
return _Api.default.sendRequest("/bundles", 'POST', params, options);
|
|
823
|
+
case 34:
|
|
817
824
|
response = _context6.sent;
|
|
818
825
|
return _context6.abrupt("return", new Bundle(response === null || response === void 0 ? void 0 : response.data, options));
|
|
819
|
-
case
|
|
826
|
+
case 36:
|
|
820
827
|
case "end":
|
|
821
828
|
return _context6.stop();
|
|
822
829
|
}
|
package/lib/models/Site.js
CHANGED
|
@@ -595,6 +595,10 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
|
|
|
595
595
|
(0, _defineProperty2.default)(this, "getDisableUsersFromInactivityPeriodDays", function () {
|
|
596
596
|
return _this.attributes.disable_users_from_inactivity_period_days;
|
|
597
597
|
});
|
|
598
|
+
// boolean # Allow group admins set password authentication method
|
|
599
|
+
(0, _defineProperty2.default)(this, "getGroupAdminsCanSetUserPassword", function () {
|
|
600
|
+
return _this.attributes.group_admins_can_set_user_password;
|
|
601
|
+
});
|
|
598
602
|
Object.entries(attributes).forEach(function (_ref) {
|
|
599
603
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
600
604
|
key = _ref2[0],
|
|
@@ -725,6 +729,7 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
|
|
|
725
729
|
// sftp_host_key_type - string - Sftp Host Key Type
|
|
726
730
|
// active_sftp_host_key_id - int64 - Id of the currently selected custom SFTP Host Key
|
|
727
731
|
// bundle_watermark_value - object - Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
|
|
732
|
+
// group_admins_can_set_user_password - boolean - Allow group admins set password authentication method
|
|
728
733
|
// allowed_2fa_method_sms - boolean - Is SMS two factor authentication allowed?
|
|
729
734
|
// allowed_2fa_method_u2f - boolean - Is U2F two factor authentication allowed?
|
|
730
735
|
// allowed_2fa_method_totp - boolean - Is TOTP two factor authentication allowed?
|
package/lib/models/Snapshot.js
CHANGED
|
@@ -66,6 +66,13 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
|
|
|
66
66
|
(0, _defineProperty2.default)(this, "setBundleId", function (value) {
|
|
67
67
|
_this.attributes.bundle_id = value;
|
|
68
68
|
});
|
|
69
|
+
// array(string) # An array of paths to add to the snapshot.
|
|
70
|
+
(0, _defineProperty2.default)(this, "getPaths", function () {
|
|
71
|
+
return _this.attributes.paths;
|
|
72
|
+
});
|
|
73
|
+
(0, _defineProperty2.default)(this, "setPaths", function (value) {
|
|
74
|
+
_this.attributes.paths = value;
|
|
75
|
+
});
|
|
69
76
|
// int64 # Snapshot ID.
|
|
70
77
|
(0, _defineProperty2.default)(this, "getId", function () {
|
|
71
78
|
return _this.attributes.id;
|
|
@@ -73,6 +80,10 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
|
|
|
73
80
|
(0, _defineProperty2.default)(this, "setId", function (value) {
|
|
74
81
|
_this.attributes.id = value;
|
|
75
82
|
});
|
|
83
|
+
// Parameters:
|
|
84
|
+
// expires_at - string - When the snapshot expires.
|
|
85
|
+
// name - string - A name for the snapshot.
|
|
86
|
+
// paths - array(string) - An array of paths to add to the snapshot.
|
|
76
87
|
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
77
88
|
var params,
|
|
78
89
|
response,
|
|
@@ -100,26 +111,44 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
|
|
|
100
111
|
}
|
|
101
112
|
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
|
102
113
|
case 8:
|
|
103
|
-
if (params['
|
|
114
|
+
if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
|
|
115
|
+
_context.next = 10;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(expires_at)));
|
|
119
|
+
case 10:
|
|
120
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
|
121
|
+
_context.next = 12;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
|
125
|
+
case 12:
|
|
126
|
+
if (!(params['paths'] && !(0, _utils.isArray)(params['paths']))) {
|
|
104
127
|
_context.next = 14;
|
|
105
128
|
break;
|
|
106
129
|
}
|
|
130
|
+
throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(paths)));
|
|
131
|
+
case 14:
|
|
132
|
+
if (params['id']) {
|
|
133
|
+
_context.next = 20;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
107
136
|
if (!_this.attributes.id) {
|
|
108
|
-
_context.next =
|
|
137
|
+
_context.next = 19;
|
|
109
138
|
break;
|
|
110
139
|
}
|
|
111
140
|
params['id'] = _this.id;
|
|
112
|
-
_context.next =
|
|
141
|
+
_context.next = 20;
|
|
113
142
|
break;
|
|
114
|
-
case
|
|
143
|
+
case 19:
|
|
115
144
|
throw new errors.MissingParameterError('Parameter missing: id');
|
|
116
|
-
case
|
|
117
|
-
_context.next =
|
|
145
|
+
case 20:
|
|
146
|
+
_context.next = 22;
|
|
118
147
|
return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
|
|
119
|
-
case
|
|
148
|
+
case 22:
|
|
120
149
|
response = _context.sent;
|
|
121
150
|
return _context.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
122
|
-
case
|
|
151
|
+
case 24:
|
|
123
152
|
case "end":
|
|
124
153
|
return _context.stop();
|
|
125
154
|
}
|
|
@@ -299,20 +328,44 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
|
|
|
299
328
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
300
329
|
return Snapshot.find(id, params, options);
|
|
301
330
|
});
|
|
331
|
+
// Parameters:
|
|
332
|
+
// expires_at - string - When the snapshot expires.
|
|
333
|
+
// name - string - A name for the snapshot.
|
|
334
|
+
// paths - array(string) - An array of paths to add to the snapshot.
|
|
302
335
|
(0, _defineProperty2.default)(Snapshot, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
303
|
-
var
|
|
336
|
+
var params,
|
|
337
|
+
options,
|
|
304
338
|
response,
|
|
305
339
|
_args5 = arguments;
|
|
306
340
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
307
341
|
while (1) switch (_context5.prev = _context5.next) {
|
|
308
342
|
case 0:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
343
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
344
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
345
|
+
if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
|
|
346
|
+
_context5.next = 4;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(params['expires_at'])));
|
|
350
|
+
case 4:
|
|
351
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
|
352
|
+
_context5.next = 6;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
|
|
356
|
+
case 6:
|
|
357
|
+
if (!(params['paths'] && !(0, _utils.isArray)(params['paths']))) {
|
|
358
|
+
_context5.next = 8;
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(params['paths'])));
|
|
362
|
+
case 8:
|
|
363
|
+
_context5.next = 10;
|
|
364
|
+
return _Api.default.sendRequest("/snapshots", 'POST', params, options);
|
|
365
|
+
case 10:
|
|
313
366
|
response = _context5.sent;
|
|
314
367
|
return _context5.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
|
|
315
|
-
case
|
|
368
|
+
case 12:
|
|
316
369
|
case "end":
|
|
317
370
|
return _context5.stop();
|
|
318
371
|
}
|
package/package.json
CHANGED
package/src/models/Bundle.js
CHANGED
|
@@ -522,6 +522,7 @@ class Bundle {
|
|
|
522
522
|
// skip_email - boolean - BundleRegistrations can be saved without providing email?
|
|
523
523
|
// skip_name - boolean - BundleRegistrations can be saved without providing name?
|
|
524
524
|
// skip_company - boolean - BundleRegistrations can be saved without providing company?
|
|
525
|
+
// snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
|
|
525
526
|
// watermark_attachment_file - file - Preview watermark image applied to all bundle items.
|
|
526
527
|
static create = async (params = {}, options = {}) => {
|
|
527
528
|
if (!params['paths']) {
|
|
@@ -580,6 +581,10 @@ class Bundle {
|
|
|
580
581
|
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
|
|
581
582
|
}
|
|
582
583
|
|
|
584
|
+
if (params['snapshot_id'] && !isInt(params['snapshot_id'])) {
|
|
585
|
+
throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params['snapshot_id'])}`)
|
|
586
|
+
}
|
|
587
|
+
|
|
583
588
|
const response = await Api.sendRequest(`/bundles`, 'POST', params, options)
|
|
584
589
|
|
|
585
590
|
return new Bundle(response?.data, options)
|
package/src/models/Site.js
CHANGED
|
@@ -446,6 +446,9 @@ class Site {
|
|
|
446
446
|
// int64 # If greater than zero, users will unable to login if they do not show activity within this number of days.
|
|
447
447
|
getDisableUsersFromInactivityPeriodDays = () => this.attributes.disable_users_from_inactivity_period_days
|
|
448
448
|
|
|
449
|
+
// boolean # Allow group admins set password authentication method
|
|
450
|
+
getGroupAdminsCanSetUserPassword = () => this.attributes.group_admins_can_set_user_password
|
|
451
|
+
|
|
449
452
|
|
|
450
453
|
static get = async (options = {}) => {
|
|
451
454
|
const response = await Api.sendRequest(`/site`, 'GET', {}, options)
|
|
@@ -538,6 +541,7 @@ class Site {
|
|
|
538
541
|
// sftp_host_key_type - string - Sftp Host Key Type
|
|
539
542
|
// active_sftp_host_key_id - int64 - Id of the currently selected custom SFTP Host Key
|
|
540
543
|
// bundle_watermark_value - object - Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
|
|
544
|
+
// group_admins_can_set_user_password - boolean - Allow group admins set password authentication method
|
|
541
545
|
// allowed_2fa_method_sms - boolean - Is SMS two factor authentication allowed?
|
|
542
546
|
// allowed_2fa_method_u2f - boolean - Is U2F two factor authentication allowed?
|
|
543
547
|
// allowed_2fa_method_totp - boolean - Is TOTP two factor authentication allowed?
|
package/src/models/Snapshot.js
CHANGED
|
@@ -58,6 +58,13 @@ class Snapshot {
|
|
|
58
58
|
this.attributes.bundle_id = value
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// array(string) # An array of paths to add to the snapshot.
|
|
62
|
+
getPaths = () => this.attributes.paths
|
|
63
|
+
|
|
64
|
+
setPaths = value => {
|
|
65
|
+
this.attributes.paths = value
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
// int64 # Snapshot ID.
|
|
62
69
|
getId = () => this.attributes.id
|
|
63
70
|
|
|
@@ -66,6 +73,10 @@ class Snapshot {
|
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
|
|
76
|
+
// Parameters:
|
|
77
|
+
// expires_at - string - When the snapshot expires.
|
|
78
|
+
// name - string - A name for the snapshot.
|
|
79
|
+
// paths - array(string) - An array of paths to add to the snapshot.
|
|
69
80
|
update = async (params = {}) => {
|
|
70
81
|
if (!this.attributes.id) {
|
|
71
82
|
throw new errors.EmptyPropertyError('Current object has no id')
|
|
@@ -79,6 +90,15 @@ class Snapshot {
|
|
|
79
90
|
if (params['id'] && !isInt(params['id'])) {
|
|
80
91
|
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
|
81
92
|
}
|
|
93
|
+
if (params['expires_at'] && !isString(params['expires_at'])) {
|
|
94
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(expires_at)}`)
|
|
95
|
+
}
|
|
96
|
+
if (params['name'] && !isString(params['name'])) {
|
|
97
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
|
98
|
+
}
|
|
99
|
+
if (params['paths'] && !isArray(params['paths'])) {
|
|
100
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(paths)}`)
|
|
101
|
+
}
|
|
82
102
|
|
|
83
103
|
if (!params['id']) {
|
|
84
104
|
if (this.attributes.id) {
|
|
@@ -178,8 +198,24 @@ class Snapshot {
|
|
|
178
198
|
static get = (id, params = {}, options = {}) =>
|
|
179
199
|
Snapshot.find(id, params, options)
|
|
180
200
|
|
|
181
|
-
|
|
182
|
-
|
|
201
|
+
// Parameters:
|
|
202
|
+
// expires_at - string - When the snapshot expires.
|
|
203
|
+
// name - string - A name for the snapshot.
|
|
204
|
+
// paths - array(string) - An array of paths to add to the snapshot.
|
|
205
|
+
static create = async (params = {}, options = {}) => {
|
|
206
|
+
if (params['expires_at'] && !isString(params['expires_at'])) {
|
|
207
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (params['name'] && !isString(params['name'])) {
|
|
211
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (params['paths'] && !isArray(params['paths'])) {
|
|
215
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const response = await Api.sendRequest(`/snapshots`, 'POST', params, options)
|
|
183
219
|
|
|
184
220
|
return new Snapshot(response?.data, options)
|
|
185
221
|
}
|