files.com 1.2.140 → 1.2.142
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/docs/models/Permission.md +3 -1
- package/docs/models/Site.md +4 -0
- package/docs/models/UserSftpClientUse.md +36 -0
- package/lib/Files.js +1 -1
- package/lib/models/Permission.js +11 -4
- package/lib/models/Site.js +5 -0
- package/lib/models/UserSftpClientUse.js +123 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/Permission.js +6 -1
- package/src/models/Site.js +4 -0
- package/src/models/UserSftpClientUse.js +75 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.142
|
@@ -62,6 +62,7 @@ await Permission.create({
|
|
62
62
|
'recursive': true,
|
63
63
|
'user_id': 1,
|
64
64
|
'username': "user",
|
65
|
+
'group_name': "example",
|
65
66
|
})
|
66
67
|
```
|
67
68
|
|
@@ -69,11 +70,12 @@ await Permission.create({
|
|
69
70
|
### Parameters
|
70
71
|
|
71
72
|
* `path` (string): Required - Folder path
|
72
|
-
* `group_id` (int64): Group ID
|
73
|
+
* `group_id` (int64): Group ID. Provide `group_name` or `group_id`
|
73
74
|
* `permission` (string): Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
|
74
75
|
* `recursive` (boolean): Apply to subfolders recursively?
|
75
76
|
* `user_id` (int64): User ID. Provide `username` or `user_id`
|
76
77
|
* `username` (string): User username. Provide `username` or `user_id`
|
78
|
+
* `group_name` (string): Group name. Provide `group_name` or `group_id`
|
77
79
|
|
78
80
|
---
|
79
81
|
|
package/docs/models/Site.md
CHANGED
@@ -181,6 +181,7 @@
|
|
181
181
|
"sftp_insecure_diffie_hellman": true,
|
182
182
|
"sftp_user_root_enabled": true,
|
183
183
|
"sharing_enabled": true,
|
184
|
+
"show_user_notifications_log_in_link": true,
|
184
185
|
"show_request_access_link": true,
|
185
186
|
"site_footer": "example",
|
186
187
|
"site_header": "example",
|
@@ -414,6 +415,7 @@
|
|
414
415
|
* `sftp_insecure_diffie_hellman` (boolean): If true, we will allow weak Diffie Hellman parameters to be used within ciphers for SFTP that are otherwise on our secure list. This has the effect of making the cipher weaker than our normal threshold for security, but is required to support certain legacy or broken SSH and MFT clients. Enabling this weakens security, but not nearly as much as enabling the full `sftp_insecure_ciphers` option.
|
415
416
|
* `sftp_user_root_enabled` (boolean): Use user FTP roots also for SFTP?
|
416
417
|
* `sharing_enabled` (boolean): Allow bundle creation
|
418
|
+
* `show_user_notifications_log_in_link` (boolean): Show log in link in user notifications?
|
417
419
|
* `show_request_access_link` (boolean): Show request access link for users without access? Currently unused.
|
418
420
|
* `site_footer` (string): Custom site footer text
|
419
421
|
* `site_header` (string): Custom site header text
|
@@ -562,6 +564,7 @@ await Site.update({
|
|
562
564
|
'sftp_enabled': true,
|
563
565
|
'users_can_create_api_keys': true,
|
564
566
|
'users_can_create_ssh_keys': true,
|
567
|
+
'show_user_notifications_log_in_link': true,
|
565
568
|
'sftp_host_key_type': "default",
|
566
569
|
'active_sftp_host_key_id': 1,
|
567
570
|
'protocol_access_groups_only': true,
|
@@ -714,6 +717,7 @@ await Site.update({
|
|
714
717
|
* `sftp_enabled` (boolean): Is SFTP enabled?
|
715
718
|
* `users_can_create_api_keys` (boolean): Allow users to create their own API keys?
|
716
719
|
* `users_can_create_ssh_keys` (boolean): Allow users to create their own SSH keys?
|
720
|
+
* `show_user_notifications_log_in_link` (boolean): Show log in link in user notifications?
|
717
721
|
* `sftp_host_key_type` (string): Sftp Host Key Type
|
718
722
|
* `active_sftp_host_key_id` (int64): Id of the currently selected custom SFTP Host Key
|
719
723
|
* `protocol_access_groups_only` (boolean): If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# UserSftpClientUse
|
2
|
+
|
3
|
+
## Example UserSftpClientUse Object
|
4
|
+
|
5
|
+
```
|
6
|
+
{
|
7
|
+
"id": 1,
|
8
|
+
"sftp_client": "example",
|
9
|
+
"created_at": "2000-01-01T01:00:00Z",
|
10
|
+
"updated_at": "2000-01-01T01:00:00Z",
|
11
|
+
"user_id": 1
|
12
|
+
}
|
13
|
+
```
|
14
|
+
|
15
|
+
* `id` (int64): UserSftpClientUse ID
|
16
|
+
* `sftp_client` (string): The SFTP client used
|
17
|
+
* `created_at` (date-time): The earliest recorded use of this SFTP client (for this user)
|
18
|
+
* `updated_at` (date-time): The most recent use of this SFTP client (for this user)
|
19
|
+
* `user_id` (int64): ID of the user who performed this access
|
20
|
+
|
21
|
+
---
|
22
|
+
|
23
|
+
## List User SFTP Client Uses
|
24
|
+
|
25
|
+
```
|
26
|
+
await UserSftpClientUse.list({
|
27
|
+
'user_id': 1,
|
28
|
+
})
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
### Parameters
|
33
|
+
|
34
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
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).
|
package/lib/Files.js
CHANGED
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
|
|
11
11
|
var apiKey;
|
12
12
|
var baseUrl = 'https://app.files.com';
|
13
13
|
var sessionId = null;
|
14
|
-
var version = '1.2.
|
14
|
+
var version = '1.2.142';
|
15
15
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
16
16
|
var logLevel = _Logger.LogLevel.INFO;
|
17
17
|
var debugRequest = false;
|
package/lib/models/Permission.js
CHANGED
@@ -249,11 +249,12 @@ _Permission = Permission;
|
|
249
249
|
});
|
250
250
|
// Parameters:
|
251
251
|
// path (required) - string - Folder path
|
252
|
-
// group_id - int64 - Group ID
|
252
|
+
// group_id - int64 - Group ID. Provide `group_name` or `group_id`
|
253
253
|
// permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
|
254
254
|
// recursive - boolean - Apply to subfolders recursively?
|
255
255
|
// user_id - int64 - User ID. Provide `username` or `user_id`
|
256
256
|
// username - string - User username. Provide `username` or `user_id`
|
257
|
+
// group_name - string - Group name. Provide `group_name` or `group_id`
|
257
258
|
(0, _defineProperty2.default)(Permission, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
258
259
|
var params,
|
259
260
|
options,
|
@@ -300,12 +301,18 @@ _Permission = Permission;
|
|
300
301
|
}
|
301
302
|
throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(params.username)));
|
302
303
|
case 14:
|
303
|
-
|
304
|
-
|
304
|
+
if (!(params.group_name && !(0, _utils.isString)(params.group_name))) {
|
305
|
+
_context4.next = 16;
|
306
|
+
break;
|
307
|
+
}
|
308
|
+
throw new errors.InvalidParameterError("Bad parameter: group_name must be of type String, received ".concat((0, _utils.getType)(params.group_name)));
|
305
309
|
case 16:
|
310
|
+
_context4.next = 18;
|
311
|
+
return _Api.default.sendRequest('/permissions', 'POST', params, options);
|
312
|
+
case 18:
|
306
313
|
response = _context4.sent;
|
307
314
|
return _context4.abrupt("return", new _Permission(response === null || response === void 0 ? void 0 : response.data, options));
|
308
|
-
case
|
315
|
+
case 20:
|
309
316
|
case "end":
|
310
317
|
return _context4.stop();
|
311
318
|
}
|
package/lib/models/Site.js
CHANGED
@@ -541,6 +541,10 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
|
|
541
541
|
(0, _defineProperty2.default)(this, "getSharingEnabled", function () {
|
542
542
|
return _this.attributes.sharing_enabled;
|
543
543
|
});
|
544
|
+
// boolean # Show log in link in user notifications?
|
545
|
+
(0, _defineProperty2.default)(this, "getShowUserNotificationsLogInLink", function () {
|
546
|
+
return _this.attributes.show_user_notifications_log_in_link;
|
547
|
+
});
|
544
548
|
// boolean # Show request access link for users without access? Currently unused.
|
545
549
|
(0, _defineProperty2.default)(this, "getShowRequestAccessLink", function () {
|
546
550
|
return _this.attributes.show_request_access_link;
|
@@ -825,6 +829,7 @@ _Site = Site;
|
|
825
829
|
// sftp_enabled - boolean - Is SFTP enabled?
|
826
830
|
// users_can_create_api_keys - boolean - Allow users to create their own API keys?
|
827
831
|
// users_can_create_ssh_keys - boolean - Allow users to create their own SSH keys?
|
832
|
+
// show_user_notifications_log_in_link - boolean - Show log in link in user notifications?
|
828
833
|
// sftp_host_key_type - string - Sftp Host Key Type
|
829
834
|
// active_sftp_host_key_id - int64 - Id of the currently selected custom SFTP Host Key
|
830
835
|
// protocol_access_groups_only - boolean - If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
@@ -0,0 +1,123 @@
|
|
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 _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
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 _UserSftpClientUse;
|
17
|
+
/* eslint-disable no-unused-vars */
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
20
|
+
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; }
|
21
|
+
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; }
|
22
|
+
/* eslint-enable no-unused-vars */
|
23
|
+
/**
|
24
|
+
* Class UserSftpClientUse
|
25
|
+
*/
|
26
|
+
var UserSftpClientUse = /*#__PURE__*/(0, _createClass2.default)(function UserSftpClientUse() {
|
27
|
+
var _this = this;
|
28
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
29
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
30
|
+
(0, _classCallCheck2.default)(this, UserSftpClientUse);
|
31
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
32
|
+
(0, _defineProperty2.default)(this, "options", {});
|
33
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
34
|
+
return !!_this.attributes.id;
|
35
|
+
});
|
36
|
+
// int64 # UserSftpClientUse ID
|
37
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
38
|
+
return _this.attributes.id;
|
39
|
+
});
|
40
|
+
// string # The SFTP client used
|
41
|
+
(0, _defineProperty2.default)(this, "getSftpClient", function () {
|
42
|
+
return _this.attributes.sftp_client;
|
43
|
+
});
|
44
|
+
// date-time # The earliest recorded use of this SFTP client (for this user)
|
45
|
+
(0, _defineProperty2.default)(this, "getCreatedAt", function () {
|
46
|
+
return _this.attributes.created_at;
|
47
|
+
});
|
48
|
+
// date-time # The most recent use of this SFTP client (for this user)
|
49
|
+
(0, _defineProperty2.default)(this, "getUpdatedAt", function () {
|
50
|
+
return _this.attributes.updated_at;
|
51
|
+
});
|
52
|
+
// int64 # ID of the user who performed this access
|
53
|
+
(0, _defineProperty2.default)(this, "getUserId", function () {
|
54
|
+
return _this.attributes.user_id;
|
55
|
+
});
|
56
|
+
Object.entries(attributes).forEach(function (_ref) {
|
57
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
58
|
+
key = _ref2[0],
|
59
|
+
value = _ref2[1];
|
60
|
+
var normalizedKey = key.replace('?', '');
|
61
|
+
_this.attributes[normalizedKey] = value;
|
62
|
+
Object.defineProperty(_this, normalizedKey, {
|
63
|
+
value: value,
|
64
|
+
writable: false
|
65
|
+
});
|
66
|
+
});
|
67
|
+
this.options = _objectSpread({}, options);
|
68
|
+
});
|
69
|
+
_UserSftpClientUse = UserSftpClientUse;
|
70
|
+
// Parameters:
|
71
|
+
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
72
|
+
// 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.
|
73
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
74
|
+
(0, _defineProperty2.default)(UserSftpClientUse, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
75
|
+
var _response$data;
|
76
|
+
var params,
|
77
|
+
options,
|
78
|
+
response,
|
79
|
+
_args = arguments;
|
80
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
81
|
+
while (1) switch (_context.prev = _context.next) {
|
82
|
+
case 0:
|
83
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
84
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
85
|
+
if (!(params.user_id && !(0, _utils.isInt)(params.user_id))) {
|
86
|
+
_context.next = 4;
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params.user_id)));
|
90
|
+
case 4:
|
91
|
+
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
92
|
+
_context.next = 6;
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
96
|
+
case 6:
|
97
|
+
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
98
|
+
_context.next = 8;
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
102
|
+
case 8:
|
103
|
+
_context.next = 10;
|
104
|
+
return _Api.default.sendRequest('/user_sftp_client_uses', 'GET', params, options);
|
105
|
+
case 10:
|
106
|
+
response = _context.sent;
|
107
|
+
return _context.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
108
|
+
return new _UserSftpClientUse(obj, options);
|
109
|
+
})) || []);
|
110
|
+
case 12:
|
111
|
+
case "end":
|
112
|
+
return _context.stop();
|
113
|
+
}
|
114
|
+
}, _callee);
|
115
|
+
})));
|
116
|
+
(0, _defineProperty2.default)(UserSftpClientUse, "all", function () {
|
117
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
118
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
119
|
+
return _UserSftpClientUse.list(params, options);
|
120
|
+
});
|
121
|
+
var _default = exports.default = UserSftpClientUse;
|
122
|
+
module.exports = UserSftpClientUse;
|
123
|
+
module.exports.default = UserSftpClientUse;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
package/src/models/Permission.js
CHANGED
@@ -163,11 +163,12 @@ class Permission {
|
|
163
163
|
|
164
164
|
// Parameters:
|
165
165
|
// path (required) - string - Folder path
|
166
|
-
// group_id - int64 - Group ID
|
166
|
+
// group_id - int64 - Group ID. Provide `group_name` or `group_id`
|
167
167
|
// permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
|
168
168
|
// recursive - boolean - Apply to subfolders recursively?
|
169
169
|
// user_id - int64 - User ID. Provide `username` or `user_id`
|
170
170
|
// username - string - User username. Provide `username` or `user_id`
|
171
|
+
// group_name - string - Group name. Provide `group_name` or `group_id`
|
171
172
|
static create = async (params = {}, options = {}) => {
|
172
173
|
if (!params.path) {
|
173
174
|
throw new errors.MissingParameterError('Parameter missing: path')
|
@@ -193,6 +194,10 @@ class Permission {
|
|
193
194
|
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(params.username)}`)
|
194
195
|
}
|
195
196
|
|
197
|
+
if (params.group_name && !isString(params.group_name)) {
|
198
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_name must be of type String, received ${getType(params.group_name)}`)
|
199
|
+
}
|
200
|
+
|
196
201
|
const response = await Api.sendRequest('/permissions', 'POST', params, options)
|
197
202
|
|
198
203
|
return new Permission(response?.data, options)
|
package/src/models/Site.js
CHANGED
@@ -409,6 +409,9 @@ class Site {
|
|
409
409
|
// boolean # Allow bundle creation
|
410
410
|
getSharingEnabled = () => this.attributes.sharing_enabled
|
411
411
|
|
412
|
+
// boolean # Show log in link in user notifications?
|
413
|
+
getShowUserNotificationsLogInLink = () => this.attributes.show_user_notifications_log_in_link
|
414
|
+
|
412
415
|
// boolean # Show request access link for users without access? Currently unused.
|
413
416
|
getShowRequestAccessLink = () => this.attributes.show_request_access_link
|
414
417
|
|
@@ -617,6 +620,7 @@ class Site {
|
|
617
620
|
// sftp_enabled - boolean - Is SFTP enabled?
|
618
621
|
// users_can_create_api_keys - boolean - Allow users to create their own API keys?
|
619
622
|
// users_can_create_ssh_keys - boolean - Allow users to create their own SSH keys?
|
623
|
+
// show_user_notifications_log_in_link - boolean - Show log in link in user notifications?
|
620
624
|
// sftp_host_key_type - string - Sftp Host Key Type
|
621
625
|
// active_sftp_host_key_id - int64 - Id of the currently selected custom SFTP Host Key
|
622
626
|
// protocol_access_groups_only - boolean - If true, protocol access permissions on users will be ignored, and only protocol access permissions set on Groups will be honored. Make sure that your current user is a member of a group with API permission when changing this value to avoid locking yourself out of your site.
|
@@ -0,0 +1,75 @@
|
|
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 UserSftpClientUse
|
11
|
+
*/
|
12
|
+
class UserSftpClientUse {
|
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 # UserSftpClientUse ID
|
32
|
+
getId = () => this.attributes.id
|
33
|
+
|
34
|
+
// string # The SFTP client used
|
35
|
+
getSftpClient = () => this.attributes.sftp_client
|
36
|
+
|
37
|
+
// date-time # The earliest recorded use of this SFTP client (for this user)
|
38
|
+
getCreatedAt = () => this.attributes.created_at
|
39
|
+
|
40
|
+
// date-time # The most recent use of this SFTP client (for this user)
|
41
|
+
getUpdatedAt = () => this.attributes.updated_at
|
42
|
+
|
43
|
+
// int64 # ID of the user who performed this access
|
44
|
+
getUserId = () => this.attributes.user_id
|
45
|
+
|
46
|
+
// Parameters:
|
47
|
+
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
48
|
+
// 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.
|
49
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
50
|
+
static list = async (params = {}, options = {}) => {
|
51
|
+
if (params.user_id && !isInt(params.user_id)) {
|
52
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
53
|
+
}
|
54
|
+
|
55
|
+
if (params.cursor && !isString(params.cursor)) {
|
56
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
57
|
+
}
|
58
|
+
|
59
|
+
if (params.per_page && !isInt(params.per_page)) {
|
60
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
61
|
+
}
|
62
|
+
|
63
|
+
const response = await Api.sendRequest('/user_sftp_client_uses', 'GET', params, options)
|
64
|
+
|
65
|
+
return response?.data?.map(obj => new UserSftpClientUse(obj, options)) || []
|
66
|
+
}
|
67
|
+
|
68
|
+
static all = (params = {}, options = {}) =>
|
69
|
+
UserSftpClientUse.list(params, options)
|
70
|
+
}
|
71
|
+
|
72
|
+
export default UserSftpClientUse
|
73
|
+
|
74
|
+
module.exports = UserSftpClientUse
|
75
|
+
module.exports.default = UserSftpClientUse
|