files.com 1.2.268 → 1.2.270

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.268
1
+ 1.2.270
@@ -21,6 +21,10 @@
21
21
  * `public_key` (string): Your GPG public key
22
22
  * `private_key` (string): Your GPG private key.
23
23
  * `private_key_password` (string): Your GPG private key password. Only required for password protected keys.
24
+ * `generate_expires_at` (string): Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
25
+ * `generate_keypair` (boolean): If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
26
+ * `generate_full_name` (string): Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
27
+ * `generate_email` (string): Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
24
28
 
25
29
  ---
26
30
 
@@ -64,6 +68,10 @@ await GpgKey.create({
64
68
  'private_key': "ab236cfe4a195f0226bc2e674afdd6b0",
65
69
  'private_key_password': "[your GPG private key password]",
66
70
  'name': "key name",
71
+ 'generate_expires_at': "2025-06-19 12:00:00",
72
+ 'generate_keypair': false,
73
+ 'generate_full_name': "John Doe",
74
+ 'generate_email': "jdoe@example.com",
67
75
  })
68
76
  ```
69
77
 
@@ -75,6 +83,10 @@ await GpgKey.create({
75
83
  * `private_key` (string): Your GPG private key.
76
84
  * `private_key_password` (string): Your GPG private key password. Only required for password protected keys.
77
85
  * `name` (string): Required - Your GPG key name.
86
+ * `generate_expires_at` (string): Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
87
+ * `generate_keypair` (boolean): If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
88
+ * `generate_full_name` (string): Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
89
+ * `generate_email` (string): Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
78
90
 
79
91
  ---
80
92
 
@@ -9,7 +9,10 @@
9
9
  "created_at": "2000-01-01T01:00:00Z",
10
10
  "fingerprint": "43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8",
11
11
  "fingerprint_sha256": "V5Q5t/ghT3R8Tol5GX9385bzmpygWVRnLuI9EXNrjCX",
12
+ "status": "complete",
12
13
  "last_login_at": "2000-01-01T01:00:00Z",
14
+ "private_key": "example",
15
+ "public_key": "example",
13
16
  "username": "User",
14
17
  "user_id": 1
15
18
  }
@@ -20,10 +23,16 @@
20
23
  * `created_at` (date-time): Public key created at date/time
21
24
  * `fingerprint` (string): Public key fingerprint (MD5)
22
25
  * `fingerprint_sha256` (string): Public key fingerprint (SHA256)
26
+ * `status` (string): Can be invalid, not_generated, generating, complete
23
27
  * `last_login_at` (date-time): Key's most recent login time via SFTP
28
+ * `private_key` (string): Private key generated for the user.
29
+ * `public_key` (string): Public key generated for the user.
24
30
  * `username` (string): Username of the user this public key is associated with
25
31
  * `user_id` (int64): User ID this public key is associated with
26
- * `public_key` (string): Actual contents of SSH key.
32
+ * `generate_keypair` (boolean): If true, generate a new SSH key pair. Can not be used with `public_key`
33
+ * `generate_private_key_password` (string): Password for the private key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
34
+ * `generate_algorithm` (string): Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
35
+ * `generate_length` (int64): Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
27
36
 
28
37
  ---
29
38
 
@@ -68,7 +77,11 @@ await PublicKey.find(id)
68
77
  await PublicKey.create({
69
78
  'user_id': 1,
70
79
  'title': "My Main Key",
71
- 'public_key': "public_key",
80
+ 'public_key': "example",
81
+ 'generate_keypair': false,
82
+ 'generate_private_key_password': "[your private key password]",
83
+ 'generate_algorithm': "rsa",
84
+ 'generate_length': 4096,
72
85
  })
73
86
  ```
74
87
 
