files.com 1.2.244 → 1.2.246
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/UserLifecycleRule.md +125 -0
- package/lib/Files.js +1 -1
- package/lib/models/UserLifecycleRule.js +457 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/UserLifecycleRule.js +274 -0
package/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.246
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# UserLifecycleRule
|
|
2
|
+
|
|
3
|
+
## Example UserLifecycleRule Object
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
{
|
|
7
|
+
"id": 1,
|
|
8
|
+
"authentication_method": "password",
|
|
9
|
+
"inactivity_days": 12,
|
|
10
|
+
"include_folder_admins": true,
|
|
11
|
+
"include_site_admins": true,
|
|
12
|
+
"action": "disable",
|
|
13
|
+
"site_id": 1
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
* `id` (int64): User Lifecycle Rule ID
|
|
18
|
+
* `authentication_method` (string): User authentication method for the rule
|
|
19
|
+
* `inactivity_days` (int64): Number of days of inactivity before the rule applies
|
|
20
|
+
* `include_folder_admins` (boolean): Include folder admins in the rule
|
|
21
|
+
* `include_site_admins` (boolean): Include site admins in the rule
|
|
22
|
+
* `action` (string): Action to take on inactive users (disable or delete)
|
|
23
|
+
* `site_id` (int64): Site ID
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## List User Lifecycle Rules
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
await UserLifecycleRule.list
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Parameters
|
|
35
|
+
|
|
36
|
+
* `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.
|
|
37
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Show User Lifecycle Rule
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
await UserLifecycleRule.find(id)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Parameters
|
|
49
|
+
|
|
50
|
+
* `id` (int64): Required - User Lifecycle Rule ID.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Create User Lifecycle Rule
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
await UserLifecycleRule.create({
|
|
58
|
+
'authentication_method': "password",
|
|
59
|
+
'inactivity_days': 12,
|
|
60
|
+
'include_site_admins': true,
|
|
61
|
+
'include_folder_admins': true,
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Parameters
|
|
67
|
+
|
|
68
|
+
* `action` (string): Required - Action to take on inactive users (disable or delete)
|
|
69
|
+
* `authentication_method` (string): Required - User authentication method for the rule
|
|
70
|
+
* `inactivity_days` (int64): Required - Number of days of inactivity before the rule applies
|
|
71
|
+
* `include_site_admins` (boolean): Include site admins in the rule
|
|
72
|
+
* `include_folder_admins` (boolean): Include folder admins in the rule
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Update User Lifecycle Rule
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
const user_lifecycle_rule = await UserLifecycleRule.find(id)
|
|
80
|
+
|
|
81
|
+
await user_lifecycle_rule.update({
|
|
82
|
+
'authentication_method': "password",
|
|
83
|
+
'inactivity_days': 12,
|
|
84
|
+
'include_site_admins': true,
|
|
85
|
+
'include_folder_admins': true,
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Parameters
|
|
90
|
+
|
|
91
|
+
* `id` (int64): Required - User Lifecycle Rule ID.
|
|
92
|
+
* `action` (string): Required - Action to take on inactive users (disable or delete)
|
|
93
|
+
* `authentication_method` (string): Required - User authentication method for the rule
|
|
94
|
+
* `inactivity_days` (int64): Required - Number of days of inactivity before the rule applies
|
|
95
|
+
* `include_site_admins` (boolean): Include site admins in the rule
|
|
96
|
+
* `include_folder_admins` (boolean): Include folder admins in the rule
|
|
97
|
+
|
|
98
|
+
### Example Response
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"id": 1,
|
|
103
|
+
"authentication_method": "password",
|
|
104
|
+
"inactivity_days": 12,
|
|
105
|
+
"include_folder_admins": true,
|
|
106
|
+
"include_site_admins": true,
|
|
107
|
+
"action": "disable",
|
|
108
|
+
"site_id": 1
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Delete User Lifecycle Rule
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
const user_lifecycle_rule = await UserLifecycleRule.find(id)
|
|
118
|
+
|
|
119
|
+
await user_lifecycle_rule.delete()
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Parameters
|
|
123
|
+
|
|
124
|
+
* `id` (int64): Required - User Lifecycle Rule ID.
|
|
125
|
+
|
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.
|
|
15
|
+
var version = '1.2.246';
|
|
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,457 @@
|
|
|
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 _UserLifecycleRule;
|
|
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 UserLifecycleRule
|
|
24
|
+
*/
|
|
25
|
+
var UserLifecycleRule = /*#__PURE__*/(0, _createClass2.default)(function UserLifecycleRule() {
|
|
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, UserLifecycleRule);
|
|
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 # User Lifecycle Rule 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
|
+
// string # User authentication method for the rule
|
|
43
|
+
(0, _defineProperty2.default)(this, "getAuthenticationMethod", function () {
|
|
44
|
+
return _this.attributes.authentication_method;
|
|
45
|
+
});
|
|
46
|
+
(0, _defineProperty2.default)(this, "setAuthenticationMethod", function (value) {
|
|
47
|
+
_this.attributes.authentication_method = value;
|
|
48
|
+
});
|
|
49
|
+
// int64 # Number of days of inactivity before the rule applies
|
|
50
|
+
(0, _defineProperty2.default)(this, "getInactivityDays", function () {
|
|
51
|
+
return _this.attributes.inactivity_days;
|
|
52
|
+
});
|
|
53
|
+
(0, _defineProperty2.default)(this, "setInactivityDays", function (value) {
|
|
54
|
+
_this.attributes.inactivity_days = value;
|
|
55
|
+
});
|
|
56
|
+
// boolean # Include folder admins in the rule
|
|
57
|
+
(0, _defineProperty2.default)(this, "getIncludeFolderAdmins", function () {
|
|
58
|
+
return _this.attributes.include_folder_admins;
|
|
59
|
+
});
|
|
60
|
+
(0, _defineProperty2.default)(this, "setIncludeFolderAdmins", function (value) {
|
|
61
|
+
_this.attributes.include_folder_admins = value;
|
|
62
|
+
});
|
|
63
|
+
// boolean # Include site admins in the rule
|
|
64
|
+
(0, _defineProperty2.default)(this, "getIncludeSiteAdmins", function () {
|
|
65
|
+
return _this.attributes.include_site_admins;
|
|
66
|
+
});
|
|
67
|
+
(0, _defineProperty2.default)(this, "setIncludeSiteAdmins", function (value) {
|
|
68
|
+
_this.attributes.include_site_admins = value;
|
|
69
|
+
});
|
|
70
|
+
// string # Action to take on inactive users (disable or delete)
|
|
71
|
+
(0, _defineProperty2.default)(this, "getAction", function () {
|
|
72
|
+
return _this.attributes.action;
|
|
73
|
+
});
|
|
74
|
+
(0, _defineProperty2.default)(this, "setAction", function (value) {
|
|
75
|
+
_this.attributes.action = value;
|
|
76
|
+
});
|
|
77
|
+
// int64 # Site ID
|
|
78
|
+
(0, _defineProperty2.default)(this, "getSiteId", function () {
|
|
79
|
+
return _this.attributes.site_id;
|
|
80
|
+
});
|
|
81
|
+
(0, _defineProperty2.default)(this, "setSiteId", function (value) {
|
|
82
|
+
_this.attributes.site_id = value;
|
|
83
|
+
});
|
|
84
|
+
// Parameters:
|
|
85
|
+
// action (required) - string - Action to take on inactive users (disable or delete)
|
|
86
|
+
// authentication_method (required) - string - User authentication method for the rule
|
|
87
|
+
// inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
|
|
88
|
+
// include_site_admins - boolean - Include site admins in the rule
|
|
89
|
+
// include_folder_admins - boolean - Include folder admins in the rule
|
|
90
|
+
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
91
|
+
var params,
|
|
92
|
+
response,
|
|
93
|
+
_args = arguments;
|
|
94
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
95
|
+
while (1) switch (_context.prev = _context.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
98
|
+
if (_this.attributes.id) {
|
|
99
|
+
_context.next = 3;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
|
103
|
+
case 3:
|
|
104
|
+
if ((0, _utils.isObject)(params)) {
|
|
105
|
+
_context.next = 5;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
109
|
+
case 5:
|
|
110
|
+
params.id = _this.attributes.id;
|
|
111
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
112
|
+
_context.next = 8;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
116
|
+
case 8:
|
|
117
|
+
if (!(params.action && !(0, _utils.isString)(params.action))) {
|
|
118
|
+
_context.next = 10;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
|
|
122
|
+
case 10:
|
|
123
|
+
if (!(params.authentication_method && !(0, _utils.isString)(params.authentication_method))) {
|
|
124
|
+
_context.next = 12;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params.authentication_method)));
|
|
128
|
+
case 12:
|
|
129
|
+
if (!(params.inactivity_days && !(0, _utils.isInt)(params.inactivity_days))) {
|
|
130
|
+
_context.next = 14;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
throw new errors.InvalidParameterError("Bad parameter: inactivity_days must be of type Int, received ".concat((0, _utils.getType)(params.inactivity_days)));
|
|
134
|
+
case 14:
|
|
135
|
+
if (params.id) {
|
|
136
|
+
_context.next = 20;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
if (!_this.attributes.id) {
|
|
140
|
+
_context.next = 19;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
params.id = _this.id;
|
|
144
|
+
_context.next = 20;
|
|
145
|
+
break;
|
|
146
|
+
case 19:
|
|
147
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
148
|
+
case 20:
|
|
149
|
+
if (params.action) {
|
|
150
|
+
_context.next = 26;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
if (!_this.attributes.action) {
|
|
154
|
+
_context.next = 25;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
params.action = _this.action;
|
|
158
|
+
_context.next = 26;
|
|
159
|
+
break;
|
|
160
|
+
case 25:
|
|
161
|
+
throw new errors.MissingParameterError('Parameter missing: action');
|
|
162
|
+
case 26:
|
|
163
|
+
if (params.authentication_method) {
|
|
164
|
+
_context.next = 32;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if (!_this.attributes.authentication_method) {
|
|
168
|
+
_context.next = 31;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
params.authentication_method = _this.authentication_method;
|
|
172
|
+
_context.next = 32;
|
|
173
|
+
break;
|
|
174
|
+
case 31:
|
|
175
|
+
throw new errors.MissingParameterError('Parameter missing: authentication_method');
|
|
176
|
+
case 32:
|
|
177
|
+
if (params.inactivity_days) {
|
|
178
|
+
_context.next = 38;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
if (!_this.attributes.inactivity_days) {
|
|
182
|
+
_context.next = 37;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
params.inactivity_days = _this.inactivity_days;
|
|
186
|
+
_context.next = 38;
|
|
187
|
+
break;
|
|
188
|
+
case 37:
|
|
189
|
+
throw new errors.MissingParameterError('Parameter missing: inactivity_days');
|
|
190
|
+
case 38:
|
|
191
|
+
_context.next = 40;
|
|
192
|
+
return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
|
|
193
|
+
case 40:
|
|
194
|
+
response = _context.sent;
|
|
195
|
+
return _context.abrupt("return", new UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
196
|
+
case 42:
|
|
197
|
+
case "end":
|
|
198
|
+
return _context.stop();
|
|
199
|
+
}
|
|
200
|
+
}, _callee);
|
|
201
|
+
})));
|
|
202
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
203
|
+
var params,
|
|
204
|
+
_args2 = arguments;
|
|
205
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
206
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
207
|
+
case 0:
|
|
208
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
209
|
+
if (_this.attributes.id) {
|
|
210
|
+
_context2.next = 3;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
|
214
|
+
case 3:
|
|
215
|
+
if ((0, _utils.isObject)(params)) {
|
|
216
|
+
_context2.next = 5;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
220
|
+
case 5:
|
|
221
|
+
params.id = _this.attributes.id;
|
|
222
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
223
|
+
_context2.next = 8;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
227
|
+
case 8:
|
|
228
|
+
if (params.id) {
|
|
229
|
+
_context2.next = 14;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
if (!_this.attributes.id) {
|
|
233
|
+
_context2.next = 13;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
params.id = _this.id;
|
|
237
|
+
_context2.next = 14;
|
|
238
|
+
break;
|
|
239
|
+
case 13:
|
|
240
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
241
|
+
case 14:
|
|
242
|
+
_context2.next = 16;
|
|
243
|
+
return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
|
|
244
|
+
case 16:
|
|
245
|
+
case "end":
|
|
246
|
+
return _context2.stop();
|
|
247
|
+
}
|
|
248
|
+
}, _callee2);
|
|
249
|
+
})));
|
|
250
|
+
(0, _defineProperty2.default)(this, "destroy", function () {
|
|
251
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
252
|
+
return _this.delete(params);
|
|
253
|
+
});
|
|
254
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
255
|
+
var _newObject, newObject;
|
|
256
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
257
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
258
|
+
case 0:
|
|
259
|
+
if (!_this.attributes.id) {
|
|
260
|
+
_context3.next = 6;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
_context3.next = 3;
|
|
264
|
+
return _this.update(_this.attributes);
|
|
265
|
+
case 3:
|
|
266
|
+
_newObject = _context3.sent;
|
|
267
|
+
_this.attributes = _objectSpread({}, _newObject.attributes);
|
|
268
|
+
return _context3.abrupt("return", true);
|
|
269
|
+
case 6:
|
|
270
|
+
_context3.next = 8;
|
|
271
|
+
return UserLifecycleRule.create(_this.attributes, _this.options);
|
|
272
|
+
case 8:
|
|
273
|
+
newObject = _context3.sent;
|
|
274
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
|
275
|
+
return _context3.abrupt("return", true);
|
|
276
|
+
case 11:
|
|
277
|
+
case "end":
|
|
278
|
+
return _context3.stop();
|
|
279
|
+
}
|
|
280
|
+
}, _callee3);
|
|
281
|
+
})));
|
|
282
|
+
Object.entries(attributes).forEach(function (_ref4) {
|
|
283
|
+
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
284
|
+
key = _ref5[0],
|
|
285
|
+
value = _ref5[1];
|
|
286
|
+
var normalizedKey = key.replace('?', '');
|
|
287
|
+
_this.attributes[normalizedKey] = value;
|
|
288
|
+
Object.defineProperty(_this, normalizedKey, {
|
|
289
|
+
value: value,
|
|
290
|
+
writable: false
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
this.options = _objectSpread({}, options);
|
|
294
|
+
});
|
|
295
|
+
_UserLifecycleRule = UserLifecycleRule;
|
|
296
|
+
// Parameters:
|
|
297
|
+
// 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.
|
|
298
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
299
|
+
(0, _defineProperty2.default)(UserLifecycleRule, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
300
|
+
var _response$data;
|
|
301
|
+
var params,
|
|
302
|
+
options,
|
|
303
|
+
response,
|
|
304
|
+
_args4 = arguments;
|
|
305
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
306
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
307
|
+
case 0:
|
|
308
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
309
|
+
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
310
|
+
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
|
311
|
+
_context4.next = 4;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
|
315
|
+
case 4:
|
|
316
|
+
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
|
317
|
+
_context4.next = 6;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
|
321
|
+
case 6:
|
|
322
|
+
_context4.next = 8;
|
|
323
|
+
return _Api.default.sendRequest('/user_lifecycle_rules', 'GET', params, options);
|
|
324
|
+
case 8:
|
|
325
|
+
response = _context4.sent;
|
|
326
|
+
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) {
|
|
327
|
+
return new _UserLifecycleRule(obj, options);
|
|
328
|
+
})) || []);
|
|
329
|
+
case 10:
|
|
330
|
+
case "end":
|
|
331
|
+
return _context4.stop();
|
|
332
|
+
}
|
|
333
|
+
}, _callee4);
|
|
334
|
+
})));
|
|
335
|
+
(0, _defineProperty2.default)(UserLifecycleRule, "all", function () {
|
|
336
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
337
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
338
|
+
return _UserLifecycleRule.list(params, options);
|
|
339
|
+
});
|
|
340
|
+
// Parameters:
|
|
341
|
+
// id (required) - int64 - User Lifecycle Rule ID.
|
|
342
|
+
(0, _defineProperty2.default)(UserLifecycleRule, "find", /*#__PURE__*/function () {
|
|
343
|
+
var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
|
|
344
|
+
var params,
|
|
345
|
+
options,
|
|
346
|
+
response,
|
|
347
|
+
_args5 = arguments;
|
|
348
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
349
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
350
|
+
case 0:
|
|
351
|
+
params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
352
|
+
options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
|
|
353
|
+
if ((0, _utils.isObject)(params)) {
|
|
354
|
+
_context5.next = 4;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
358
|
+
case 4:
|
|
359
|
+
params.id = id;
|
|
360
|
+
if (params.id) {
|
|
361
|
+
_context5.next = 7;
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
365
|
+
case 7:
|
|
366
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
367
|
+
_context5.next = 9;
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
371
|
+
case 9:
|
|
372
|
+
_context5.next = 11;
|
|
373
|
+
return _Api.default.sendRequest("/user_lifecycle_rules/".concat(encodeURIComponent(params.id)), 'GET', params, options);
|
|
374
|
+
case 11:
|
|
375
|
+
response = _context5.sent;
|
|
376
|
+
return _context5.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
|
|
377
|
+
case 13:
|
|
378
|
+
case "end":
|
|
379
|
+
return _context5.stop();
|
|
380
|
+
}
|
|
381
|
+
}, _callee5);
|
|
382
|
+
}));
|
|
383
|
+
return function (_x) {
|
|
384
|
+
return _ref7.apply(this, arguments);
|
|
385
|
+
};
|
|
386
|
+
}());
|
|
387
|
+
(0, _defineProperty2.default)(UserLifecycleRule, "get", function (id) {
|
|
388
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
389
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
390
|
+
return _UserLifecycleRule.find(id, params, options);
|
|
391
|
+
});
|
|
392
|
+
// Parameters:
|
|
393
|
+
// action (required) - string - Action to take on inactive users (disable or delete)
|
|
394
|
+
// authentication_method (required) - string - User authentication method for the rule
|
|
395
|
+
// inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
|
|
396
|
+
// include_site_admins - boolean - Include site admins in the rule
|
|
397
|
+
// include_folder_admins - boolean - Include folder admins in the rule
|
|
398
|
+
(0, _defineProperty2.default)(UserLifecycleRule, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
399
|
+
var params,
|
|
400
|
+
options,
|
|
401
|
+
response,
|
|
402
|
+
_args6 = arguments;
|
|
403
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
404
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
405
|
+
case 0:
|
|
406
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
407
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
408
|
+
if (params.action) {
|
|
409
|
+
_context6.next = 4;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
throw new errors.MissingParameterError('Parameter missing: action');
|
|
413
|
+
case 4:
|
|
414
|
+
if (params.authentication_method) {
|
|
415
|
+
_context6.next = 6;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
throw new errors.MissingParameterError('Parameter missing: authentication_method');
|
|
419
|
+
case 6:
|
|
420
|
+
if (params.inactivity_days) {
|
|
421
|
+
_context6.next = 8;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
throw new errors.MissingParameterError('Parameter missing: inactivity_days');
|
|
425
|
+
case 8:
|
|
426
|
+
if (!(params.action && !(0, _utils.isString)(params.action))) {
|
|
427
|
+
_context6.next = 10;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
|
|
431
|
+
case 10:
|
|
432
|
+
if (!(params.authentication_method && !(0, _utils.isString)(params.authentication_method))) {
|
|
433
|
+
_context6.next = 12;
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
throw new errors.InvalidParameterError("Bad parameter: authentication_method must be of type String, received ".concat((0, _utils.getType)(params.authentication_method)));
|
|
437
|
+
case 12:
|
|
438
|
+
if (!(params.inactivity_days && !(0, _utils.isInt)(params.inactivity_days))) {
|
|
439
|
+
_context6.next = 14;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
throw new errors.InvalidParameterError("Bad parameter: inactivity_days must be of type Int, received ".concat((0, _utils.getType)(params.inactivity_days)));
|
|
443
|
+
case 14:
|
|
444
|
+
_context6.next = 16;
|
|
445
|
+
return _Api.default.sendRequest('/user_lifecycle_rules', 'POST', params, options);
|
|
446
|
+
case 16:
|
|
447
|
+
response = _context6.sent;
|
|
448
|
+
return _context6.abrupt("return", new _UserLifecycleRule(response === null || response === void 0 ? void 0 : response.data, options));
|
|
449
|
+
case 18:
|
|
450
|
+
case "end":
|
|
451
|
+
return _context6.stop();
|
|
452
|
+
}
|
|
453
|
+
}, _callee6);
|
|
454
|
+
})));
|
|
455
|
+
var _default = exports.default = UserLifecycleRule;
|
|
456
|
+
module.exports = UserLifecycleRule;
|
|
457
|
+
module.exports.default = UserLifecycleRule;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
|
@@ -0,0 +1,274 @@
|
|
|
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 UserLifecycleRule
|
|
11
|
+
*/
|
|
12
|
+
class UserLifecycleRule {
|
|
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 # User Lifecycle Rule ID
|
|
32
|
+
getId = () => this.attributes.id
|
|
33
|
+
|
|
34
|
+
setId = value => {
|
|
35
|
+
this.attributes.id = value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// string # User authentication method for the rule
|
|
39
|
+
getAuthenticationMethod = () => this.attributes.authentication_method
|
|
40
|
+
|
|
41
|
+
setAuthenticationMethod = value => {
|
|
42
|
+
this.attributes.authentication_method = value
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// int64 # Number of days of inactivity before the rule applies
|
|
46
|
+
getInactivityDays = () => this.attributes.inactivity_days
|
|
47
|
+
|
|
48
|
+
setInactivityDays = value => {
|
|
49
|
+
this.attributes.inactivity_days = value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// boolean # Include folder admins in the rule
|
|
53
|
+
getIncludeFolderAdmins = () => this.attributes.include_folder_admins
|
|
54
|
+
|
|
55
|
+
setIncludeFolderAdmins = value => {
|
|
56
|
+
this.attributes.include_folder_admins = value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// boolean # Include site admins in the rule
|
|
60
|
+
getIncludeSiteAdmins = () => this.attributes.include_site_admins
|
|
61
|
+
|
|
62
|
+
setIncludeSiteAdmins = value => {
|
|
63
|
+
this.attributes.include_site_admins = value
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// string # Action to take on inactive users (disable or delete)
|
|
67
|
+
getAction = () => this.attributes.action
|
|
68
|
+
|
|
69
|
+
setAction = value => {
|
|
70
|
+
this.attributes.action = value
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// int64 # Site ID
|
|
74
|
+
getSiteId = () => this.attributes.site_id
|
|
75
|
+
|
|
76
|
+
setSiteId = value => {
|
|
77
|
+
this.attributes.site_id = value
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Parameters:
|
|
81
|
+
// action (required) - string - Action to take on inactive users (disable or delete)
|
|
82
|
+
// authentication_method (required) - string - User authentication method for the rule
|
|
83
|
+
// inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
|
|
84
|
+
// include_site_admins - boolean - Include site admins in the rule
|
|
85
|
+
// include_folder_admins - boolean - Include folder admins in the rule
|
|
86
|
+
update = async (params = {}) => {
|
|
87
|
+
if (!this.attributes.id) {
|
|
88
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (!isObject(params)) {
|
|
92
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
params.id = this.attributes.id
|
|
96
|
+
if (params.id && !isInt(params.id)) {
|
|
97
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (params.action && !isString(params.action)) {
|
|
101
|
+
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(params.action)}`)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (params.authentication_method && !isString(params.authentication_method)) {
|
|
105
|
+
throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(params.authentication_method)}`)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (params.inactivity_days && !isInt(params.inactivity_days)) {
|
|
109
|
+
throw new errors.InvalidParameterError(`Bad parameter: inactivity_days must be of type Int, received ${getType(params.inactivity_days)}`)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!params.id) {
|
|
113
|
+
if (this.attributes.id) {
|
|
114
|
+
params.id = this.id
|
|
115
|
+
} else {
|
|
116
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!params.action) {
|
|
121
|
+
if (this.attributes.action) {
|
|
122
|
+
params.action = this.action
|
|
123
|
+
} else {
|
|
124
|
+
throw new errors.MissingParameterError('Parameter missing: action')
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!params.authentication_method) {
|
|
129
|
+
if (this.attributes.authentication_method) {
|
|
130
|
+
params.authentication_method = this.authentication_method
|
|
131
|
+
} else {
|
|
132
|
+
throw new errors.MissingParameterError('Parameter missing: authentication_method')
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!params.inactivity_days) {
|
|
137
|
+
if (this.attributes.inactivity_days) {
|
|
138
|
+
params.inactivity_days = this.inactivity_days
|
|
139
|
+
} else {
|
|
140
|
+
throw new errors.MissingParameterError('Parameter missing: inactivity_days')
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const response = await Api.sendRequest(`/user_lifecycle_rules/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
145
|
+
|
|
146
|
+
return new UserLifecycleRule(response?.data, this.options)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
delete = async (params = {}) => {
|
|
150
|
+
if (!this.attributes.id) {
|
|
151
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!isObject(params)) {
|
|
155
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
params.id = this.attributes.id
|
|
159
|
+
if (params.id && !isInt(params.id)) {
|
|
160
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (!params.id) {
|
|
164
|
+
if (this.attributes.id) {
|
|
165
|
+
params.id = this.id
|
|
166
|
+
} else {
|
|
167
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
await Api.sendRequest(`/user_lifecycle_rules/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
destroy = (params = {}) =>
|
|
175
|
+
this.delete(params)
|
|
176
|
+
|
|
177
|
+
save = async () => {
|
|
178
|
+
if (this.attributes.id) {
|
|
179
|
+
const newObject = await this.update(this.attributes)
|
|
180
|
+
this.attributes = { ...newObject.attributes }
|
|
181
|
+
return true
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const newObject = await UserLifecycleRule.create(this.attributes, this.options)
|
|
185
|
+
this.attributes = { ...newObject.attributes }
|
|
186
|
+
return true
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Parameters:
|
|
190
|
+
// 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.
|
|
191
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
192
|
+
static list = async (params = {}, options = {}) => {
|
|
193
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
194
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
198
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const response = await Api.sendRequest('/user_lifecycle_rules', 'GET', params, options)
|
|
202
|
+
|
|
203
|
+
return response?.data?.map(obj => new UserLifecycleRule(obj, options)) || []
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
static all = (params = {}, options = {}) =>
|
|
207
|
+
UserLifecycleRule.list(params, options)
|
|
208
|
+
|
|
209
|
+
// Parameters:
|
|
210
|
+
// id (required) - int64 - User Lifecycle Rule ID.
|
|
211
|
+
static find = async (id, params = {}, options = {}) => {
|
|
212
|
+
if (!isObject(params)) {
|
|
213
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
params.id = id
|
|
217
|
+
|
|
218
|
+
if (!params.id) {
|
|
219
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (params.id && !isInt(params.id)) {
|
|
223
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const response = await Api.sendRequest(`/user_lifecycle_rules/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
227
|
+
|
|
228
|
+
return new UserLifecycleRule(response?.data, options)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static get = (id, params = {}, options = {}) =>
|
|
232
|
+
UserLifecycleRule.find(id, params, options)
|
|
233
|
+
|
|
234
|
+
// Parameters:
|
|
235
|
+
// action (required) - string - Action to take on inactive users (disable or delete)
|
|
236
|
+
// authentication_method (required) - string - User authentication method for the rule
|
|
237
|
+
// inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
|
|
238
|
+
// include_site_admins - boolean - Include site admins in the rule
|
|
239
|
+
// include_folder_admins - boolean - Include folder admins in the rule
|
|
240
|
+
static create = async (params = {}, options = {}) => {
|
|
241
|
+
if (!params.action) {
|
|
242
|
+
throw new errors.MissingParameterError('Parameter missing: action')
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (!params.authentication_method) {
|
|
246
|
+
throw new errors.MissingParameterError('Parameter missing: authentication_method')
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (!params.inactivity_days) {
|
|
250
|
+
throw new errors.MissingParameterError('Parameter missing: inactivity_days')
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (params.action && !isString(params.action)) {
|
|
254
|
+
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(params.action)}`)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (params.authentication_method && !isString(params.authentication_method)) {
|
|
258
|
+
throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(params.authentication_method)}`)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (params.inactivity_days && !isInt(params.inactivity_days)) {
|
|
262
|
+
throw new errors.InvalidParameterError(`Bad parameter: inactivity_days must be of type Int, received ${getType(params.inactivity_days)}`)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const response = await Api.sendRequest('/user_lifecycle_rules', 'POST', params, options)
|
|
266
|
+
|
|
267
|
+
return new UserLifecycleRule(response?.data, options)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export default UserLifecycleRule
|
|
272
|
+
|
|
273
|
+
module.exports = UserLifecycleRule
|
|
274
|
+
module.exports.default = UserLifecycleRule
|