files.com 1.2.293 → 1.2.294

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 CHANGED
@@ -1 +1 @@
1
- 1.2.293
1
+ 1.2.294
@@ -0,0 +1,119 @@
1
+ # ChildSiteManagementPolicy
2
+
3
+ ## Example ChildSiteManagementPolicy Object
4
+
5
+ ```
6
+ {
7
+ "id": 1,
8
+ "site_id": 1,
9
+ "site_setting_name": "color2_left",
10
+ "managed_value": "#FF0000",
11
+ "skip_child_site_ids": [
12
+ 1,
13
+ 5
14
+ ]
15
+ }
16
+ ```
17
+
18
+ * `id` (int64): ChildSiteManagementPolicy ID
19
+ * `site_id` (int64): ID of the Site managing the policy
20
+ * `site_setting_name` (string): The name of the setting that is managed by the policy
21
+ * `managed_value` (string): The value for the setting that will be enforced for all child sites that are not exempt
22
+ * `skip_child_site_ids` (array(int64)): The list of child site IDs that are exempt from this policy
23
+
24
+ ---
25
+
26
+ ## List Child Site Management Policies
27
+
28
+ ```
29
+ await ChildSiteManagementPolicy.list
30
+ ```
31
+
32
+
33
+ ### Parameters
34
+
35
+ * `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.
36
+ * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
37
+
38
+ ---
39
+
40
+ ## Show Child Site Management Policy
41
+
42
+ ```
43
+ await ChildSiteManagementPolicy.find(id)
44
+ ```
45
+
46
+
47
+ ### Parameters
48
+
49
+ * `id` (int64): Required - Child Site Management Policy ID.
50
+
51
+ ---
52
+
53
+ ## Create Child Site Management Policy
54
+
55
+ ```
56
+ await ChildSiteManagementPolicy.create({
57
+ 'site_setting_name': "color2_left",
58
+ 'managed_value': "#FF0000",
59
+ 'skip_child_site_ids': [1,5],
60
+ })
61
+ ```
62
+
63
+
64
+ ### Parameters
65
+
66
+ * `site_setting_name` (string): Required - The name of the setting that is managed by the policy
67
+ * `managed_value` (string): Required - The value for the setting that will be enforced for all child sites that are not exempt
68
+ * `skip_child_site_ids` (array(int64)): The list of child site IDs that are exempt from this policy
69
+
70
+ ---
71
+
72
+ ## Update Child Site Management Policy
73
+
74
+ ```
75
+ const child_site_management_policy = await ChildSiteManagementPolicy.find(id)
76
+
77
+ await child_site_management_policy.update({
78
+ 'site_setting_name': "color2_left",
79
+ 'managed_value': "#FF0000",
80
+ 'skip_child_site_ids': [1,5],
81
+ })
82
+ ```
83
+
84
+ ### Parameters
85
+
86
+ * `id` (int64): Required - Child Site Management Policy ID.
87
+ * `site_setting_name` (string): Required - The name of the setting that is managed by the policy
88
+ * `managed_value` (string): Required - The value for the setting that will be enforced for all child sites that are not exempt
89
+ * `skip_child_site_ids` (array(int64)): The list of child site IDs that are exempt from this policy
90
+
91
+ ### Example Response
92
+
93
+ ```json
94
+ {
95
+ "id": 1,
96
+ "site_id": 1,
97
+ "site_setting_name": "color2_left",
98
+ "managed_value": "#FF0000",
99
+ "skip_child_site_ids": [
100
+ 1,
101
+ 5
102
+ ]
103
+ }
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Delete Child Site Management Policy
109
+
110
+ ```
111
+ const child_site_management_policy = await ChildSiteManagementPolicy.find(id)
112
+
113
+ await child_site_management_policy.delete()
114
+ ```
115
+
116
+ ### Parameters
117
+
118
+ * `id` (int64): Required - Child Site Management Policy ID.
119
+
@@ -59,7 +59,7 @@ Examples:
59
59
  * 10 requests/minute: '10-M'
60
60
  * 1000 requests/hour: '1000-H'
61
61
  * 2000 requests/day: '2000-D'
