files.com 1.0.157 → 1.0.161

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.157
1
+ 1.0.161
@@ -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;
@@ -101,6 +101,12 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
101
101
  (0, _defineProperty2.default)(this, "setS3Region", function (value) {
102
102
  _this.attributes.s3_region = value;
103
103
  });
104
+ (0, _defineProperty2.default)(this, "getAwsAccessKey", function () {
105
+ return _this.attributes.aws_access_key;
106
+ });
107
+ (0, _defineProperty2.default)(this, "setAwsAccessKey", function (value) {
108
+ _this.attributes.aws_access_key = value;
109
+ });
104
110
  (0, _defineProperty2.default)(this, "getServerCertificate", function () {
105
111
  return _this.attributes.server_certificate;
106
112
  });
@@ -167,6 +173,12 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
167
173
  (0, _defineProperty2.default)(this, "setWasabiRegion", function (value) {
168
174
  _this.attributes.wasabi_region = value;
169
175
  });
176
+ (0, _defineProperty2.default)(this, "getWasabiAccessKey", function () {
177
+ return _this.attributes.wasabi_access_key;
178
+ });
179
+ (0, _defineProperty2.default)(this, "setWasabiAccessKey", function (value) {
180
+ _this.attributes.wasabi_access_key = value;
181
+ });
170
182
  (0, _defineProperty2.default)(this, "getRackspaceUsername", function () {
171
183
  return _this.attributes.rackspace_username;
172
184
  });
@@ -233,18 +245,18 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
233
245
  (0, _defineProperty2.default)(this, "setS3CompatibleEndpoint", function (value) {
234
246
  _this.attributes.s3_compatible_endpoint = value;
235
247
  });
248
+ (0, _defineProperty2.default)(this, "getS3CompatibleAccessKey", function () {
249
+ return _this.attributes.s3_compatible_access_key;
250
+ });
251
+ (0, _defineProperty2.default)(this, "setS3CompatibleAccessKey", function (value) {
252
+ _this.attributes.s3_compatible_access_key = value;
253
+ });
236
254
  (0, _defineProperty2.default)(this, "getEnableDedicatedIps", function () {
237
255
  return _this.attributes.enable_dedicated_ips;
238
256
  });
239
257
  (0, _defineProperty2.default)(this, "setEnableDedicatedIps", function (value) {
240
258
  _this.attributes.enable_dedicated_ips = value;
241
259
  });
242
- (0, _defineProperty2.default)(this, "getAwsAccessKey", function () {
243
- return _this.attributes.aws_access_key;
244
- });
245
- (0, _defineProperty2.default)(this, "setAwsAccessKey", function (value) {
246
- _this.attributes.aws_access_key = value;
247
- });
248
260
  (0, _defineProperty2.default)(this, "getAwsSecretKey", function () {
249
261
  return _this.attributes.aws_secret_key;
250
262
  });
@@ -275,12 +287,6 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
275
287
  (0, _defineProperty2.default)(this, "setGoogleCloudStorageCredentialsJson", function (value) {
276
288
  _this.attributes.google_cloud_storage_credentials_json = value;
277
289
  });
278
- (0, _defineProperty2.default)(this, "getWasabiAccessKey", function () {
279
- return _this.attributes.wasabi_access_key;
280
- });
281
- (0, _defineProperty2.default)(this, "setWasabiAccessKey", function (value) {
282
- _this.attributes.wasabi_access_key = value;
283
- });
284
290
  (0, _defineProperty2.default)(this, "getWasabiSecretKey", function () {
285
291
  return _this.attributes.wasabi_secret_key;
286
292
  });
@@ -317,12 +323,6 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
317
323
  (0, _defineProperty2.default)(this, "setAzureBlobStorageAccessKey", function (value) {
318
324
  _this.attributes.azure_blob_storage_access_key = value;
319
325
  });
320
- (0, _defineProperty2.default)(this, "getS3CompatibleAccessKey", function () {
321
- return _this.attributes.s3_compatible_access_key;
322
- });
323
- (0, _defineProperty2.default)(this, "setS3CompatibleAccessKey", function (value) {
324
- _this.attributes.s3_compatible_access_key = value;
325
- });
326
326
  (0, _defineProperty2.default)(this, "getS3CompatibleSecretKey", function () {
327
327
  return _this.attributes.s3_compatible_secret_key;
328
328
  });
