files.com 1.0.155 → 1.0.159

Sign up to get free protection for your applications and to get access to all the features.
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.155
1
+ 1.0.159
@@ -68,12 +68,6 @@ var BandwidthSnapshot = /*#__PURE__*/(0, _createClass2.default)(function Bandwid
68
68
  (0, _defineProperty2.default)(this, "getLoggedAt", function () {
69
69
  return _this.attributes.logged_at;
70
70
  });
71
- (0, _defineProperty2.default)(this, "getCreatedAt", function () {
72
- return _this.attributes.created_at;
73
- });
74
- (0, _defineProperty2.default)(this, "getUpdatedAt", function () {
75
- return _this.attributes.updated_at;
76
- });
77
71
  Object.entries(attributes).forEach(function (_ref) {
78
72
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
79
73
  key = _ref2[0],
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
+
18
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
+
20
+ var _Api = _interopRequireDefault(require("../Api"));
21
+
22
+ var _Logger = _interopRequireDefault(require("../Logger"));
23
+
24
+ var _utils = require("../utils");
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ /**
31
+ * Class RemoteBandwidthSnapshot
32
+ */
33
+ var RemoteBandwidthSnapshot = /*#__PURE__*/(0, _createClass2.default)(function RemoteBandwidthSnapshot() {
34
+ var _this = this;
35
+
36
+ var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
38
+ (0, _classCallCheck2.default)(this, RemoteBandwidthSnapshot);
39
+ (0, _defineProperty2.default)(this, "attributes", {});
40
+ (0, _defineProperty2.default)(this, "options", {});
41
+ (0, _defineProperty2.default)(this, "isLoaded", function () {
42
+ return !!_this.attributes.id;
43
+ });
44
+ (0, _defineProperty2.default)(this, "getId", function () {
45
+ return _this.attributes.id;
46
+ });
47
+ (0, _defineProperty2.default)(this, "getSyncBytesReceived", function () {
48
+ return _this.attributes.sync_bytes_received;
49
+ });
50
+ (0, _defineProperty2.default)(this, "getSyncBytesSent", function () {
51
+ return _this.attributes.sync_bytes_sent;
52
+ });
53
+ (0, _defineProperty2.default)(this, "getLoggedAt", function () {
54
+ return _this.attributes.logged_at;
55
+ });
56
+ (0, _defineProperty2.default)(this, "getRemoteServerId", function () {
57
+ return _this.attributes.remote_server_id;
58
+ });
59
+ Object.entries(attributes).forEach(function (_ref) {
60
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
61
+ key = _ref2[0],
62
+ value = _ref2[1];
63
+
64
+ var normalizedKey = key.replace('?', '');
65
+ _this.attributes[normalizedKey] = value;
66
+ Object.defineProperty(_this, normalizedKey, {
67
+ value: value,
68
+ writable: false
69
+ });
70
+ });
71
+ this.options = _objectSpread({}, options);
72
+ });
73
+ (0, _defineProperty2.default)(RemoteBandwidthSnapshot, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
74
+ var _response$data;
75
+
76
+ var params,
77
+ options,
78
+ response,
79
+ _args = arguments;
80
+ return _regenerator.default.wrap(function _callee$(_context) {
81
+ while (1) {
82
+ switch (_context.prev = _context.next) {
83
+ case 0:
84
+ params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
85
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
86
+
87
+ if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
88
+ _context.next = 4;
89
+ break;
90
+ }
91
+
92
+ throw new Error("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(cursor)));
93
+
94
+ case 4:
95
+ if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
96
+ _context.next = 6;
97
+ break;
98
+ }
99
+
100
+ throw new Error("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(per_page)));
101
+
102
+ case 6:
103
+ _context.next = 8;
104
+ return _Api.default.sendRequest("/remote_bandwidth_snapshots", 'GET', params, options);
105
+
106
+ case 8:
107
+ response = _context.sent;
108
+ return _context.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) {
109
+ return new RemoteBandwidthSnapshot(obj, options);
110
+ })) || []);
111
+
112
+ case 10:
113
+ case "end":
114
+ return _context.stop();
115
+ }
116
+ }
117
+ }, _callee);
118
+ })));
119
+ (0, _defineProperty2.default)(RemoteBandwidthSnapshot, "all", function () {
120
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
121
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
122
+ return RemoteBandwidthSnapshot.list(params, options);
123
+ });
124
+ var _default = RemoteBandwidthSnapshot;
125
+ exports.default = _default;
@@ -137,6 +137,12 @@ var Session = /*#__PURE__*/(0, _createClass2.default)(function Session() {
137
137
  (0, _defineProperty2.default)(this, "setAllowed2faMethodU2f", function (value) {
138
138
  _this.attributes.allowed_2fa_method_u2f = value;
139
139
  });
140
+ (0, _defineProperty2.default)(this, "getAllowed2faMethodWebauthn", function () {
141
+ return _this.attributes.allowed_2fa_method_webauthn;
142
+ });
143
+ (0, _defineProperty2.default)(this, "setAllowed2faMethodWebauthn", function (value) {
144
+ _this.attributes.allowed_2fa_method_webauthn = value;
145
+ });
140
146
  (0, _defineProperty2.default)(this, "getAllowed2faMethodYubi", function () {
141
147
  return _this.attributes.allowed_2fa_method_yubi;
142
148
  });
@@ -41,9 +41,6 @@ var SettingsChange = /*#__PURE__*/(0, _createClass2.default)(function SettingsCh
41
41
  (0, _defineProperty2.default)(this, "isLoaded", function () {
42
42
  return !!_this.attributes.id;
43
43
  });
44
- (0, _defineProperty2.default)(this, "getChangeDetails", function () {
45
- return _this.attributes.change_details;
46
- });
47
44
  (0, _defineProperty2.default)(this, "getChanges", function () {
48
45
  return _this.attributes.changes;
49
46
  });
@@ -53,6 +53,9 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
53
53
  (0, _defineProperty2.default)(this, "getAllowed2faMethodU2f", function () {
54
54
  return _this.attributes.allowed_2fa_method_u2f;
55
55
  });
56
+ (0, _defineProperty2.default)(this, "getAllowed2faMethodWebauthn", function () {
57
+ return _this.attributes.allowed_2fa_method_webauthn;
58
+ });
56
59
  (0, _defineProperty2.default)(this, "getAllowed2faMethodYubi", function () {
57
60
  return _this.attributes.allowed_2fa_method_yubi;
58
61
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.155",
3
+ "version": "1.0.159",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
@@ -49,12 +49,6 @@ class BandwidthSnapshot {
49
49
  // date-time # Time the site bandwidth report was logged
50
50
  getLoggedAt = () => this.attributes.logged_at
51
51
 
52
- // date-time # Site bandwidth report created at date/time
53
- getCreatedAt = () => this.attributes.created_at
54
-
55
- // date-time # The last time this site bandwidth report was updated
56
- getUpdatedAt = () => this.attributes.updated_at
57
-
58
52
 
59
53
  // Parameters:
60
54
  // 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.
@@ -267,7 +267,7 @@ class File {
267
267
  this.attributes.region = value
268
268
  }
269
269
 
270
- // string # A short string representing the current user's permissions. Can be `r`,`w`,`p`, or any combination
270
+ // string # A short string representing the current user's permissions. Can be `r`,`w`,`d`, `l` or any combination
271
271
  getPermissions = () => this.attributes.permissions
272
272
 
273
273
  setPermissions = value => {
@@ -93,7 +93,7 @@ class Folder {
93
93
  this.attributes.region = value
94
94
  }
95
95
 
96
- // string # A short string representing the current user's permissions. Can be `r`,`w`,`p`, or any combination
96
+ // string # A short string representing the current user's permissions. Can be `r`,`w`,`d`, `l` or any combination
97
97
  getPermissions = () => this.attributes.permissions
98
98
 
99
99
  setPermissions = value => {
@@ -0,0 +1,69 @@
1
+ import Api from '../Api'
2
+ import Logger from '../Logger'
3
+ import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
+
5
+ /**
6
+ * Class RemoteBandwidthSnapshot
7
+ */
8
+ class RemoteBandwidthSnapshot {
9
+ attributes = {}
10
+ options = {}
11
+
12
+ constructor(attributes = {}, options = {}) {
13
+ Object.entries(attributes).forEach(([key, value]) => {
14
+ const normalizedKey = key.replace('?', '')
15
+
16
+ this.attributes[normalizedKey] = value
17
+
18
+ Object.defineProperty(this, normalizedKey, { value, writable: false })
19
+ })
20
+
21
+ this.options = { ...options }
22
+ }
23
+
24
+ isLoaded = () => !!this.attributes.id
25
+ // int64 # Site bandwidth ID
26
+ getId = () => this.attributes.id
27
+
28
+ // double # Site sync bandwidth report bytes received
29
+ getSyncBytesReceived = () => this.attributes.sync_bytes_received
30
+
31
+ // double # Site sync bandwidth report bytes sent
32
+ getSyncBytesSent = () => this.attributes.sync_bytes_sent
33
+
34
+ // date-time # Time the site bandwidth report was logged
35
+ getLoggedAt = () => this.attributes.logged_at
36
+
37
+ // int64 # ID of related Remote Server
38
+ getRemoteServerId = () => this.attributes.remote_server_id
39
+
40
+
41
+ // Parameters:
42
+ // 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.
43
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
44
+ // sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `logged_at`.
45
+ // filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `logged_at`.
46
+ // filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `logged_at`.
47
+ // filter_gteq - object - If set, return records where the specified field is greater than or equal to the supplied value. Valid fields are `logged_at`.
48
+ // filter_like - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `logged_at`.
49
+ // filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`.
50
+ // filter_lteq - object - If set, return records where the specified field is less than or equal to the supplied value. Valid fields are `logged_at`.
51
+ static list = async (params = {}, options = {}) => {
52
+ if (params['cursor'] && !isString(params['cursor'])) {
53
+ throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
54
+ }
55
+
56
+ if (params['per_page'] && !isInt(params['per_page'])) {
57
+ throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
58
+ }
59
+
60
+ const response = await Api.sendRequest(`/remote_bandwidth_snapshots`, 'GET', params, options)
61
+
62
+ return response?.data?.map(obj => new RemoteBandwidthSnapshot(obj, options)) || []
63
+ }
64
+
65
+ static all = (params = {}, options = {}) =>
66
+ RemoteBandwidthSnapshot.list(params, options)
67
+ }
68
+
69
+ export default RemoteBandwidthSnapshot
@@ -134,6 +134,13 @@ class Session {
134
134
  this.attributes.allowed_2fa_method_u2f = value
135
135
  }
136
136
 
137
+ // boolean # Sent only if 2FA setup is needed. Is WebAuthn two factor authentication allowed?
138
+ getAllowed2faMethodWebauthn = () => this.attributes.allowed_2fa_method_webauthn
139
+
140
+ setAllowed2faMethodWebauthn = value => {
141
+ this.attributes.allowed_2fa_method_webauthn = value
142
+ }
143
+
137
144
  // boolean # Sent only if 2FA setup is needed. Is Yubikey two factor authentication allowed?
138
145
  getAllowed2faMethodYubi = () => this.attributes.allowed_2fa_method_yubi
139
146
 
@@ -22,9 +22,6 @@ class SettingsChange {
22
22
  }
23
23
 
24
24
  isLoaded = () => !!this.attributes.id
25
- // object # Specifics on what changed.
26
- getChangeDetails = () => this.attributes.change_details
27
-
28
25
  // string # Markdown-formatted change messages.
29
26
  getChanges = () => this.attributes.changes
30
27
 
@@ -34,6 +34,9 @@ class Site {
34
34
  // boolean # Is U2F two factor authentication allowed?
35
35
  getAllowed2faMethodU2f = () => this.attributes.allowed_2fa_method_u2f
36
36
 
37
+ // boolean # Is WebAuthn two factor authentication allowed?
38
+ getAllowed2faMethodWebauthn = () => this.attributes.allowed_2fa_method_webauthn
39
+
37
40
  // boolean # Is yubikey two factor authentication allowed?
38
41
  getAllowed2faMethodYubi = () => this.attributes.allowed_2fa_method_yubi
39
42
 
@@ -482,6 +485,7 @@ class Site {
482
485
  // allowed_2fa_method_sms - boolean - Is SMS two factor authentication allowed?
483
486
  // allowed_2fa_method_u2f - boolean - Is U2F two factor authentication allowed?
484
487
  // allowed_2fa_method_totp - boolean - Is TOTP two factor authentication allowed?
488
+ // allowed_2fa_method_webauthn - boolean - Is WebAuthn two factor authentication allowed?
485
489
  // allowed_2fa_method_yubi - boolean - Is yubikey two factor authentication allowed?
486
490
  // require_2fa - boolean - Require two-factor authentication for all users?
487
491
  // require_2fa_user_type - string - What type of user is required to use two-factor authentication (when require_2fa is set to `true` for this site)?