62
- * `auto_update_policy` (string): Auto update policy ['manual_trigger', 'critical_only', 'always'] (default critical_only)
62
+ * `auto_update_policy` (string): Auto update policy ['manual_trigger', 'critical_only', 'always', 'never'] (default critical_only)
63
63
  * `api_token` (string): Files Agent API Token
64
64
  * `port` (int64): Incoming port for files agent connections
65
65
  * `hostname` (string):
@@ -300,7 +300,10 @@
300
300
  "welcome_email_enabled": true,
301
301
  "welcome_screen": "user_controlled",
302
302
  "windows_mode_ftp": true,
303
- "group_admins_can_set_user_password": true
303
+ "group_admins_can_set_user_password": true,
304
+ "managed_site_settings": [
305
+ "example"
306
+ ]
304
307
  }
305
308
  ```
306
309
 
@@ -475,6 +478,7 @@
475
478
  * `welcome_screen` (string): Does the welcome screen appear?
476
479
  * `windows_mode_ftp` (boolean): Does FTP user Windows emulation mode?
477
480
  * `group_admins_can_set_user_password` (boolean): Allow group admins set password authentication method
481
+ * `managed_site_settings` (array(string)): List of site settings managed by the parent site
478
482
 
479
483
  ---
480
484
 
package/lib/Files.js CHANGED
@@ -12,7 +12,7 @@ var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
14
  var language = null;
15
- var version = '1.2.293';
15
+ var version = '1.2.294';
16
16
  var userAgent = "Files.com JavaScript SDK v".concat(version);
17
17
  var logLevel = _Logger.LogLevel.INFO;
18
18
  var debugRequest = false;
@@ -0,0 +1,419 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+ var _Api = _interopRequireDefault(require("../Api"));
14
+ var errors = _interopRequireWildcard(require("../Errors"));
15
+ var _utils = require("../utils");
16
+ var _ChildSiteManagementPolicy;
17
+ /* eslint-disable no-unused-vars */
18
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
+ /* eslint-enable no-unused-vars */
22
+ /**
23
+ * Class ChildSiteManagementPolicy
24
+ */
25
+ var ChildSiteManagementPolicy = /*#__PURE__*/(0, _createClass2.default)(function ChildSiteManagementPolicy() {
26
+ var _this = this;
27
+ var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
+ (0, _classCallCheck2.default)(this, ChildSiteManagementPolicy);
30
+ (0, _defineProperty2.default)(this, "attributes", {});
31
+ (0, _defineProperty2.default)(this, "options", {});
32
+ (0, _defineProperty2.default)(this, "isLoaded", function () {
33
+ return !!_this.attributes.id;
34
+ });
35
+ // int64 # ChildSiteManagementPolicy ID
36
+ (0, _defineProperty2.default)(this, "getId", function () {
37
+ return _this.attributes.id;
38
+ });
39
+ (0, _defineProperty2.default)(this, "setId", function (value) {
40
+ _this.attributes.id = value;
41
+ });
42
+ // int64 # ID of the Site managing the policy
43
+ (0, _defineProperty2.default)(this, "getSiteId", function () {
44
+ return _this.attributes.site_id;
45
+ });
46
+ (0, _defineProperty2.default)(this, "setSiteId", function (value) {
47
+ _this.attributes.site_id = value;
48
+ });
49
+ // string # The name of the setting that is managed by the policy
50
+ (0, _defineProperty2.default)(this, "getSiteSettingName", function () {
51
+ return _this.attributes.site_setting_name;
52
+ });
53
+ (0, _defineProperty2.default)(this, "setSiteSettingName", function (value) {
54
+ _this.attributes.site_setting_name = value;
55
+ });
56
+ // string # The value for the setting that will be enforced for all child sites that are not exempt
57
+ (0, _defineProperty2.default)(this, "getManagedValue", function () {
58
+ return _this.attributes.managed_value;
59
+ });
60
+ (0, _defineProperty2.default)(this, "setManagedValue", function (value) {
61
+ _this.attributes.managed_value = value;
62
+ });
63
+ // array(int64) # The list of child site IDs that are exempt from this policy
64
+ (0, _defineProperty2.default)(this, "getSkipChildSiteIds", function () {
65
+ return _this.attributes.skip_child_site_ids;
66
+ });
67
+ (0, _defineProperty2.default)(this, "setSkipChildSiteIds", function (value) {
68
+ _this.attributes.skip_child_site_ids = value;
69
+ });
70
+ // Parameters:
71
+ // site_setting_name (required) - string - The name of the setting that is managed by the policy
72
+ // managed_value (required) - string - The value for the setting that will be enforced for all child sites that are not exempt
73
+ // skip_child_site_ids - array(int64) - The list of child site IDs that are exempt from this policy
74
+ (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
75
+ var params,
76
+ response,
77
+ _args = arguments;
78
+ return _regenerator.default.wrap(function (_context) {
79
+ while (1) switch (_context.prev = _context.next) {
80
+ case 0:
81
+ params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
82
+ if (_this.attributes.id) {
83
+ _context.next = 1;
84
+ break;
85
+ }
86
+ throw new errors.EmptyPropertyError('Current object has no id');
87
+ case 1:
88
+ if ((0, _utils.isObject)(params)) {
89
+ _context.next = 2;
90
+ break;
91
+ }
92
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
93
+ case 2:
94
+ params.id = _this.attributes.id;
95
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
96
+ _context.next = 3;
97
+ break;
98
+ }
99
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
100
+ case 3:
101
+ if (!(params.site_setting_name && !(0, _utils.isString)(params.site_setting_name))) {
102
+ _context.next = 4;
103
+ break;
104
+ }
105
+ throw new errors.InvalidParameterError("Bad parameter: site_setting_name must be of type String, received ".concat((0, _utils.getType)(params.site_setting_name)));
106
+ case 4:
107
+ if (!(params.managed_value && !(0, _utils.isString)(params.managed_value))) {
108
+ _context.next = 5;
109
+ break;
110
+ }
111
+ throw new errors.InvalidParameterError("Bad parameter: managed_value must be of type String, received ".concat((0, _utils.getType)(params.managed_value)));
112
+ case 5:
113
+ if (!(params.skip_child_site_ids && !(0, _utils.isArray)(params.skip_child_site_ids))) {
114
+ _context.next = 6;
115
+ break;
116
+ }
117
+ throw new errors.InvalidParameterError("Bad parameter: skip_child_site_ids must be of type Array, received ".concat((0, _utils.getType)(params.skip_child_site_ids)));
118
+ case 6:
119
+ if (params.id) {
120
+ _context.next = 8;
121
+ break;
122
+ }
123
+ if (!_this.attributes.id) {
124
+ _context.next = 7;
125
+ break;
126
+ }
127
+ params.id = _this.id;
128
+ _context.next = 8;
129
+ break;
130
+ case 7:
131
+ throw new errors.MissingParameterError('Parameter missing: id');
132
+ case 8:
133
+ if (params.site_setting_name) {
134
+ _context.next = 10;
135
+ break;
136
+ }
137
+ if (!_this.attributes.site_setting_name) {
138
+ _context.next = 9;
139
+ break;
140
+ }
141
+ params.site_setting_name = _this.site_setting_name;
142
+ _context.next = 10;
143
+ break;
144
+ case 9:
145
+ throw new errors.MissingParameterError('Parameter missing: site_setting_name');
146
+ case 10:
147
+ if (params.managed_value) {
148
+ _context.next = 12;
149
+ break;
150
+ }
151
+ if (!_this.attributes.managed_value) {
152
+ _context.next = 11;
153
+ break;
154
+ }
155
+ params.managed_value = _this.managed_value;
156
+ _context.next = 12;
157
+ break;
158
+ case 11:
159
+ throw new errors.MissingParameterError('Parameter missing: managed_value');
160
+ case 12:
161
+ _context.next = 13;
162
+ return _Api.default.sendRequest("/child_site_management_policies/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
163
+ case 13:
164
+ response = _context.sent;
165
+ return _context.abrupt("return", new ChildSiteManagementPolicy(response === null || response === void 0 ? void 0 : response.data, _this.options));
166
+ case 14:
167
+ case "end":
168
+ return _context.stop();
169
+ }
170
+ }, _callee);
171
+ })));
172
+ (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
173
+ var params,
174
+ _args2 = arguments;
175
+ return _regenerator.default.wrap(function (_context2) {
176
+ while (1) switch (_context2.prev = _context2.next) {
177
+ case 0:
178
+ params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
179
+ if (_this.attributes.id) {
180
+ _context2.next = 1;
181
+ break;
182
+ }
183
+ throw new errors.EmptyPropertyError('Current object has no id');
184
+ case 1:
185
+ if ((0, _utils.isObject)(params)) {
186
+ _context2.next = 2;
187
+ break;
188
+ }
189
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
190
+ case 2:
191
+ params.id = _this.attributes.id;
192
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
193
+ _context2.next = 3;
194
+ break;
195
+ }
196
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
197
+ case 3:
198
+ if (params.id) {
199
+ _context2.next = 5;
200
+ break;
201
+ }
202
+ if (!_this.attributes.id) {
203
+ _context2.next = 4;
204
+ break;
205
+ }
206
+ params.id = _this.id;
207
+ _context2.next = 5;
208
+ break;
209
+ case 4:
210
+ throw new errors.MissingParameterError('Parameter missing: id');
211
+ case 5:
212
+ _context2.next = 6;
213
+ return _Api.default.sendRequest("/child_site_management_policies/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
214
+ case 6:
215
+ case "end":
216
+ return _context2.stop();
217
+ }
218
+ }, _callee2);
219
+ })));
220
+ (0, _defineProperty2.default)(this, "destroy", function () {
221
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
222
+ return _this.delete(params);
223
+ });
224
+ (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
225
+ var _newObject, newObject;
226
+ return _regenerator.default.wrap(function (_context3) {
227
+ while (1) switch (_context3.prev = _context3.next) {
228
+ case 0:
229
+ if (!_this.attributes.id) {
230
+ _context3.next = 2;
231
+ break;
232
+ }
233
+ _context3.next = 1;
234
+ return _this.update(_this.attributes);
235
+ case 1:
236
+ _newObject = _context3.sent;
237
+ _this.attributes = _objectSpread({}, _newObject.attributes);
238
+ return _context3.abrupt("return", true);
239
+ case 2:
240
+ _context3.next = 3;
241
+ return ChildSiteManagementPolicy.create(_this.attributes, _this.options);
242
+ case 3:
243
+ newObject = _context3.sent;
244
+ _this.attributes = _objectSpread({}, newObject.attributes);
245
+ return _context3.abrupt("return", true);
246
+ case 4:
247
+ case "end":
248
+ return _context3.stop();
249
+ }
250
+ }, _callee3);
251
+ })));
252
+ Object.entries(attributes).forEach(function (_ref4) {
253
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
254
+ key = _ref5[0],
255
+ value = _ref5[1];
256
+ var normalizedKey = key.replace('?', '');
257
+ _this.attributes[normalizedKey] = value;
258
+ Object.defineProperty(_this, normalizedKey, {
259
+ value: value,
260
+ writable: false
261
+ });
262
+ });
263
+ this.options = _objectSpread({}, options);
264
+ });
265
+ _ChildSiteManagementPolicy = ChildSiteManagementPolicy;
266
+ // Parameters:
267
+ // 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.
268
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
269
+ (0, _defineProperty2.default)(ChildSiteManagementPolicy, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
270
+ var _response$data;
271
+ var params,
272
+ options,
273
+ response,
274
+ _args4 = arguments;
275
+ return _regenerator.default.wrap(function (_context4) {
276
+ while (1) switch (_context4.prev = _context4.next) {
277
+ case 0:
278
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
279
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
280
+ if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
281
+ _context4.next = 1;
282
+ break;
283
+ }
284
+ throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
285
+ case 1:
286
+ if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
287
+ _context4.next = 2;
288
+ break;
289
+ }
290
+ throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
291
+ case 2:
292
+ _context4.next = 3;
293
+ return _Api.default.sendRequest('/child_site_management_policies', 'GET', params, options);
294
+ case 3:
295
+ response = _context4.sent;
296
+ 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) {
297
+ return new _ChildSiteManagementPolicy(obj, options);
298
+ })) || []);
299
+ case 4:
300
+ case "end":
301
+ return _context4.stop();
302
+ }
303
+ }, _callee4);
304
+ })));
305
+ (0, _defineProperty2.default)(ChildSiteManagementPolicy, "all", function () {
306
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
307
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
308
+ return _ChildSiteManagementPolicy.list(params, options);
309
+ });
310
+ // Parameters:
311
+ // id (required) - int64 - Child Site Management Policy ID.
312
+ (0, _defineProperty2.default)(ChildSiteManagementPolicy, "find", /*#__PURE__*/function () {
313
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
314
+ var params,
315
+ options,
316
+ response,
317
+ _args5 = arguments;
318
+ return _regenerator.default.wrap(function (_context5) {
319
+ while (1) switch (_context5.prev = _context5.next) {
320
+ case 0:
321
+ params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
322
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
323
+ if ((0, _utils.isObject)(params)) {
324
+ _context5.next = 1;
325
+ break;
326
+ }
327
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
328
+ case 1:
329
+ params.id = id;
330
+ if (params.id) {
331
+ _context5.next = 2;
332
+ break;
333
+ }
334
+ throw new errors.MissingParameterError('Parameter missing: id');
335
+ case 2:
336
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
337
+ _context5.next = 3;
338
+ break;
339
+ }
340
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
341
+ case 3:
342
+ _context5.next = 4;
343
+ return _Api.default.sendRequest("/child_site_management_policies/".concat(encodeURIComponent(params.id)), 'GET', params, options);
344
+ case 4:
345
+ response = _context5.sent;
346
+ return _context5.abrupt("return", new _ChildSiteManagementPolicy(response === null || response === void 0 ? void 0 : response.data, options));
347
+ case 5:
348
+ case "end":
349
+ return _context5.stop();
350
+ }
351
+ }, _callee5);
352
+ }));
353
+ return function (_x) {
354
+ return _ref7.apply(this, arguments);
355
+ };
356
+ }());
357
+ (0, _defineProperty2.default)(ChildSiteManagementPolicy, "get", function (id) {
358
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
359
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
360
+ return _ChildSiteManagementPolicy.find(id, params, options);
361
+ });
362
+ // Parameters:
363
+ // site_setting_name (required) - string - The name of the setting that is managed by the policy
364
+ // managed_value (required) - string - The value for the setting that will be enforced for all child sites that are not exempt
365
+ // skip_child_site_ids - array(int64) - The list of child site IDs that are exempt from this policy
366
+ (0, _defineProperty2.default)(ChildSiteManagementPolicy, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
367
+ var params,
368
+ options,
369
+ response,
370
+ _args6 = arguments;
371
+ return _regenerator.default.wrap(function (_context6) {
372
+ while (1) switch (_context6.prev = _context6.next) {
373
+ case 0:
374
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
375
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
376
+ if (params.site_setting_name) {
377
+ _context6.next = 1;
378
+ break;
379
+ }
380
+ throw new errors.MissingParameterError('Parameter missing: site_setting_name');
381
+ case 1:
382
+ if (params.managed_value) {
383
+ _context6.next = 2;
384
+ break;
385
+ }
386
+ throw new errors.MissingParameterError('Parameter missing: managed_value');
387
+ case 2:
388
+ if (!(params.site_setting_name && !(0, _utils.isString)(params.site_setting_name))) {
389
+ _context6.next = 3;
390
+ break;
391
+ }
392
+ throw new errors.InvalidParameterError("Bad parameter: site_setting_name must be of type String, received ".concat((0, _utils.getType)(params.site_setting_name)));
393
+ case 3:
394
+ if (!(params.managed_value && !(0, _utils.isString)(params.managed_value))) {
395
+ _context6.next = 4;
396
+ break;
397
+ }
398
+ throw new errors.InvalidParameterError("Bad parameter: managed_value must be of type String, received ".concat((0, _utils.getType)(params.managed_value)));
399
+ case 4:
400
+ if (!(params.skip_child_site_ids && !(0, _utils.isArray)(params.skip_child_site_ids))) {
401
+ _context6.next = 5;
402
+ break;
403
+ }
404
+ throw new errors.InvalidParameterError("Bad parameter: skip_child_site_ids must be of type Array, received ".concat((0, _utils.getType)(params.skip_child_site_ids)));
405
+ case 5:
406
+ _context6.next = 6;
407
+ return _Api.default.sendRequest('/child_site_management_policies', 'POST', params, options);
408
+ case 6:
409
+ response = _context6.sent;
410
+ return _context6.abrupt("return", new _ChildSiteManagementPolicy(response === null || response === void 0 ? void 0 : response.data, options));
411
+ case 7:
412
+ case "end":
413
+ return _context6.stop();
414
+ }
415
+ }, _callee6);
416
+ })));
417
+ var _default = exports.default = ChildSiteManagementPolicy;
418
+ module.exports = ChildSiteManagementPolicy;
419
+ module.exports.default = ChildSiteManagementPolicy;
@@ -106,7 +106,7 @@ var RemoteServerConfigurationFile = /*#__PURE__*/(0, _createClass2.default)(func
106
106
  (0, _defineProperty2.default)(this, "getTransferRateLimit", function () {
107
107
  return _this.attributes.transfer_rate_limit;
108
108
  });
109
- // string # Auto update policy ['manual_trigger', 'critical_only', 'always'] (default critical_only)
109
+ // string # Auto update policy ['manual_trigger', 'critical_only', 'always', 'never'] (default critical_only)
110
110
  (0, _defineProperty2.default)(this, "getAutoUpdatePolicy", function () {
111
111
  return _this.attributes.auto_update_policy;
112
112
  });
@@ -716,6 +716,10 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
716
716
  (0, _defineProperty2.default)(this, "getGroupAdminsCanSetUserPassword", function () {
717
717
  return _this.attributes.group_admins_can_set_user_password;
718
718
  });
719
+ // array(string) # List of site settings managed by the parent site
720
+ (0, _defineProperty2.default)(this, "getManagedSiteSettings", function () {
721
+ return _this.attributes.managed_site_settings;
722
+ });
719
723
  Object.entries(attributes).forEach(function (_ref) {
720
724
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
721
725
  key = _ref2[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.293",
3
+ "version": "1.2.294",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -6,7 +6,7 @@ let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
8
  let language = null
9
- const version = '1.2.293'
9
+ const version = '1.2.294'
10
10
  let userAgent = `Files.com JavaScript SDK v${version}`
11
11
 
12
12
  let logLevel = LogLevel.INFO
@@ -0,0 +1,244 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import Api from '../Api'
3
+ import * as errors from '../Errors'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
7
+ /* eslint-enable no-unused-vars */
8
+
9
+ /**
10
+ * Class ChildSiteManagementPolicy
11
+ */
12
+ class ChildSiteManagementPolicy {
13
+ attributes = {}
14
+
15
+ options = {}
16
+
17
+ constructor(attributes = {}, options = {}) {
18
+ Object.entries(attributes).forEach(([key, value]) => {
19
+ const normalizedKey = key.replace('?', '')
20
+
21
+ this.attributes[normalizedKey] = value
22
+
23
+ Object.defineProperty(this, normalizedKey, { value, writable: false })
24
+ })
25
+
26
+ this.options = { ...options }
27
+ }
28
+
29
+ isLoaded = () => !!this.attributes.id
30
+
31
+ // int64 # ChildSiteManagementPolicy ID
32
+ getId = () => this.attributes.id
33
+
34
+ setId = value => {
35
+ this.attributes.id = value
36
+ }
37
+
38
+ // int64 # ID of the Site managing the policy
39
+ getSiteId = () => this.attributes.site_id
40
+
41
+ setSiteId = value => {
42
+ this.attributes.site_id = value
43
+ }
44
+
45
+ // string # The name of the setting that is managed by the policy
46
+ getSiteSettingName = () => this.attributes.site_setting_name
47
+
48
+ setSiteSettingName = value => {
49
+ this.attributes.site_setting_name = value
50
+ }
51
+
52
+ // string # The value for the setting that will be enforced for all child sites that are not exempt
53
+ getManagedValue = () => this.attributes.managed_value
54
+
55
+ setManagedValue = value => {
56
+ this.attributes.managed_value = value
57
+ }
58
+
59
+ // array(int64) # The list of child site IDs that are exempt from this policy
60
+ getSkipChildSiteIds = () => this.attributes.skip_child_site_ids
61
+
62
+ setSkipChildSiteIds = value => {
63
+ this.attributes.skip_child_site_ids = value
64
+ }
65
+
66
+ // Parameters:
67
+ // site_setting_name (required) - string - The name of the setting that is managed by the policy
68
+ // managed_value (required) - string - The value for the setting that will be enforced for all child sites that are not exempt
69
+ // skip_child_site_ids - array(int64) - The list of child site IDs that are exempt from this policy
70
+ update = async (params = {}) => {
71
+ if (!this.attributes.id) {
72
+ throw new errors.EmptyPropertyError('Current object has no id')
73
+ }
74
+
75
+ if (!isObject(params)) {
76
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
77
+ }
78
+
79
+ params.id = this.attributes.id
80
+ if (params.id && !isInt(params.id)) {
81
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
82
+ }
83
+
84
+ if (params.site_setting_name && !isString(params.site_setting_name)) {
85
+ throw new errors.InvalidParameterError(`Bad parameter: site_setting_name must be of type String, received ${getType(params.site_setting_name)}`)
86
+ }
87
+
88
+ if (params.managed_value && !isString(params.managed_value)) {
89
+ throw new errors.InvalidParameterError(`Bad parameter: managed_value must be of type String, received ${getType(params.managed_value)}`)
90
+ }
91
+
92
+ if (params.skip_child_site_ids && !isArray(params.skip_child_site_ids)) {
93
+ throw new errors.InvalidParameterError(`Bad parameter: skip_child_site_ids must be of type Array, received ${getType(params.skip_child_site_ids)}`)
94
+ }
95
+
96
+ if (!params.id) {
97
+ if (this.attributes.id) {
98
+ params.id = this.id
99
+ } else {
100
+ throw new errors.MissingParameterError('Parameter missing: id')
101
+ }
102
+ }
103
+
104
+ if (!params.site_setting_name) {
105
+ if (this.attributes.site_setting_name) {
106
+ params.site_setting_name = this.site_setting_name
107
+ } else {
108
+ throw new errors.MissingParameterError('Parameter missing: site_setting_name')
109
+ }
110
+ }
111
+
112
+ if (!params.managed_value) {
113
+ if (this.attributes.managed_value) {
114
+ params.managed_value = this.managed_value
115
+ } else {
116
+ throw new errors.MissingParameterError('Parameter missing: managed_value')
117
+ }
118
+ }
119
+
120
+ const response = await Api.sendRequest(`/child_site_management_policies/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
121
+
122
+ return new ChildSiteManagementPolicy(response?.data, this.options)
123
+ }
124
+
125
+ delete = async (params = {}) => {
126
+ if (!this.attributes.id) {
127
+ throw new errors.EmptyPropertyError('Current object has no id')
128
+ }
129
+
130
+ if (!isObject(params)) {
131
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
132
+ }
133
+
134
+ params.id = this.attributes.id
135
+ if (params.id && !isInt(params.id)) {
136
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
137
+ }
138
+
139
+ if (!params.id) {
140
+ if (this.attributes.id) {
141
+ params.id = this.id
142
+ } else {
143
+ throw new errors.MissingParameterError('Parameter missing: id')
144
+ }
145
+ }
146
+
147
+ await Api.sendRequest(`/child_site_management_policies/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
148
+ }
149
+
150
+ destroy = (params = {}) =>
151
+ this.delete(params)
152
+
153
+ save = async () => {
154
+ if (this.attributes.id) {
155
+ const newObject = await this.update(this.attributes)
156
+ this.attributes = { ...newObject.attributes }
157
+ return true
158
+ }
159
+
160
+ const newObject = await ChildSiteManagementPolicy.create(this.attributes, this.options)
161
+ this.attributes = { ...newObject.attributes }
162
+ return true
163
+ }
164
+
165
+ // Parameters:
166
+ // 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.
167
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
168
+ static list = async (params = {}, options = {}) => {
169
+ if (params.cursor && !isString(params.cursor)) {
170
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
171
+ }
172
+
173
+ if (params.per_page && !isInt(params.per_page)) {
174
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
175
+ }
176
+
177
+ const response = await Api.sendRequest('/child_site_management_policies', 'GET', params, options)
178
+
179
+ return response?.data?.map(obj => new ChildSiteManagementPolicy(obj, options)) || []
180
+ }
181
+
182
+ static all = (params = {}, options = {}) =>
183
+ ChildSiteManagementPolicy.list(params, options)
184
+
185
+ // Parameters:
186
+ // id (required) - int64 - Child Site Management Policy ID.
187
+ static find = async (id, params = {}, options = {}) => {
188
+ if (!isObject(params)) {
189
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
190
+ }
191
+
192
+ params.id = id
193
+
194
+ if (!params.id) {
195
+ throw new errors.MissingParameterError('Parameter missing: id')
196
+ }
197
+
198
+ if (params.id && !isInt(params.id)) {
199
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
200
+ }
201
+
202
+ const response = await Api.sendRequest(`/child_site_management_policies/${encodeURIComponent(params.id)}`, 'GET', params, options)
203
+
204
+ return new ChildSiteManagementPolicy(response?.data, options)
205
+ }
206
+
207
+ static get = (id, params = {}, options = {}) =>
208
+ ChildSiteManagementPolicy.find(id, params, options)
209
+
210
+ // Parameters:
211
+ // site_setting_name (required) - string - The name of the setting that is managed by the policy
212
+ // managed_value (required) - string - The value for the setting that will be enforced for all child sites that are not exempt
213
+ // skip_child_site_ids - array(int64) - The list of child site IDs that are exempt from this policy
214
+ static create = async (params = {}, options = {}) => {
215
+ if (!params.site_setting_name) {
216
+ throw new errors.MissingParameterError('Parameter missing: site_setting_name')
217
+ }
218
+
219
+ if (!params.managed_value) {
220
+ throw new errors.MissingParameterError('Parameter missing: managed_value')
221
+ }
222
+
223
+ if (params.site_setting_name && !isString(params.site_setting_name)) {
224
+ throw new errors.InvalidParameterError(`Bad parameter: site_setting_name must be of type String, received ${getType(params.site_setting_name)}`)
225
+ }
226
+
227
+ if (params.managed_value && !isString(params.managed_value)) {
228
+ throw new errors.InvalidParameterError(`Bad parameter: managed_value must be of type String, received ${getType(params.managed_value)}`)
229
+ }
230
+
231
+ if (params.skip_child_site_ids && !isArray(params.skip_child_site_ids)) {
232
+ throw new errors.InvalidParameterError(`Bad parameter: skip_child_site_ids must be of type Array, received ${getType(params.skip_child_site_ids)}`)
233
+ }
234
+
235
+ const response = await Api.sendRequest('/child_site_management_policies', 'POST', params, options)
236
+
237
+ return new ChildSiteManagementPolicy(response?.data, options)
238
+ }
239
+ }
240
+
241
+ export default ChildSiteManagementPolicy
242
+
243
+ module.exports = ChildSiteManagementPolicy
244
+ module.exports.default = ChildSiteManagementPolicy
@@ -89,7 +89,7 @@ class RemoteServerConfigurationFile {
89
89
  // * 2000 requests/day: '2000-D'
90
90
  getTransferRateLimit = () => this.attributes.transfer_rate_limit
91
91
 
92
- // string # Auto update policy ['manual_trigger', 'critical_only', 'always'] (default critical_only)
92
+ // string # Auto update policy ['manual_trigger', 'critical_only', 'always', 'never'] (default critical_only)
93
93
  getAutoUpdatePolicy = () => this.attributes.auto_update_policy
94
94
 
95
95
  // string # Files Agent API Token
@@ -541,6 +541,9 @@ class Site {
541
541
  // boolean # Allow group admins set password authentication method
542
542
  getGroupAdminsCanSetUserPassword = () => this.attributes.group_admins_can_set_user_password
543
543
 
544
+ // array(string) # List of site settings managed by the parent site
545
+ getManagedSiteSettings = () => this.attributes.managed_site_settings
546
+
544
547
  static get = async (options = {}) => {
545
548
  const response = await Api.sendRequest('/site', 'GET', {}, options)
546
549