@@ -77,7 +90,11 @@ await PublicKey.create({
77
90
 
78
91
  * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
79
92
  * `title` (string): Required - Internal reference for key.
80
- * `public_key` (string): Required - Actual contents of SSH key.
93
+ * `public_key` (string): Actual contents of SSH key.
94
+ * `generate_keypair` (boolean): If true, generate a new SSH key pair. Can not be used with `public_key`
95
+ * `generate_private_key_password` (string): Password for the private key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
96
+ * `generate_algorithm` (string): Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
97
+ * `generate_length` (int64): Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
81
98
 
82
99
  ---
83
100
 
@@ -105,7 +122,10 @@ await public_key.update({
105
122
  "created_at": "2000-01-01T01:00:00Z",
106
123
  "fingerprint": "43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8",
107
124
  "fingerprint_sha256": "V5Q5t/ghT3R8Tol5GX9385bzmpygWVRnLuI9EXNrjCX",
125
+ "status": "complete",
108
126
  "last_login_at": "2000-01-01T01:00:00Z",
127
+ "private_key": "example",
128
+ "public_key": "example",
109
129
  "username": "User",
110
130
  "user_id": 1
111
131
  }
@@ -71,8 +71,7 @@
71
71
  "user_root": "example",
72
72
  "user_home": "example",
73
73
  "days_remaining_until_password_expire": 1,
74
- "password_expire_at": "2000-01-01T01:00:00Z",
75
- "has_reassignable_associations": true
74
+ "password_expire_at": "2000-01-01T01:00:00Z"
76
75
  }
77
76
  ```
78
77
 
@@ -142,7 +141,6 @@
142
141
  * `user_home` (string): Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
143
142
  * `days_remaining_until_password_expire` (int64): Number of days remaining until password expires
144
143
  * `password_expire_at` (date-time): Password expiration datetime
145
- * `has_reassignable_associations` (boolean): Does this user have any associations that can be reassigned on delete?
146
144
  * `avatar_file` (file): An image file for your user avatar.
147
145
  * `avatar_delete` (boolean): If true, the avatar will be deleted.
148
146
  * `change_password` (string): Used for changing a password on an existing user.
@@ -511,8 +509,7 @@ await user.update({
511
509
  "user_root": "example",
512
510
  "user_home": "example",
513
511
  "days_remaining_until_password_expire": 1,
514
- "password_expire_at": "2000-01-01T01:00:00Z",
515
- "has_reassignable_associations": true
512
+ "password_expire_at": "2000-01-01T01:00:00Z"
516
513
  }
517
514
  ```
518
515
 
package/lib/Files.js CHANGED
@@ -12,7 +12,7 @@ var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
14
  var language = null;
15
- var version = '1.2.268';
15
+ var version = '1.2.270';
16
16
  var userAgent = "Files.com JavaScript SDK v".concat(version);
17
17
  var logLevel = _Logger.LogLevel.INFO;
18
18
  var debugRequest = false;
@@ -81,6 +81,34 @@ var GpgKey = /*#__PURE__*/(0, _createClass2.default)(function GpgKey() {
81
81
  (0, _defineProperty2.default)(this, "setPrivateKeyPassword", function (value) {
82
82
  _this.attributes.private_key_password = value;
83
83
  });
84
+ // string # Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
85
+ (0, _defineProperty2.default)(this, "getGenerateExpiresAt", function () {
86
+ return _this.attributes.generate_expires_at;
87
+ });
88
+ (0, _defineProperty2.default)(this, "setGenerateExpiresAt", function (value) {
89
+ _this.attributes.generate_expires_at = value;
90
+ });
91
+ // boolean # If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
92
+ (0, _defineProperty2.default)(this, "getGenerateKeypair", function () {
93
+ return _this.attributes.generate_keypair;
94
+ });
95
+ (0, _defineProperty2.default)(this, "setGenerateKeypair", function (value) {
96
+ _this.attributes.generate_keypair = value;
97
+ });
98
+ // string # Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
99
+ (0, _defineProperty2.default)(this, "getGenerateFullName", function () {
100
+ return _this.attributes.generate_full_name;
101
+ });
102
+ (0, _defineProperty2.default)(this, "setGenerateFullName", function (value) {
103
+ _this.attributes.generate_full_name = value;
104
+ });
105
+ // string # Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
106
+ (0, _defineProperty2.default)(this, "getGenerateEmail", function () {
107
+ return _this.attributes.generate_email;
108
+ });
109
+ (0, _defineProperty2.default)(this, "setGenerateEmail", function (value) {
110
+ _this.attributes.generate_email = value;
111
+ });
84
112
  // Parameters:
85
113
  // public_key - string - Your GPG public key
86
114
  // private_key - string - Your GPG private key.
@@ -366,6 +394,10 @@ _GpgKey = GpgKey;
366
394
  // private_key - string - Your GPG private key.
367
395
  // private_key_password - string - Your GPG private key password. Only required for password protected keys.
368
396
  // name (required) - string - Your GPG key name.
397
+ // generate_expires_at - string - Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
398
+ // generate_keypair - boolean - If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
399
+ // generate_full_name - string - Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
400
+ // generate_email - string - Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
369
401
  (0, _defineProperty2.default)(GpgKey, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
370
402
  var params,
371
403
  options,
@@ -412,12 +444,30 @@ _GpgKey = GpgKey;
412
444
  }
413
445
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
414
446
  case 6:
415
- _context6.next = 7;
416
- return _Api.default.sendRequest('/gpg_keys', 'POST', params, options);
447
+ if (!(params.generate_expires_at && !(0, _utils.isString)(params.generate_expires_at))) {
448
+ _context6.next = 7;
449
+ break;
450
+ }
451
+ throw new errors.InvalidParameterError("Bad parameter: generate_expires_at must be of type String, received ".concat((0, _utils.getType)(params.generate_expires_at)));
417
452
  case 7:
453
+ if (!(params.generate_full_name && !(0, _utils.isString)(params.generate_full_name))) {
454
+ _context6.next = 8;
455
+ break;
456
+ }
457
+ throw new errors.InvalidParameterError("Bad parameter: generate_full_name must be of type String, received ".concat((0, _utils.getType)(params.generate_full_name)));
458
+ case 8:
459
+ if (!(params.generate_email && !(0, _utils.isString)(params.generate_email))) {
460
+ _context6.next = 9;
461
+ break;
462
+ }
463
+ throw new errors.InvalidParameterError("Bad parameter: generate_email must be of type String, received ".concat((0, _utils.getType)(params.generate_email)));
464
+ case 9:
465
+ _context6.next = 10;
466
+ return _Api.default.sendRequest('/gpg_keys', 'POST', params, options);
467
+ case 10:
418
468
  response = _context6.sent;
419
469
  return _context6.abrupt("return", new _GpgKey(response === null || response === void 0 ? void 0 : response.data, options));
420
- case 8:
470
+ case 11:
421
471
  case "end":
422
472
  return _context6.stop();
423
473
  }
@@ -64,6 +64,13 @@ var PublicKey = /*#__PURE__*/(0, _createClass2.default)(function PublicKey() {
64
64
  (0, _defineProperty2.default)(this, "setFingerprintSha256", function (value) {
65
65
  _this.attributes.fingerprint_sha256 = value;
66
66
  });
67
+ // string # Can be invalid, not_generated, generating, complete
68
+ (0, _defineProperty2.default)(this, "getStatus", function () {
69
+ return _this.attributes.status;
70
+ });
71
+ (0, _defineProperty2.default)(this, "setStatus", function (value) {
72
+ _this.attributes.status = value;
73
+ });
67
74
  // date-time # Key's most recent login time via SFTP
68
75
  (0, _defineProperty2.default)(this, "getLastLoginAt", function () {
69
76
  return _this.attributes.last_login_at;
@@ -71,6 +78,20 @@ var PublicKey = /*#__PURE__*/(0, _createClass2.default)(function PublicKey() {
71
78
  (0, _defineProperty2.default)(this, "setLastLoginAt", function (value) {
72
79
  _this.attributes.last_login_at = value;
73
80
  });
81
+ // string # Private key generated for the user.
82
+ (0, _defineProperty2.default)(this, "getPrivateKey", function () {
83
+ return _this.attributes.private_key;
84
+ });
85
+ (0, _defineProperty2.default)(this, "setPrivateKey", function (value) {
86
+ _this.attributes.private_key = value;
87
+ });
88
+ // string # Public key generated for the user.
89
+ (0, _defineProperty2.default)(this, "getPublicKey", function () {
90
+ return _this.attributes.public_key;
91
+ });
92
+ (0, _defineProperty2.default)(this, "setPublicKey", function (value) {
93
+ _this.attributes.public_key = value;
94
+ });
74
95
  // string # Username of the user this public key is associated with
75
96
  (0, _defineProperty2.default)(this, "getUsername", function () {
76
97
  return _this.attributes.username;
@@ -85,12 +106,33 @@ var PublicKey = /*#__PURE__*/(0, _createClass2.default)(function PublicKey() {
85
106
  (0, _defineProperty2.default)(this, "setUserId", function (value) {
86
107
  _this.attributes.user_id = value;
87
108
  });
88
- // string # Actual contents of SSH key.
89
- (0, _defineProperty2.default)(this, "getPublicKey", function () {
90
- return _this.attributes.public_key;
109
+ // boolean # If true, generate a new SSH key pair. Can not be used with `public_key`
110
+ (0, _defineProperty2.default)(this, "getGenerateKeypair", function () {
111
+ return _this.attributes.generate_keypair;
91
112
  });
92
- (0, _defineProperty2.default)(this, "setPublicKey", function (value) {
93
- _this.attributes.public_key = value;
113
+ (0, _defineProperty2.default)(this, "setGenerateKeypair", function (value) {
114
+ _this.attributes.generate_keypair = value;
115
+ });
116
+ // string # Password for the private key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
117
+ (0, _defineProperty2.default)(this, "getGeneratePrivateKeyPassword", function () {
118
+ return _this.attributes.generate_private_key_password;
119
+ });
120
+ (0, _defineProperty2.default)(this, "setGeneratePrivateKeyPassword", function (value) {
121
+ _this.attributes.generate_private_key_password = value;
122
+ });
123
+ // string # Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
124
+ (0, _defineProperty2.default)(this, "getGenerateAlgorithm", function () {
125
+ return _this.attributes.generate_algorithm;
126
+ });
127
+ (0, _defineProperty2.default)(this, "setGenerateAlgorithm", function (value) {
128
+ _this.attributes.generate_algorithm = value;
129
+ });
130
+ // int64 # Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
131
+ (0, _defineProperty2.default)(this, "getGenerateLength", function () {
132
+ return _this.attributes.generate_length;
133
+ });
134
+ (0, _defineProperty2.default)(this, "setGenerateLength", function (value) {
135
+ _this.attributes.generate_length = value;
94
136
  });
95
137
  // Parameters:
96
138
  // title (required) - string - Internal reference for key.
@@ -371,7 +413,11 @@ _PublicKey = PublicKey;
371
413
  // Parameters:
372
414
  // user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
373
415
  // title (required) - string - Internal reference for key.
374
- // public_key (required) - string - Actual contents of SSH key.
416
+ // public_key - string - Actual contents of SSH key.
417
+ // generate_keypair - boolean - If true, generate a new SSH key pair. Can not be used with `public_key`
418
+ // generate_private_key_password - string - Password for the private key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
419
+ // generate_algorithm - string - Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
420
+ // generate_length - int64 - Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
375
421
  (0, _defineProperty2.default)(PublicKey, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
376
422
  var params,
377
423
  options,
@@ -388,36 +434,48 @@ _PublicKey = PublicKey;
388
434
  }
389
435
  throw new errors.MissingParameterError('Parameter missing: title');
390
436
  case 1:
391
- if (params.public_key) {
437
+ if (!(params.user_id && !(0, _utils.isInt)(params.user_id))) {
392
438
  _context6.next = 2;
393
439
  break;
394
440
  }
395
- throw new errors.MissingParameterError('Parameter missing: public_key');
441
+ throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params.user_id)));
396
442
  case 2:
397
- if (!(params.user_id && !(0, _utils.isInt)(params.user_id))) {
443
+ if (!(params.title && !(0, _utils.isString)(params.title))) {
398
444
  _context6.next = 3;
399
445
  break;
400
446
  }
401
- throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params.user_id)));
447
+ throw new errors.InvalidParameterError("Bad parameter: title must be of type String, received ".concat((0, _utils.getType)(params.title)));
402
448
  case 3:
403
- if (!(params.title && !(0, _utils.isString)(params.title))) {
449
+ if (!(params.public_key && !(0, _utils.isString)(params.public_key))) {
404
450
  _context6.next = 4;
405
451
  break;
406
452
  }
407
- throw new errors.InvalidParameterError("Bad parameter: title must be of type String, received ".concat((0, _utils.getType)(params.title)));
453
+ throw new errors.InvalidParameterError("Bad parameter: public_key must be of type String, received ".concat((0, _utils.getType)(params.public_key)));
408
454
  case 4:
409
- if (!(params.public_key && !(0, _utils.isString)(params.public_key))) {
455
+ if (!(params.generate_private_key_password && !(0, _utils.isString)(params.generate_private_key_password))) {
410
456
  _context6.next = 5;
411
457
  break;
412
458
  }
413
- throw new errors.InvalidParameterError("Bad parameter: public_key must be of type String, received ".concat((0, _utils.getType)(params.public_key)));
459
+ throw new errors.InvalidParameterError("Bad parameter: generate_private_key_password must be of type String, received ".concat((0, _utils.getType)(params.generate_private_key_password)));
414
460
  case 5:
415
- _context6.next = 6;
416
- return _Api.default.sendRequest('/public_keys', 'POST', params, options);
461
+ if (!(params.generate_algorithm && !(0, _utils.isString)(params.generate_algorithm))) {
462
+ _context6.next = 6;
463
+ break;
464
+ }
465
+ throw new errors.InvalidParameterError("Bad parameter: generate_algorithm must be of type String, received ".concat((0, _utils.getType)(params.generate_algorithm)));
417
466
  case 6:
467
+ if (!(params.generate_length && !(0, _utils.isInt)(params.generate_length))) {
468
+ _context6.next = 7;
469
+ break;
470
+ }
471
+ throw new errors.InvalidParameterError("Bad parameter: generate_length must be of type Int, received ".concat((0, _utils.getType)(params.generate_length)));
472
+ case 7:
473
+ _context6.next = 8;
474
+ return _Api.default.sendRequest('/public_keys', 'POST', params, options);
475
+ case 8:
418
476
  response = _context6.sent;
419
477
  return _context6.abrupt("return", new _PublicKey(response === null || response === void 0 ? void 0 : response.data, options));
420
- case 7:
478
+ case 9:
421
479
  case "end":
422
480
  return _context6.stop();
423
481
  }
@@ -491,13 +491,6 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
491
491
  (0, _defineProperty2.default)(this, "setPasswordExpireAt", function (value) {
492
492
  _this.attributes.password_expire_at = value;
493
493
  });
494
- // boolean # Does this user have any associations that can be reassigned on delete?
495
- (0, _defineProperty2.default)(this, "getHasReassignableAssociations", function () {
496
- return _this.attributes.has_reassignable_associations;
497
- });
498
- (0, _defineProperty2.default)(this, "setHasReassignableAssociations", function (value) {
499
- _this.attributes.has_reassignable_associations = value;
500
- });
501
494
  // file # An image file for your user avatar.
502
495
  (0, _defineProperty2.default)(this, "getAvatarFile", function () {
503
496
  return _this.attributes.avatar_file;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.268",
3
+ "version": "1.2.270",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -6,7 +6,7 @@ let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
8
  let language = null
9
- const version = '1.2.268'
9
+ const version = '1.2.270'
10
10
  let userAgent = `Files.com JavaScript SDK v${version}`
11
11
 
12
12
  let logLevel = LogLevel.INFO
@@ -77,6 +77,34 @@ class GpgKey {
77
77
  this.attributes.private_key_password = value
78
78
  }
79
79
 
80
+ // string # Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
81
+ getGenerateExpiresAt = () => this.attributes.generate_expires_at
82
+
83
+ setGenerateExpiresAt = value => {
84
+ this.attributes.generate_expires_at = value
85
+ }
86
+
87
+ // boolean # If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
88
+ getGenerateKeypair = () => this.attributes.generate_keypair
89
+
90
+ setGenerateKeypair = value => {
91
+ this.attributes.generate_keypair = value
92
+ }
93
+
94
+ // string # Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
95
+ getGenerateFullName = () => this.attributes.generate_full_name
96
+
97
+ setGenerateFullName = value => {
98
+ this.attributes.generate_full_name = value
99
+ }
100
+
101
+ // string # Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
102
+ getGenerateEmail = () => this.attributes.generate_email
103
+
104
+ setGenerateEmail = value => {
105
+ this.attributes.generate_email = value
106
+ }
107
+
80
108
  // Parameters:
81
109
  // public_key - string - Your GPG public key
82
110
  // private_key - string - Your GPG private key.
@@ -222,6 +250,10 @@ class GpgKey {
222
250
  // private_key - string - Your GPG private key.
223
251
  // private_key_password - string - Your GPG private key password. Only required for password protected keys.
224
252
  // name (required) - string - Your GPG key name.
253
+ // generate_expires_at - string - Expiration date of the key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
254
+ // generate_keypair - boolean - If true, generate a new GPG key pair. Can not be used with `public_key`/`private_key`
255
+ // generate_full_name - string - Full name of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
256
+ // generate_email - string - Email address of the key owner. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
225
257
  static create = async (params = {}, options = {}) => {
226
258
  if (!params.name) {
227
259
  throw new errors.MissingParameterError('Parameter missing: name')
@@ -247,6 +279,18 @@ class GpgKey {
247
279
  throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
248
280
  }
249
281
 
282
+ if (params.generate_expires_at && !isString(params.generate_expires_at)) {
283
+ throw new errors.InvalidParameterError(`Bad parameter: generate_expires_at must be of type String, received ${getType(params.generate_expires_at)}`)
284
+ }
285
+
286
+ if (params.generate_full_name && !isString(params.generate_full_name)) {
287
+ throw new errors.InvalidParameterError(`Bad parameter: generate_full_name must be of type String, received ${getType(params.generate_full_name)}`)
288
+ }
289
+
290
+ if (params.generate_email && !isString(params.generate_email)) {
291
+ throw new errors.InvalidParameterError(`Bad parameter: generate_email must be of type String, received ${getType(params.generate_email)}`)
292
+ }
293
+
250
294
  const response = await Api.sendRequest('/gpg_keys', 'POST', params, options)
251
295
 
252
296
  return new GpgKey(response?.data, options)
@@ -59,6 +59,13 @@ class PublicKey {
59
59
  this.attributes.fingerprint_sha256 = value
60
60
  }
61
61
 
62
+ // string # Can be invalid, not_generated, generating, complete
63
+ getStatus = () => this.attributes.status
64
+
65
+ setStatus = value => {
66
+ this.attributes.status = value
67
+ }
68
+
62
69
  // date-time # Key's most recent login time via SFTP
63
70
  getLastLoginAt = () => this.attributes.last_login_at
64
71
 
@@ -66,6 +73,20 @@ class PublicKey {
66
73
  this.attributes.last_login_at = value
67
74
  }
68
75
 
76
+ // string # Private key generated for the user.
77
+ getPrivateKey = () => this.attributes.private_key
78
+
79
+ setPrivateKey = value => {
80
+ this.attributes.private_key = value
81
+ }
82
+
83
+ // string # Public key generated for the user.
84
+ getPublicKey = () => this.attributes.public_key
85
+
86
+ setPublicKey = value => {
87
+ this.attributes.public_key = value
88
+ }
89
+
69
90
  // string # Username of the user this public key is associated with
70
91
  getUsername = () => this.attributes.username
71
92
 
@@ -80,11 +101,32 @@ class PublicKey {
80
101
  this.attributes.user_id = value
81
102
  }
82
103
 
83
- // string # Actual contents of SSH key.
84
- getPublicKey = () => this.attributes.public_key
104
+ // boolean # If true, generate a new SSH key pair. Can not be used with `public_key`
105
+ getGenerateKeypair = () => this.attributes.generate_keypair
85
106
 
86
- setPublicKey = value => {
87
- this.attributes.public_key = value
107
+ setGenerateKeypair = value => {
108
+ this.attributes.generate_keypair = value
109
+ }
110
+
111
+ // string # Password for the private key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
112
+ getGeneratePrivateKeyPassword = () => this.attributes.generate_private_key_password
113
+
114
+ setGeneratePrivateKeyPassword = value => {
115
+ this.attributes.generate_private_key_password = value
116
+ }
117
+
118
+ // string # Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
119
+ getGenerateAlgorithm = () => this.attributes.generate_algorithm
120
+
121
+ setGenerateAlgorithm = value => {
122
+ this.attributes.generate_algorithm = value
123
+ }
124
+
125
+ // int64 # Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
126
+ getGenerateLength = () => this.attributes.generate_length
127
+
128
+ setGenerateLength = value => {
129
+ this.attributes.generate_length = value
88
130
  }
89
131
 
90
132
  // Parameters:
@@ -226,16 +268,16 @@ class PublicKey {
226
268
  // Parameters:
227
269
  // user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
228
270
  // title (required) - string - Internal reference for key.
229
- // public_key (required) - string - Actual contents of SSH key.
271
+ // public_key - string - Actual contents of SSH key.
272
+ // generate_keypair - boolean - If true, generate a new SSH key pair. Can not be used with `public_key`
273
+ // generate_private_key_password - string - Password for the private key. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
274
+ // generate_algorithm - string - Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
275
+ // generate_length - int64 - Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if `generate_keypair` is false.
230
276
  static create = async (params = {}, options = {}) => {
231
277
  if (!params.title) {
232
278
  throw new errors.MissingParameterError('Parameter missing: title')
233
279
  }
234
280
 
235
- if (!params.public_key) {
236
- throw new errors.MissingParameterError('Parameter missing: public_key')
237
- }
238
-
239
281
  if (params.user_id && !isInt(params.user_id)) {
240
282
  throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
241
283
  }
@@ -248,6 +290,18 @@ class PublicKey {
248
290
  throw new errors.InvalidParameterError(`Bad parameter: public_key must be of type String, received ${getType(params.public_key)}`)
249
291
  }
250
292
 
293
+ if (params.generate_private_key_password && !isString(params.generate_private_key_password)) {
294
+ throw new errors.InvalidParameterError(`Bad parameter: generate_private_key_password must be of type String, received ${getType(params.generate_private_key_password)}`)
295
+ }
296
+
297
+ if (params.generate_algorithm && !isString(params.generate_algorithm)) {
298
+ throw new errors.InvalidParameterError(`Bad parameter: generate_algorithm must be of type String, received ${getType(params.generate_algorithm)}`)
299
+ }
300
+
301
+ if (params.generate_length && !isInt(params.generate_length)) {
302
+ throw new errors.InvalidParameterError(`Bad parameter: generate_length must be of type Int, received ${getType(params.generate_length)}`)
303
+ }
304
+
251
305
  const response = await Api.sendRequest('/public_keys', 'POST', params, options)
252
306
 
253
307
  return new PublicKey(response?.data, options)
@@ -486,13 +486,6 @@ class User {
486
486
  this.attributes.password_expire_at = value
487
487
  }
488
488
 
489
- // boolean # Does this user have any associations that can be reassigned on delete?
490
- getHasReassignableAssociations = () => this.attributes.has_reassignable_associations
491
-
492
- setHasReassignableAssociations = value => {
493
- this.attributes.has_reassignable_associations = value
494
- }
495
-
496
489
  // file # An image file for your user avatar.
497
490
  getAvatarFile = () => this.attributes.avatar_file
498
491