files.com 1.0.215 → 1.0.217
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/docs/models/ApiKey.md +5 -0
- package/docs/models/SftpHostKey.md +109 -0
- package/lib/models/ApiKey.js +43 -21
- package/lib/models/SftpHostKey.js +418 -0
- package/package.json +1 -1
- package/src/models/ApiKey.js +16 -0
- package/src/models/SftpHostKey.js +201 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.217
|
package/docs/models/ApiKey.md
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
{
|
7
7
|
"id": 1,
|
8
8
|
"descriptive_label": "Site-wide API key for https://site.files.com/ (key ID #1)",
|
9
|
+
"description": "",
|
9
10
|
"created_at": "2000-01-01T01:00:00Z",
|
10
11
|
"expires_at": "2000-01-01T01:00:00Z",
|
11
12
|
"key": "[key]",
|
@@ -20,6 +21,7 @@
|
|
20
21
|
|
21
22
|
* `id` (int64): API Key ID
|
22
23
|
* `descriptive_label` (string): Unique label that describes this API key. Useful for external systems where you may have API keys from multiple accounts and want a human-readable label for each key.
|
24
|
+
* `description` (string): User-supplied description of API key.
|
23
25
|
* `created_at` (date-time): Time which API Key was created
|
24
26
|
* `expires_at` (date-time): API Key expiration date
|
25
27
|
* `key` (string): API Key actual key string
|
@@ -96,6 +98,7 @@ await ApiKey.create({
|
|
96
98
|
|
97
99
|
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
98
100
|
* `name` (string): Internal name for the API Key. For your use.
|
101
|
+
* `description` (string): User-supplied description of API key.
|
99
102
|
* `expires_at` (string): API Key expiration date
|
100
103
|
* `permission_set` (string): Permissions for this API Key. Keys with the `desktop_app` permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Additional permission sets may become available in the future, such as for a Site Admin to give a key with no administrator privileges. If you have ideas for permission sets, please let us know.
|
101
104
|
* `path` (string): Folder path restriction for this api key.
|
@@ -146,6 +149,7 @@ await api_key.update({
|
|
146
149
|
|
147
150
|
* `id` (int64): Required - Api Key ID.
|
148
151
|
* `name` (string): Internal name for the API Key. For your use.
|
152
|
+
* `description` (string): User-supplied description of API key.
|
149
153
|
* `expires_at` (string): API Key expiration date
|
150
154
|
* `permission_set` (string): Permissions for this API Key. Keys with the `desktop_app` permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Additional permission sets may become available in the future, such as for a Site Admin to give a key with no administrator privileges. If you have ideas for permission sets, please let us know.
|
151
155
|
|
@@ -155,6 +159,7 @@ await api_key.update({
|
|
155
159
|
{
|
156
160
|
"id": 1,
|
157
161
|
"descriptive_label": "Site-wide API key for https://site.files.com/ (key ID #1)",
|
162
|
+
"description": "",
|
158
163
|
"created_at": "2000-01-01T01:00:00Z",
|
159
164
|
"expires_at": "2000-01-01T01:00:00Z",
|
160
165
|
"key": "[key]",
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# SftpHostKey
|
2
|
+
|
3
|
+
## Example SftpHostKey Object
|
4
|
+
|
5
|
+
```
|
6
|
+
{
|
7
|
+
"id": 1,
|
8
|
+
"name": "",
|
9
|
+
"fingerprint_md5": "",
|
10
|
+
"fingerprint_sha256": ""
|
11
|
+
}
|
12
|
+
```
|
13
|
+
|
14
|
+
* `id` (int64): Sftp Host Key ID
|
15
|
+
* `name` (string): The friendly name of this SFTP Host Key.
|
16
|
+
* `fingerprint_md5` (string): MD5 Fingerpint of the public key
|
17
|
+
* `fingerprint_sha256` (string): SHA256 Fingerpint of the public key
|
18
|
+
* `private_key` (string): The private key data.
|
19
|
+
|
20
|
+
---
|
21
|
+
|
22
|
+
## List Sftp Host Keys
|
23
|
+
|
24
|
+
```
|
25
|
+
await SftpHostKey.list({
|
26
|
+
'per_page': 1,
|
27
|
+
})
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
### Parameters
|
32
|
+
|
33
|
+
* `cursor` (string): Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
34
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
35
|
+
|
36
|
+
---
|
37
|
+
|
38
|
+
## Show Sftp Host Key
|
39
|
+
|
40
|
+
```
|
41
|
+
await SftpHostKey.find(id)
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
### Parameters
|
46
|
+
|
47
|
+
* `id` (int64): Required - Sftp Host Key ID.
|
48
|
+
|
49
|
+
---
|
50
|
+
|
51
|
+
## Create Sftp Host Key
|
52
|
+
|
53
|
+
```
|
54
|
+
await SftpHostKey.create({
|
55
|
+
'name': "",
|
56
|
+
'private_key': "",
|
57
|
+
})
|
58
|
+
```
|
59
|
+
|
60
|
+
|
61
|
+
### Parameters
|
62
|
+
|
63
|
+
* `name` (string): The friendly name of this SFTP Host Key.
|
64
|
+
* `private_key` (string): The private key data.
|
65
|
+
|
66
|
+
---
|
67
|
+
|
68
|
+
## Update Sftp Host Key
|
69
|
+
|
70
|
+
```
|
71
|
+
const [sftp_host_key] = await SftpHostKey.list()
|
72
|
+
|
73
|
+
await sftp_host_key.update({
|
74
|
+
'name': "",
|
75
|
+
'private_key': "",
|
76
|
+
})
|
77
|
+
```
|
78
|
+
|
79
|
+
### Parameters
|
80
|
+
|
81
|
+
* `id` (int64): Required - Sftp Host Key ID.
|
82
|
+
* `name` (string): The friendly name of this SFTP Host Key.
|
83
|
+
* `private_key` (string): The private key data.
|
84
|
+
|
85
|
+
### Example Response
|
86
|
+
|
87
|
+
```json
|
88
|
+
{
|
89
|
+
"id": 1,
|
90
|
+
"name": "",
|
91
|
+
"fingerprint_md5": "",
|
92
|
+
"fingerprint_sha256": ""
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
---
|
97
|
+
|
98
|
+
## Delete Sftp Host Key
|
99
|
+
|
100
|
+
```
|
101
|
+
const [sftp_host_key] = await SftpHostKey.list()
|
102
|
+
|
103
|
+
await sftp_host_key.delete()
|
104
|
+
```
|
105
|
+
|
106
|
+
### Parameters
|
107
|
+
|
108
|
+
* `id` (int64): Required - Sftp Host Key ID.
|
109
|
+
|
package/lib/models/ApiKey.js
CHANGED
@@ -61,6 +61,12 @@ var ApiKey = /*#__PURE__*/(0, _createClass2.default)(function ApiKey() {
|
|
61
61
|
(0, _defineProperty2.default)(this, "setDescriptiveLabel", function (value) {
|
62
62
|
_this.attributes.descriptive_label = value;
|
63
63
|
});
|
64
|
+
(0, _defineProperty2.default)(this, "getDescription", function () {
|
65
|
+
return _this.attributes.description;
|
66
|
+
});
|
67
|
+
(0, _defineProperty2.default)(this, "setDescription", function (value) {
|
68
|
+
_this.attributes.description = value;
|
69
|
+
});
|
64
70
|
(0, _defineProperty2.default)(this, "getCreatedAt", function () {
|
65
71
|
return _this.attributes.created_at;
|
66
72
|
});
|
@@ -156,48 +162,56 @@ var ApiKey = /*#__PURE__*/(0, _createClass2.default)(function ApiKey() {
|
|
156
162
|
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
157
163
|
|
158
164
|
case 10:
|
159
|
-
if (!(params['
|
165
|
+
if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
|
160
166
|
_context.next = 12;
|
161
167
|
break;
|
162
168
|
}
|
163
169
|
|
164
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
170
|
+
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(description)));
|
165
171
|
|
166
172
|
case 12:
|
167
|
-
if (!(params['
|
173
|
+
if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
|
168
174
|
_context.next = 14;
|
169
175
|
break;
|
170
176
|
}
|
171
177
|
|
172
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
178
|
+
throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(expires_at)));
|
173
179
|
|
174
180
|
case 14:
|
181
|
+
if (!(params['permission_set'] && !(0, _utils.isString)(params['permission_set']))) {
|
182
|
+
_context.next = 16;
|
183
|
+
break;
|
184
|
+
}
|
185
|
+
|
186
|
+
throw new errors.InvalidParameterError("Bad parameter: permission_set must be of type String, received ".concat((0, _utils.getType)(permission_set)));
|
187
|
+
|
188
|
+
case 16:
|
175
189
|
if (params['id']) {
|
176
|
-
_context.next =
|
190
|
+
_context.next = 22;
|
177
191
|
break;
|
178
192
|
}
|
179
193
|
|
180
194
|
if (!_this.attributes.id) {
|
181
|
-
_context.next =
|
195
|
+
_context.next = 21;
|
182
196
|
break;
|
183
197
|
}
|
184
198
|
|
185
199
|
params['id'] = _this.id;
|
186
|
-
_context.next =
|
200
|
+
_context.next = 22;
|
187
201
|
break;
|
188
202
|
|
189
|
-
case
|
203
|
+
case 21:
|
190
204
|
throw new errors.MissingParameterError('Parameter missing: id');
|
191
205
|
|
192
|
-
case
|
193
|
-
_context.next =
|
206
|
+
case 22:
|
207
|
+
_context.next = 24;
|
194
208
|
return _Api.default.sendRequest("/api_keys/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
|
195
209
|
|
196
|
-
case
|
210
|
+
case 24:
|
197
211
|
response = _context.sent;
|
198
212
|
return _context.abrupt("return", new ApiKey(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
199
213
|
|
200
|
-
case
|
214
|
+
case 26:
|
201
215
|
case "end":
|
202
216
|
return _context.stop();
|
203
217
|
}
|
@@ -472,38 +486,46 @@ var ApiKey = /*#__PURE__*/(0, _createClass2.default)(function ApiKey() {
|
|
472
486
|
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
|
473
487
|
|
474
488
|
case 6:
|
475
|
-
if (!(params['
|
489
|
+
if (!(params['description'] && !(0, _utils.isString)(params['description']))) {
|
476
490
|
_context6.next = 8;
|
477
491
|
break;
|
478
492
|
}
|
479
493
|
|
480
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
494
|
+
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params['description'])));
|
481
495
|
|
482
496
|
case 8:
|
483
|
-
if (!(params['
|
497
|
+
if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
|
484
498
|
_context6.next = 10;
|
485
499
|
break;
|
486
500
|
}
|
487
501
|
|
488
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
502
|
+
throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(params['expires_at'])));
|
489
503
|
|
490
504
|
case 10:
|
491
|
-
if (!(params['
|
505
|
+
if (!(params['permission_set'] && !(0, _utils.isString)(params['permission_set']))) {
|
492
506
|
_context6.next = 12;
|
493
507
|
break;
|
494
508
|
}
|
495
509
|
|
496
|
-
throw new errors.InvalidParameterError("Bad parameter:
|
510
|
+
throw new errors.InvalidParameterError("Bad parameter: permission_set must be of type String, received ".concat((0, _utils.getType)(params['permission_set'])));
|
497
511
|
|
498
512
|
case 12:
|
499
|
-
|
500
|
-
|
513
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
514
|
+
_context6.next = 14;
|
515
|
+
break;
|
516
|
+
}
|
517
|
+
|
518
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
501
519
|
|
502
520
|
case 14:
|
521
|
+
_context6.next = 16;
|
522
|
+
return _Api.default.sendRequest("/api_keys", 'POST', params, options);
|
523
|
+
|
524
|
+
case 16:
|
503
525
|
response = _context6.sent;
|
504
526
|
return _context6.abrupt("return", new ApiKey(response === null || response === void 0 ? void 0 : response.data, options));
|
505
527
|
|
506
|
-
case
|
528
|
+
case 18:
|
507
529
|
case "end":
|
508
530
|
return _context6.stop();
|
509
531
|
}
|
@@ -0,0 +1,418 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
+
|
7
|
+
exports.__esModule = true;
|
8
|
+
exports.default = void 0;
|
9
|
+
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
11
|
+
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
|
+
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
15
|
+
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
17
|
+
|
18
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
19
|
+
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
21
|
+
|
22
|
+
var _Api = _interopRequireDefault(require("../Api"));
|
23
|
+
|
24
|
+
var errors = _interopRequireWildcard(require("../Errors"));
|
25
|
+
|
26
|
+
var _Logger = _interopRequireDefault(require("../Logger"));
|
27
|
+
|
28
|
+
var _utils = require("../utils");
|
29
|
+
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
31
|
+
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
33
|
+
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
35
|
+
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Class SftpHostKey
|
40
|
+
*/
|
41
|
+
var SftpHostKey = /*#__PURE__*/(0, _createClass2.default)(function SftpHostKey() {
|
42
|
+
var _this = this;
|
43
|
+
|
44
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
45
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
46
|
+
(0, _classCallCheck2.default)(this, SftpHostKey);
|
47
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
48
|
+
(0, _defineProperty2.default)(this, "options", {});
|
49
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
50
|
+
return !!_this.attributes.id;
|
51
|
+
});
|
52
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
53
|
+
return _this.attributes.id;
|
54
|
+
});
|
55
|
+
(0, _defineProperty2.default)(this, "setId", function (value) {
|
56
|
+
_this.attributes.id = value;
|
57
|
+
});
|
58
|
+
(0, _defineProperty2.default)(this, "getName", function () {
|
59
|
+
return _this.attributes.name;
|
60
|
+
});
|
61
|
+
(0, _defineProperty2.default)(this, "setName", function (value) {
|
62
|
+
_this.attributes.name = value;
|
63
|
+
});
|
64
|
+
(0, _defineProperty2.default)(this, "getFingerprintMd5", function () {
|
65
|
+
return _this.attributes.fingerprint_md5;
|
66
|
+
});
|
67
|
+
(0, _defineProperty2.default)(this, "setFingerprintMd5", function (value) {
|
68
|
+
_this.attributes.fingerprint_md5 = value;
|
69
|
+
});
|
70
|
+
(0, _defineProperty2.default)(this, "getFingerprintSha256", function () {
|
71
|
+
return _this.attributes.fingerprint_sha256;
|
72
|
+
});
|
73
|
+
(0, _defineProperty2.default)(this, "setFingerprintSha256", function (value) {
|
74
|
+
_this.attributes.fingerprint_sha256 = value;
|
75
|
+
});
|
76
|
+
(0, _defineProperty2.default)(this, "getPrivateKey", function () {
|
77
|
+
return _this.attributes.private_key;
|
78
|
+
});
|
79
|
+
(0, _defineProperty2.default)(this, "setPrivateKey", function (value) {
|
80
|
+
_this.attributes.private_key = value;
|
81
|
+
});
|
82
|
+
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
83
|
+
var params,
|
84
|
+
response,
|
85
|
+
_args = arguments;
|
86
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
87
|
+
while (1) {
|
88
|
+
switch (_context.prev = _context.next) {
|
89
|
+
case 0:
|
90
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
91
|
+
|
92
|
+
if (_this.attributes.id) {
|
93
|
+
_context.next = 3;
|
94
|
+
break;
|
95
|
+
}
|
96
|
+
|
97
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
98
|
+
|
99
|
+
case 3:
|
100
|
+
if ((0, _utils.isObject)(params)) {
|
101
|
+
_context.next = 5;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
|
105
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
106
|
+
|
107
|
+
case 5:
|
108
|
+
params.id = _this.attributes.id;
|
109
|
+
|
110
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
111
|
+
_context.next = 8;
|
112
|
+
break;
|
113
|
+
}
|
114
|
+
|
115
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
116
|
+
|
117
|
+
case 8:
|
118
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
119
|
+
_context.next = 10;
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
|
123
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
|
124
|
+
|
125
|
+
case 10:
|
126
|
+
if (!(params['private_key'] && !(0, _utils.isString)(params['private_key']))) {
|
127
|
+
_context.next = 12;
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
|
131
|
+
throw new errors.InvalidParameterError("Bad parameter: private_key must be of type String, received ".concat((0, _utils.getType)(private_key)));
|
132
|
+
|
133
|
+
case 12:
|
134
|
+
if (params['id']) {
|
135
|
+
_context.next = 18;
|
136
|
+
break;
|
137
|
+
}
|
138
|
+
|
139
|
+
if (!_this.attributes.id) {
|
140
|
+
_context.next = 17;
|
141
|
+
break;
|
142
|
+
}
|
143
|
+
|
144
|
+
params['id'] = _this.id;
|
145
|
+
_context.next = 18;
|
146
|
+
break;
|
147
|
+
|
148
|
+
case 17:
|
149
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
150
|
+
|
151
|
+
case 18:
|
152
|
+
_context.next = 20;
|
153
|
+
return _Api.default.sendRequest("/sftp_host_keys/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
|
154
|
+
|
155
|
+
case 20:
|
156
|
+
response = _context.sent;
|
157
|
+
return _context.abrupt("return", new SftpHostKey(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
158
|
+
|
159
|
+
case 22:
|
160
|
+
case "end":
|
161
|
+
return _context.stop();
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}, _callee);
|
165
|
+
})));
|
166
|
+
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
167
|
+
var params,
|
168
|
+
response,
|
169
|
+
_args2 = arguments;
|
170
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
171
|
+
while (1) {
|
172
|
+
switch (_context2.prev = _context2.next) {
|
173
|
+
case 0:
|
174
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
175
|
+
|
176
|
+
if (_this.attributes.id) {
|
177
|
+
_context2.next = 3;
|
178
|
+
break;
|
179
|
+
}
|
180
|
+
|
181
|
+
throw new errors.EmptyPropertyError('Current object has no id');
|
182
|
+
|
183
|
+
case 3:
|
184
|
+
if ((0, _utils.isObject)(params)) {
|
185
|
+
_context2.next = 5;
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
|
189
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
190
|
+
|
191
|
+
case 5:
|
192
|
+
params.id = _this.attributes.id;
|
193
|
+
|
194
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
195
|
+
_context2.next = 8;
|
196
|
+
break;
|
197
|
+
}
|
198
|
+
|
199
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
200
|
+
|
201
|
+
case 8:
|
202
|
+
if (params['id']) {
|
203
|
+
_context2.next = 14;
|
204
|
+
break;
|
205
|
+
}
|
206
|
+
|
207
|
+
if (!_this.attributes.id) {
|
208
|
+
_context2.next = 13;
|
209
|
+
break;
|
210
|
+
}
|
211
|
+
|
212
|
+
params['id'] = _this.id;
|
213
|
+
_context2.next = 14;
|
214
|
+
break;
|
215
|
+
|
216
|
+
case 13:
|
217
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
218
|
+
|
219
|
+
case 14:
|
220
|
+
_context2.next = 16;
|
221
|
+
return _Api.default.sendRequest("/sftp_host_keys/".concat(encodeURIComponent(params['id'])), 'DELETE', params, _this.options);
|
222
|
+
|
223
|
+
case 16:
|
224
|
+
response = _context2.sent;
|
225
|
+
return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
226
|
+
|
227
|
+
case 18:
|
228
|
+
case "end":
|
229
|
+
return _context2.stop();
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}, _callee2);
|
233
|
+
})));
|
234
|
+
(0, _defineProperty2.default)(this, "destroy", function () {
|
235
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
236
|
+
return _this.delete(params);
|
237
|
+
});
|
238
|
+
(0, _defineProperty2.default)(this, "save", function () {
|
239
|
+
if (_this.attributes['id']) {
|
240
|
+
return _this.update(_this.attributes);
|
241
|
+
} else {
|
242
|
+
var newObject = SftpHostKey.create(_this.attributes, _this.options);
|
243
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
244
|
+
return true;
|
245
|
+
}
|
246
|
+
});
|
247
|
+
Object.entries(attributes).forEach(function (_ref3) {
|
248
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
249
|
+
key = _ref4[0],
|
250
|
+
value = _ref4[1];
|
251
|
+
|
252
|
+
var normalizedKey = key.replace('?', '');
|
253
|
+
_this.attributes[normalizedKey] = value;
|
254
|
+
Object.defineProperty(_this, normalizedKey, {
|
255
|
+
value: value,
|
256
|
+
writable: false
|
257
|
+
});
|
258
|
+
});
|
259
|
+
this.options = _objectSpread({}, options);
|
260
|
+
});
|
261
|
+
(0, _defineProperty2.default)(SftpHostKey, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
262
|
+
var _response$data;
|
263
|
+
|
264
|
+
var params,
|
265
|
+
options,
|
266
|
+
response,
|
267
|
+
_args3 = arguments;
|
268
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
269
|
+
while (1) {
|
270
|
+
switch (_context3.prev = _context3.next) {
|
271
|
+
case 0:
|
272
|
+
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
273
|
+
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
274
|
+
|
275
|
+
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
276
|
+
_context3.next = 4;
|
277
|
+
break;
|
278
|
+
}
|
279
|
+
|
280
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params['cursor'])));
|
281
|
+
|
282
|
+
case 4:
|
283
|
+
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
284
|
+
_context3.next = 6;
|
285
|
+
break;
|
286
|
+
}
|
287
|
+
|
288
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params['per_page'])));
|
289
|
+
|
290
|
+
case 6:
|
291
|
+
_context3.next = 8;
|
292
|
+
return _Api.default.sendRequest("/sftp_host_keys", 'GET', params, options);
|
293
|
+
|
294
|
+
case 8:
|
295
|
+
response = _context3.sent;
|
296
|
+
return _context3.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
297
|
+
return new SftpHostKey(obj, options);
|
298
|
+
})) || []);
|
299
|
+
|
300
|
+
case 10:
|
301
|
+
case "end":
|
302
|
+
return _context3.stop();
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}, _callee3);
|
306
|
+
})));
|
307
|
+
(0, _defineProperty2.default)(SftpHostKey, "all", function () {
|
308
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
309
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
310
|
+
return SftpHostKey.list(params, options);
|
311
|
+
});
|
312
|
+
(0, _defineProperty2.default)(SftpHostKey, "find", /*#__PURE__*/function () {
|
313
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id) {
|
314
|
+
var params,
|
315
|
+
options,
|
316
|
+
response,
|
317
|
+
_args4 = arguments;
|
318
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
319
|
+
while (1) {
|
320
|
+
switch (_context4.prev = _context4.next) {
|
321
|
+
case 0:
|
322
|
+
params = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
323
|
+
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
|
324
|
+
|
325
|
+
if ((0, _utils.isObject)(params)) {
|
326
|
+
_context4.next = 4;
|
327
|
+
break;
|
328
|
+
}
|
329
|
+
|
330
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
331
|
+
|
332
|
+
case 4:
|
333
|
+
params['id'] = id;
|
334
|
+
|
335
|
+
if (params['id']) {
|
336
|
+
_context4.next = 7;
|
337
|
+
break;
|
338
|
+
}
|
339
|
+
|
340
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
341
|
+
|
342
|
+
case 7:
|
343
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
344
|
+
_context4.next = 9;
|
345
|
+
break;
|
346
|
+
}
|
347
|
+
|
348
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params['id'])));
|
349
|
+
|
350
|
+
case 9:
|
351
|
+
_context4.next = 11;
|
352
|
+
return _Api.default.sendRequest("/sftp_host_keys/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
|
353
|
+
|
354
|
+
case 11:
|
355
|
+
response = _context4.sent;
|
356
|
+
return _context4.abrupt("return", new SftpHostKey(response === null || response === void 0 ? void 0 : response.data, options));
|
357
|
+
|
358
|
+
case 13:
|
359
|
+
case "end":
|
360
|
+
return _context4.stop();
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}, _callee4);
|
364
|
+
}));
|
365
|
+
|
366
|
+
return function (_x) {
|
367
|
+
return _ref6.apply(this, arguments);
|
368
|
+
};
|
369
|
+
}());
|
370
|
+
(0, _defineProperty2.default)(SftpHostKey, "get", function (id) {
|
371
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
372
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
373
|
+
return SftpHostKey.find(id, params, options);
|
374
|
+
});
|
375
|
+
(0, _defineProperty2.default)(SftpHostKey, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
376
|
+
var params,
|
377
|
+
options,
|
378
|
+
response,
|
379
|
+
_args5 = arguments;
|
380
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
381
|
+
while (1) {
|
382
|
+
switch (_context5.prev = _context5.next) {
|
383
|
+
case 0:
|
384
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
385
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
386
|
+
|
387
|
+
if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
|
388
|
+
_context5.next = 4;
|
389
|
+
break;
|
390
|
+
}
|
391
|
+
|
392
|
+
throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
|
393
|
+
|
394
|
+
case 4:
|
395
|
+
if (!(params['private_key'] && !(0, _utils.isString)(params['private_key']))) {
|
396
|
+
_context5.next = 6;
|
397
|
+
break;
|
398
|
+
}
|
399
|
+
|
400
|
+
throw new errors.InvalidParameterError("Bad parameter: private_key must be of type String, received ".concat((0, _utils.getType)(params['private_key'])));
|
401
|
+
|
402
|
+
case 6:
|
403
|
+
_context5.next = 8;
|
404
|
+
return _Api.default.sendRequest("/sftp_host_keys", 'POST', params, options);
|
405
|
+
|
406
|
+
case 8:
|
407
|
+
response = _context5.sent;
|
408
|
+
return _context5.abrupt("return", new SftpHostKey(response === null || response === void 0 ? void 0 : response.data, options));
|
409
|
+
|
410
|
+
case 10:
|
411
|
+
case "end":
|
412
|
+
return _context5.stop();
|
413
|
+
}
|
414
|
+
}
|
415
|
+
}, _callee5);
|
416
|
+
})));
|
417
|
+
var _default = SftpHostKey;
|
418
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/src/models/ApiKey.js
CHANGED
@@ -37,6 +37,13 @@ class ApiKey {
|
|
37
37
|
this.attributes.descriptive_label = value
|
38
38
|
}
|
39
39
|
|
40
|
+
// string # User-supplied description of API key.
|
41
|
+
getDescription = () => this.attributes.description
|
42
|
+
|
43
|
+
setDescription = value => {
|
44
|
+
this.attributes.description = value
|
45
|
+
}
|
46
|
+
|
40
47
|
// date-time # Time which API Key was created
|
41
48
|
getCreatedAt = () => this.attributes.created_at
|
42
49
|
|
@@ -99,6 +106,7 @@ class ApiKey {
|
|
99
106
|
|
100
107
|
// Parameters:
|
101
108
|
// name - string - Internal name for the API Key. For your use.
|
109
|
+
// description - string - User-supplied description of API key.
|
102
110
|
// expires_at - string - API Key expiration date
|
103
111
|
// permission_set - string - Permissions for this API Key. Keys with the `desktop_app` permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Additional permission sets may become available in the future, such as for a Site Admin to give a key with no administrator privileges. If you have ideas for permission sets, please let us know.
|
104
112
|
update = async (params = {}) => {
|
@@ -117,6 +125,9 @@ class ApiKey {
|
|
117
125
|
if (params['name'] && !isString(params['name'])) {
|
118
126
|
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
119
127
|
}
|
128
|
+
if (params['description'] && !isString(params['description'])) {
|
129
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
|
130
|
+
}
|
120
131
|
if (params['expires_at'] && !isString(params['expires_at'])) {
|
121
132
|
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(expires_at)}`)
|
122
133
|
}
|
@@ -243,6 +254,7 @@ class ApiKey {
|
|
243
254
|
// Parameters:
|
244
255
|
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
245
256
|
// name - string - Internal name for the API Key. For your use.
|
257
|
+
// description - string - User-supplied description of API key.
|
246
258
|
// expires_at - string - API Key expiration date
|
247
259
|
// permission_set - string - Permissions for this API Key. Keys with the `desktop_app` permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Additional permission sets may become available in the future, such as for a Site Admin to give a key with no administrator privileges. If you have ideas for permission sets, please let us know.
|
248
260
|
// path - string - Folder path restriction for this api key.
|
@@ -255,6 +267,10 @@ class ApiKey {
|
|
255
267
|
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
|
256
268
|
}
|
257
269
|
|
270
|
+
if (params['description'] && !isString(params['description'])) {
|
271
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params['description'])}`)
|
272
|
+
}
|
273
|
+
|
258
274
|
if (params['expires_at'] && !isString(params['expires_at'])) {
|
259
275
|
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
|
260
276
|
}
|
@@ -0,0 +1,201 @@
|
|
1
|
+
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
3
|
+
import Logger from '../Logger'
|
4
|
+
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Class SftpHostKey
|
8
|
+
*/
|
9
|
+
class SftpHostKey {
|
10
|
+
attributes = {}
|
11
|
+
options = {}
|
12
|
+
|
13
|
+
constructor(attributes = {}, options = {}) {
|
14
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
15
|
+
const normalizedKey = key.replace('?', '')
|
16
|
+
|
17
|
+
this.attributes[normalizedKey] = value
|
18
|
+
|
19
|
+
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
20
|
+
})
|
21
|
+
|
22
|
+
this.options = { ...options }
|
23
|
+
}
|
24
|
+
|
25
|
+
isLoaded = () => !!this.attributes.id
|
26
|
+
// int64 # Sftp Host Key ID
|
27
|
+
getId = () => this.attributes.id
|
28
|
+
|
29
|
+
setId = value => {
|
30
|
+
this.attributes.id = value
|
31
|
+
}
|
32
|
+
|
33
|
+
// string # The friendly name of this SFTP Host Key.
|
34
|
+
getName = () => this.attributes.name
|
35
|
+
|
36
|
+
setName = value => {
|
37
|
+
this.attributes.name = value
|
38
|
+
}
|
39
|
+
|
40
|
+
// string # MD5 Fingerpint of the public key
|
41
|
+
getFingerprintMd5 = () => this.attributes.fingerprint_md5
|
42
|
+
|
43
|
+
setFingerprintMd5 = value => {
|
44
|
+
this.attributes.fingerprint_md5 = value
|
45
|
+
}
|
46
|
+
|
47
|
+
// string # SHA256 Fingerpint of the public key
|
48
|
+
getFingerprintSha256 = () => this.attributes.fingerprint_sha256
|
49
|
+
|
50
|
+
setFingerprintSha256 = value => {
|
51
|
+
this.attributes.fingerprint_sha256 = value
|
52
|
+
}
|
53
|
+
|
54
|
+
// string # The private key data.
|
55
|
+
getPrivateKey = () => this.attributes.private_key
|
56
|
+
|
57
|
+
setPrivateKey = value => {
|
58
|
+
this.attributes.private_key = value
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
// Parameters:
|
63
|
+
// name - string - The friendly name of this SFTP Host Key.
|
64
|
+
// private_key - string - The private key data.
|
65
|
+
update = async (params = {}) => {
|
66
|
+
if (!this.attributes.id) {
|
67
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
68
|
+
}
|
69
|
+
|
70
|
+
if (!isObject(params)) {
|
71
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
72
|
+
}
|
73
|
+
|
74
|
+
params.id = this.attributes.id
|
75
|
+
if (params['id'] && !isInt(params['id'])) {
|
76
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
77
|
+
}
|
78
|
+
if (params['name'] && !isString(params['name'])) {
|
79
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
|
80
|
+
}
|
81
|
+
if (params['private_key'] && !isString(params['private_key'])) {
|
82
|
+
throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
|
83
|
+
}
|
84
|
+
|
85
|
+
if (!params['id']) {
|
86
|
+
if (this.attributes.id) {
|
87
|
+
params['id'] = this.id
|
88
|
+
} else {
|
89
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
|
94
|
+
|
95
|
+
return new SftpHostKey(response?.data, this.options)
|
96
|
+
}
|
97
|
+
|
98
|
+
delete = async (params = {}) => {
|
99
|
+
if (!this.attributes.id) {
|
100
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
101
|
+
}
|
102
|
+
|
103
|
+
if (!isObject(params)) {
|
104
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
105
|
+
}
|
106
|
+
|
107
|
+
params.id = this.attributes.id
|
108
|
+
if (params['id'] && !isInt(params['id'])) {
|
109
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
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
|
+
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
|
121
|
+
|
122
|
+
return response?.data
|
123
|
+
}
|
124
|
+
|
125
|
+
destroy = (params = {}) =>
|
126
|
+
this.delete(params)
|
127
|
+
|
128
|
+
save = () => {
|
129
|
+
if (this.attributes['id']) {
|
130
|
+
return this.update(this.attributes)
|
131
|
+
} else {
|
132
|
+
const newObject = SftpHostKey.create(this.attributes, this.options)
|
133
|
+
this.attributes = { ...newObject.attributes }
|
134
|
+
return true
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
// Parameters:
|
139
|
+
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
140
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
141
|
+
static list = async (params = {}, options = {}) => {
|
142
|
+
if (params['cursor'] && !isString(params['cursor'])) {
|
143
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
|
144
|
+
}
|
145
|
+
|
146
|
+
if (params['per_page'] && !isInt(params['per_page'])) {
|
147
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
|
148
|
+
}
|
149
|
+
|
150
|
+
const response = await Api.sendRequest(`/sftp_host_keys`, 'GET', params, options)
|
151
|
+
|
152
|
+
return response?.data?.map(obj => new SftpHostKey(obj, options)) || []
|
153
|
+
}
|
154
|
+
|
155
|
+
static all = (params = {}, options = {}) =>
|
156
|
+
SftpHostKey.list(params, options)
|
157
|
+
|
158
|
+
// Parameters:
|
159
|
+
// id (required) - int64 - Sftp Host Key ID.
|
160
|
+
static find = async (id, params = {}, options = {}) => {
|
161
|
+
if (!isObject(params)) {
|
162
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
163
|
+
}
|
164
|
+
|
165
|
+
params['id'] = id
|
166
|
+
|
167
|
+
if (!params['id']) {
|
168
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
169
|
+
}
|
170
|
+
|
171
|
+
if (params['id'] && !isInt(params['id'])) {
|
172
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
|
173
|
+
}
|
174
|
+
|
175
|
+
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params['id'])}`, 'GET', params, options)
|
176
|
+
|
177
|
+
return new SftpHostKey(response?.data, options)
|
178
|
+
}
|
179
|
+
|
180
|
+
static get = (id, params = {}, options = {}) =>
|
181
|
+
SftpHostKey.find(id, params, options)
|
182
|
+
|
183
|
+
// Parameters:
|
184
|
+
// name - string - The friendly name of this SFTP Host Key.
|
185
|
+
// private_key - string - The private key data.
|
186
|
+
static create = async (params = {}, options = {}) => {
|
187
|
+
if (params['name'] && !isString(params['name'])) {
|
188
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
|
189
|
+
}
|
190
|
+
|
191
|
+
if (params['private_key'] && !isString(params['private_key'])) {
|
192
|
+
throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(params['private_key'])}`)
|
193
|
+
}
|
194
|
+
|
195
|
+
const response = await Api.sendRequest(`/sftp_host_keys`, 'POST', params, options)
|
196
|
+
|
197
|
+
return new SftpHostKey(response?.data, options)
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
export default SftpHostKey
|