@@ -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 +50,12 @@ var SettingsChange = /*#__PURE__*/(0, _createClass2.default)(function SettingsCh
53
50
  (0, _defineProperty2.default)(this, "getUserId", function () {
54
51
  return _this.attributes.user_id;
55
52
  });
53
+ (0, _defineProperty2.default)(this, "getUserIsFilesSupport", function () {
54
+ return _this.attributes.user_is_files_support;
55
+ });
56
+ (0, _defineProperty2.default)(this, "getUsername", function () {
57
+ return _this.attributes.username;
58
+ });
56
59
  Object.entries(attributes).forEach(function (_ref) {
57
60
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
58
61
  key = _ref2[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.157",
3
+ "version": "1.0.161",
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.
@@ -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
@@ -92,6 +92,13 @@ class RemoteServer {
92
92
  this.attributes.s3_region = value
93
93
  }
94
94
 
95
+ // string # AWS Access Key.
96
+ getAwsAccessKey = () => this.attributes.aws_access_key
97
+
98
+ setAwsAccessKey = value => {
99
+ this.attributes.aws_access_key = value
100
+ }
101
+
95
102
  // string # Remote server certificate
96
103
  getServerCertificate = () => this.attributes.server_certificate
97
104
 
@@ -169,6 +176,13 @@ class RemoteServer {
169
176
  this.attributes.wasabi_region = value
170
177
  }
171
178
 
179
+ // string # Wasabi access key.
180
+ getWasabiAccessKey = () => this.attributes.wasabi_access_key
181
+
182
+ setWasabiAccessKey = value => {
183
+ this.attributes.wasabi_access_key = value
184
+ }
185
+
172
186
  // string # Rackspace username used to login to the Rackspace Cloud Control Panel.
173
187
  getRackspaceUsername = () => this.attributes.rackspace_username
174
188
 
@@ -246,6 +260,13 @@ class RemoteServer {
246
260
  this.attributes.s3_compatible_endpoint = value
247
261
  }
248
262
 
263
+ // string # S3-compatible Access Key.
264
+ getS3CompatibleAccessKey = () => this.attributes.s3_compatible_access_key
265
+
266
+ setS3CompatibleAccessKey = value => {
267
+ this.attributes.s3_compatible_access_key = value
268
+ }
269
+
249
270
  // boolean # `true` if remote server only accepts connections from dedicated IPs
250
271
  getEnableDedicatedIps = () => this.attributes.enable_dedicated_ips
251
272
 
@@ -253,13 +274,6 @@ class RemoteServer {
253
274
  this.attributes.enable_dedicated_ips = value
254
275
  }
255
276
 
256
- // string # AWS Access Key.
257
- getAwsAccessKey = () => this.attributes.aws_access_key
258
-
259
- setAwsAccessKey = value => {
260
- this.attributes.aws_access_key = value
261
- }
262
-
263
277
  // string # AWS secret key.
264
278
  getAwsSecretKey = () => this.attributes.aws_secret_key
265
279
 
@@ -295,13 +309,6 @@ class RemoteServer {
295
309
  this.attributes.google_cloud_storage_credentials_json = value
296
310
  }
297
311
 
298
- // string # Wasabi access key.
299
- getWasabiAccessKey = () => this.attributes.wasabi_access_key
300
-
301
- setWasabiAccessKey = value => {
302
- this.attributes.wasabi_access_key = value
303
- }
304
-
305
312
  // string # Wasabi secret key.
306
313
  getWasabiSecretKey = () => this.attributes.wasabi_secret_key
307
314
 
@@ -344,13 +351,6 @@ class RemoteServer {
344
351
  this.attributes.azure_blob_storage_access_key = value
345
352
  }
346
353
 
347
- // string # S3-compatible access key
348
- getS3CompatibleAccessKey = () => this.attributes.s3_compatible_access_key
349
-
350
- setS3CompatibleAccessKey = value => {
351
- this.attributes.s3_compatible_access_key = value
352
- }
353
-
354
354
  // string # S3-compatible secret key
355
355
  getS3CompatibleSecretKey = () => this.attributes.s3_compatible_secret_key
356
356
 
@@ -399,7 +399,7 @@ class RemoteServer {
399
399
  // s3_compatible_bucket - string - S3-compatible Bucket name
400
400
  // s3_compatible_endpoint - string - S3-compatible endpoint
401
401
  // enable_dedicated_ips - boolean - `true` if remote server only accepts connections from dedicated IPs
402
- // s3_compatible_access_key - string - S3-compatible access key
402
+ // s3_compatible_access_key - string - S3-compatible Access Key.
403
403
  // s3_compatible_secret_key - string - S3-compatible secret key
404
404
  update = async (params = {}) => {
405
405
  if (!this.attributes.id) {
@@ -666,7 +666,7 @@ class RemoteServer {
666
666
  // s3_compatible_bucket - string - S3-compatible Bucket name
667
667
  // s3_compatible_endpoint - string - S3-compatible endpoint
668
668
  // enable_dedicated_ips - boolean - `true` if remote server only accepts connections from dedicated IPs
669
- // s3_compatible_access_key - string - S3-compatible access key
669
+ // s3_compatible_access_key - string - S3-compatible Access Key.
670
670
  // s3_compatible_secret_key - string - S3-compatible secret key
671
671
  static create = async (params = {}, options = {}) => {
672
672
  if (params['aws_access_key'] && !isString(params['aws_access_key'])) {
@@ -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 +31,12 @@ class SettingsChange {
34
31
  // int64 # The user id responsible for this change
35
32
  getUserId = () => this.attributes.user_id
36
33
 
34
+ // boolean # true if this change was performed by Files.com support.
35
+ getUserIsFilesSupport = () => this.attributes.user_is_files_support
36
+
37
+ // string # The username of the user responsible for this change
38
+ getUsername = () => this.attributes.username
39
+
37
40
 
38
41
  // Parameters:
39
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.