files.com 1.2.139 → 1.2.141
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/Permission.md +3 -1
- package/docs/models/RemoteServer.md +3 -0
- package/docs/models/UserSftpClientUse.md +36 -0
- package/lib/Files.js +1 -1
- package/lib/models/Permission.js +11 -4
- package/lib/models/RemoteServer.js +3 -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/RemoteServer.js +3 -0
- package/src/models/UserSftpClientUse.js +75 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.141
|
@@ -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
|
|
@@ -152,6 +152,9 @@ await RemoteServer.list
|
|
152
152
|
|
153
153
|
* `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.
|
154
154
|
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
155
|
+
* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`, `server_type`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`.
|
156
|
+
* `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `name`, `server_type`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`. Valid field combinations are `[ name, server_type ]`, `[ name, backblaze_b2_bucket ]`, `[ name, google_cloud_storage_bucket ]`, `[ name, wasabi_bucket ]`, `[ name, s3_bucket ]`, `[ name, rackspace_container ]`, `[ name, azure_blob_storage_container ]`, `[ name, azure_files_storage_share_name ]`, `[ name, s3_compatible_bucket ]`, `[ name, filebase_bucket ]`, `[ name, cloudflare_bucket ]` or `[ name, linode_bucket ]`.
|
157
|
+
* `filter_prefix` (object): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`. Valid field combinations are `[ name, backblaze_b2_bucket ]`, `[ name, google_cloud_storage_bucket ]`, `[ name, wasabi_bucket ]`, `[ name, s3_bucket ]`, `[ name, rackspace_container ]`, `[ name, azure_blob_storage_container ]`, `[ name, azure_files_storage_share_name ]`, `[ name, s3_compatible_bucket ]`, `[ name, filebase_bucket ]`, `[ name, cloudflare_bucket ]` or `[ name, linode_bucket ]`.
|
155
158
|
|
156
159
|
---
|
157
160
|
|
@@ -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.141';
|
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
|
}
|
@@ -1267,6 +1267,9 @@ _RemoteServer = RemoteServer;
|
|
1267
1267
|
// Parameters:
|
1268
1268
|
// 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.
|
1269
1269
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
1270
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`, `server_type`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`.
|
1271
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `name`, `server_type`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`. Valid field combinations are `[ name, server_type ]`, `[ name, backblaze_b2_bucket ]`, `[ name, google_cloud_storage_bucket ]`, `[ name, wasabi_bucket ]`, `[ name, s3_bucket ]`, `[ name, rackspace_container ]`, `[ name, azure_blob_storage_container ]`, `[ name, azure_files_storage_share_name ]`, `[ name, s3_compatible_bucket ]`, `[ name, filebase_bucket ]`, `[ name, cloudflare_bucket ]` or `[ name, linode_bucket ]`.
|
1272
|
+
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`. Valid field combinations are `[ name, backblaze_b2_bucket ]`, `[ name, google_cloud_storage_bucket ]`, `[ name, wasabi_bucket ]`, `[ name, s3_bucket ]`, `[ name, rackspace_container ]`, `[ name, azure_blob_storage_container ]`, `[ name, azure_files_storage_share_name ]`, `[ name, s3_compatible_bucket ]`, `[ name, filebase_bucket ]`, `[ name, cloudflare_bucket ]` or `[ name, linode_bucket ]`.
|
1270
1273
|
(0, _defineProperty2.default)(RemoteServer, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
1271
1274
|
var _response$data;
|
1272
1275
|
var params,
|
@@ -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)
|
@@ -1015,6 +1015,9 @@ class RemoteServer {
|
|
1015
1015
|
// Parameters:
|
1016
1016
|
// 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.
|
1017
1017
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
1018
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`, `server_type`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`.
|
1019
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `name`, `server_type`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`. Valid field combinations are `[ name, server_type ]`, `[ name, backblaze_b2_bucket ]`, `[ name, google_cloud_storage_bucket ]`, `[ name, wasabi_bucket ]`, `[ name, s3_bucket ]`, `[ name, rackspace_container ]`, `[ name, azure_blob_storage_container ]`, `[ name, azure_files_storage_share_name ]`, `[ name, s3_compatible_bucket ]`, `[ name, filebase_bucket ]`, `[ name, cloudflare_bucket ]` or `[ name, linode_bucket ]`.
|
1020
|
+
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`, `backblaze_b2_bucket`, `google_cloud_storage_bucket`, `wasabi_bucket`, `s3_bucket`, `rackspace_container`, `azure_blob_storage_container`, `azure_files_storage_share_name`, `s3_compatible_bucket`, `filebase_bucket`, `cloudflare_bucket` or `linode_bucket`. Valid field combinations are `[ name, backblaze_b2_bucket ]`, `[ name, google_cloud_storage_bucket ]`, `[ name, wasabi_bucket ]`, `[ name, s3_bucket ]`, `[ name, rackspace_container ]`, `[ name, azure_blob_storage_container ]`, `[ name, azure_files_storage_share_name ]`, `[ name, s3_compatible_bucket ]`, `[ name, filebase_bucket ]`, `[ name, cloudflare_bucket ]` or `[ name, linode_bucket ]`.
|
1018
1021
|
static list = async (params = {}, options = {}) => {
|
1019
1022
|
if (params.cursor && !isString(params.cursor)) {
|
1020
1023
|
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
@@ -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
|