files.com 1.0.158 → 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.158
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.158",
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.
@@ -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