files.com 1.2.84 → 1.2.85
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/docs/models/Behavior.md +0 -4
- package/docs/models/PublicHostingRequestLog.md +43 -0
- package/lib/Files.js +1 -1
- package/lib/models/Behavior.js +8 -22
- package/lib/models/PublicHostingRequestLog.js +130 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/Behavior.js +0 -10
- package/src/models/PublicHostingRequestLog.js +81 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.85
|
package/docs/models/Behavior.md
CHANGED
@@ -151,8 +151,6 @@ await behavior.update({
|
|
151
151
|
'recursive': true,
|
152
152
|
'name': "example",
|
153
153
|
'description': "example",
|
154
|
-
'behavior': "webhook",
|
155
|
-
'path': "example",
|
156
154
|
'attachment_delete': true,
|
157
155
|
})
|
158
156
|
```
|
@@ -166,8 +164,6 @@ await behavior.update({
|
|
166
164
|
* `recursive` (boolean): Is behavior recursive?
|
167
165
|
* `name` (string): Name for this behavior.
|
168
166
|
* `description` (string): Description for this behavior.
|
169
|
-
* `behavior` (string): Behavior type.
|
170
|
-
* `path` (string): Folder behaviors path.
|
171
167
|
* `attachment_delete` (boolean): If true, will delete the file stored in attachment
|
172
168
|
|
173
169
|
### Example Response
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# PublicHostingRequestLog
|
2
|
+
|
3
|
+
## Example PublicHostingRequestLog Object
|
4
|
+
|
5
|
+
```
|
6
|
+
{
|
7
|
+
"timestamp": "2000-01-01T01:00:00Z",
|
8
|
+
"remote_ip": "example",
|
9
|
+
"server_ip": "example",
|
10
|
+
"hostname": "example",
|
11
|
+
"path": "example",
|
12
|
+
"responseCode": 1,
|
13
|
+
"success": true,
|
14
|
+
"duration_ms": 1
|
15
|
+
}
|
16
|
+
```
|
17
|
+
|
18
|
+
* `timestamp` (date-time): Start Time of Action
|
19
|
+
* `remote_ip` (string): IP Address of Public Hosting Client
|
20
|
+
* `server_ip` (string): IP Address of Public Hosting Server
|
21
|
+
* `hostname` (string): HTTP Request Hostname
|
22
|
+
* `path` (string): HTTP Request Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
23
|
+
* `responseCode` (int64): HTTP Response Code
|
24
|
+
* `success` (boolean): Whether SFTP Action was successful.
|
25
|
+
* `duration_ms` (int64): Duration (in milliseconds)
|
26
|
+
|
27
|
+
---
|
28
|
+
|
29
|
+
## List Public Hosting Request Logs
|
30
|
+
|
31
|
+
```
|
32
|
+
await PublicHostingRequestLog.list({
|
33
|
+
'per_page': 1,
|
34
|
+
})
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
### Parameters
|
39
|
+
|
40
|
+
* `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
41
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
42
|
+
* `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date`, `path`, `remote_ip` or `success`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
43
|
+
* `filter_prefix` (object): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
package/lib/Files.js
CHANGED
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
|
|
11
11
|
var apiKey;
|
12
12
|
var baseUrl = 'https://app.files.com';
|
13
13
|
var sessionId = null;
|
14
|
-
var version = '1.2.
|
14
|
+
var version = '1.2.85';
|
15
15
|
var userAgent = "Files.com JavaScript SDK v".concat(version);
|
16
16
|
var logLevel = _Logger.LogLevel.INFO;
|
17
17
|
var debugRequest = false;
|
package/lib/models/Behavior.js
CHANGED
@@ -117,8 +117,6 @@ var Behavior = /*#__PURE__*/(0, _createClass2.default)(function Behavior() {
|
|
117
117
|
// recursive - boolean - Is behavior recursive?
|
118
118
|
// name - string - Name for this behavior.
|
119
119
|
// description - string - Description for this behavior.
|
120
|
-
// behavior - string - Behavior type.
|
121
|
-
// path - string - Folder behaviors path.
|
122
120
|
// attachment_delete - boolean - If true, will delete the file stored in attachment
|
123
121
|
(0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
124
122
|
var params,
|
@@ -165,38 +163,26 @@ var Behavior = /*#__PURE__*/(0, _createClass2.default)(function Behavior() {
|
|
165
163
|
}
|
166
164
|
throw new errors.InvalidParameterError("Bad parameter: description must be of type String, received ".concat((0, _utils.getType)(params.description)));
|
167
165
|
case 14:
|
168
|
-
if (!(params.behavior && !(0, _utils.isString)(params.behavior))) {
|
169
|
-
_context.next = 16;
|
170
|
-
break;
|
171
|
-
}
|
172
|
-
throw new errors.InvalidParameterError("Bad parameter: behavior must be of type String, received ".concat((0, _utils.getType)(params.behavior)));
|
173
|
-
case 16:
|
174
|
-
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
175
|
-
_context.next = 18;
|
176
|
-
break;
|
177
|
-
}
|
178
|
-
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
179
|
-
case 18:
|
180
166
|
if (params.id) {
|
181
|
-
_context.next =
|
167
|
+
_context.next = 20;
|
182
168
|
break;
|
183
169
|
}
|
184
170
|
if (!_this.attributes.id) {
|
185
|
-
_context.next =
|
171
|
+
_context.next = 19;
|
186
172
|
break;
|
187
173
|
}
|
188
174
|
params.id = _this.id;
|
189
|
-
_context.next =
|
175
|
+
_context.next = 20;
|
190
176
|
break;
|
191
|
-
case
|
177
|
+
case 19:
|
192
178
|
throw new errors.MissingParameterError('Parameter missing: id');
|
193
|
-
case
|
194
|
-
_context.next =
|
179
|
+
case 20:
|
180
|
+
_context.next = 22;
|
195
181
|
return _Api.default.sendRequest("/behaviors/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
|
196
|
-
case
|
182
|
+
case 22:
|
197
183
|
response = _context.sent;
|
198
184
|
return _context.abrupt("return", new Behavior(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
199
|
-
case
|
185
|
+
case 24:
|
200
186
|
case "end":
|
201
187
|
return _context.stop();
|
202
188
|
}
|
@@ -0,0 +1,130 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports.default = void 0;
|
7
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
8
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
13
|
+
var _Api = _interopRequireDefault(require("../Api"));
|
14
|
+
var errors = _interopRequireWildcard(require("../Errors"));
|
15
|
+
var _utils = require("../utils");
|
16
|
+
var _PublicHostingRequestLog;
|
17
|
+
/* eslint-disable no-unused-vars */
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
20
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
22
|
+
/* eslint-enable no-unused-vars */
|
23
|
+
/**
|
24
|
+
* Class PublicHostingRequestLog
|
25
|
+
*/
|
26
|
+
var PublicHostingRequestLog = /*#__PURE__*/(0, _createClass2.default)(function PublicHostingRequestLog() {
|
27
|
+
var _this = this;
|
28
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
29
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
30
|
+
(0, _classCallCheck2.default)(this, PublicHostingRequestLog);
|
31
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
32
|
+
(0, _defineProperty2.default)(this, "options", {});
|
33
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
34
|
+
return !!_this.attributes.id;
|
35
|
+
});
|
36
|
+
// date-time # Start Time of Action
|
37
|
+
(0, _defineProperty2.default)(this, "getTimestamp", function () {
|
38
|
+
return _this.attributes.timestamp;
|
39
|
+
});
|
40
|
+
// string # IP Address of Public Hosting Client
|
41
|
+
(0, _defineProperty2.default)(this, "getRemoteIp", function () {
|
42
|
+
return _this.attributes.remote_ip;
|
43
|
+
});
|
44
|
+
// string # IP Address of Public Hosting Server
|
45
|
+
(0, _defineProperty2.default)(this, "getServerIp", function () {
|
46
|
+
return _this.attributes.server_ip;
|
47
|
+
});
|
48
|
+
// string # HTTP Request Hostname
|
49
|
+
(0, _defineProperty2.default)(this, "getHostname", function () {
|
50
|
+
return _this.attributes.hostname;
|
51
|
+
});
|
52
|
+
// string # HTTP Request Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
53
|
+
(0, _defineProperty2.default)(this, "getPath", function () {
|
54
|
+
return _this.attributes.path;
|
55
|
+
});
|
56
|
+
// int64 # HTTP Response Code
|
57
|
+
(0, _defineProperty2.default)(this, "getResponseCode", function () {
|
58
|
+
return _this.attributes.responseCode;
|
59
|
+
});
|
60
|
+
// boolean # Whether SFTP Action was successful.
|
61
|
+
(0, _defineProperty2.default)(this, "getSuccess", function () {
|
62
|
+
return _this.attributes.success;
|
63
|
+
});
|
64
|
+
// int64 # Duration (in milliseconds)
|
65
|
+
(0, _defineProperty2.default)(this, "getDurationMs", function () {
|
66
|
+
return _this.attributes.duration_ms;
|
67
|
+
});
|
68
|
+
Object.entries(attributes).forEach(function (_ref) {
|
69
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
70
|
+
key = _ref2[0],
|
71
|
+
value = _ref2[1];
|
72
|
+
var normalizedKey = key.replace('?', '');
|
73
|
+
_this.attributes[normalizedKey] = value;
|
74
|
+
Object.defineProperty(_this, normalizedKey, {
|
75
|
+
value: value,
|
76
|
+
writable: false
|
77
|
+
});
|
78
|
+
});
|
79
|
+
this.options = _objectSpread({}, options);
|
80
|
+
});
|
81
|
+
_PublicHostingRequestLog = PublicHostingRequestLog;
|
82
|
+
// Parameters:
|
83
|
+
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
84
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
85
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date`, `path`, `remote_ip` or `success`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
86
|
+
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
87
|
+
(0, _defineProperty2.default)(PublicHostingRequestLog, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
88
|
+
var _response$data;
|
89
|
+
var params,
|
90
|
+
options,
|
91
|
+
response,
|
92
|
+
_args = arguments;
|
93
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
94
|
+
while (1) switch (_context.prev = _context.next) {
|
95
|
+
case 0:
|
96
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
97
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
98
|
+
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
99
|
+
_context.next = 4;
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
103
|
+
case 4:
|
104
|
+
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
105
|
+
_context.next = 6;
|
106
|
+
break;
|
107
|
+
}
|
108
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
109
|
+
case 6:
|
110
|
+
_context.next = 8;
|
111
|
+
return _Api.default.sendRequest('/public_hosting_request_logs', 'GET', params, options);
|
112
|
+
case 8:
|
113
|
+
response = _context.sent;
|
114
|
+
return _context.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
115
|
+
return new _PublicHostingRequestLog(obj, options);
|
116
|
+
})) || []);
|
117
|
+
case 10:
|
118
|
+
case "end":
|
119
|
+
return _context.stop();
|
120
|
+
}
|
121
|
+
}, _callee);
|
122
|
+
})));
|
123
|
+
(0, _defineProperty2.default)(PublicHostingRequestLog, "all", function () {
|
124
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
125
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
126
|
+
return _PublicHostingRequestLog.list(params, options);
|
127
|
+
});
|
128
|
+
var _default = exports.default = PublicHostingRequestLog;
|
129
|
+
module.exports = PublicHostingRequestLog;
|
130
|
+
module.exports.default = PublicHostingRequestLog;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
package/src/models/Behavior.js
CHANGED
@@ -112,8 +112,6 @@ class Behavior {
|
|
112
112
|
// recursive - boolean - Is behavior recursive?
|
113
113
|
// name - string - Name for this behavior.
|
114
114
|
// description - string - Description for this behavior.
|
115
|
-
// behavior - string - Behavior type.
|
116
|
-
// path - string - Folder behaviors path.
|
117
115
|
// attachment_delete - boolean - If true, will delete the file stored in attachment
|
118
116
|
update = async (params = {}) => {
|
119
117
|
if (!this.attributes.id) {
|
@@ -141,14 +139,6 @@ class Behavior {
|
|
141
139
|
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
142
140
|
}
|
143
141
|
|
144
|
-
if (params.behavior && !isString(params.behavior)) {
|
145
|
-
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(params.behavior)}`)
|
146
|
-
}
|
147
|
-
|
148
|
-
if (params.path && !isString(params.path)) {
|
149
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
150
|
-
}
|
151
|
-
|
152
142
|
if (!params.id) {
|
153
143
|
if (this.attributes.id) {
|
154
144
|
params.id = this.id
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
2
|
+
import Api from '../Api'
|
3
|
+
import * as errors from '../Errors'
|
4
|
+
import {
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
6
|
+
} from '../utils'
|
7
|
+
/* eslint-enable no-unused-vars */
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Class PublicHostingRequestLog
|
11
|
+
*/
|
12
|
+
class PublicHostingRequestLog {
|
13
|
+
attributes = {}
|
14
|
+
|
15
|
+
options = {}
|
16
|
+
|
17
|
+
constructor(attributes = {}, options = {}) {
|
18
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
19
|
+
const normalizedKey = key.replace('?', '')
|
20
|
+
|
21
|
+
this.attributes[normalizedKey] = value
|
22
|
+
|
23
|
+
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
24
|
+
})
|
25
|
+
|
26
|
+
this.options = { ...options }
|
27
|
+
}
|
28
|
+
|
29
|
+
isLoaded = () => !!this.attributes.id
|
30
|
+
|
31
|
+
// date-time # Start Time of Action
|
32
|
+
getTimestamp = () => this.attributes.timestamp
|
33
|
+
|
34
|
+
// string # IP Address of Public Hosting Client
|
35
|
+
getRemoteIp = () => this.attributes.remote_ip
|
36
|
+
|
37
|
+
// string # IP Address of Public Hosting Server
|
38
|
+
getServerIp = () => this.attributes.server_ip
|
39
|
+
|
40
|
+
// string # HTTP Request Hostname
|
41
|
+
getHostname = () => this.attributes.hostname
|
42
|
+
|
43
|
+
// string # HTTP Request Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
44
|
+
getPath = () => this.attributes.path
|
45
|
+
|
46
|
+
// int64 # HTTP Response Code
|
47
|
+
getResponseCode = () => this.attributes.responseCode
|
48
|
+
|
49
|
+
// boolean # Whether SFTP Action was successful.
|
50
|
+
getSuccess = () => this.attributes.success
|
51
|
+
|
52
|
+
// int64 # Duration (in milliseconds)
|
53
|
+
getDurationMs = () => this.attributes.duration_ms
|
54
|
+
|
55
|
+
// Parameters:
|
56
|
+
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
57
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
58
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date`, `path`, `remote_ip` or `success`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
59
|
+
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`.
|
60
|
+
static list = async (params = {}, options = {}) => {
|
61
|
+
if (params.cursor && !isString(params.cursor)) {
|
62
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
63
|
+
}
|
64
|
+
|
65
|
+
if (params.per_page && !isInt(params.per_page)) {
|
66
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
67
|
+
}
|
68
|
+
|
69
|
+
const response = await Api.sendRequest('/public_hosting_request_logs', 'GET', params, options)
|
70
|
+
|
71
|
+
return response?.data?.map(obj => new PublicHostingRequestLog(obj, options)) || []
|
72
|
+
}
|
73
|
+
|
74
|
+
static all = (params = {}, options = {}) =>
|
75
|
+
PublicHostingRequestLog.list(params, options)
|
76
|
+
}
|
77
|
+
|
78
|
+
export default PublicHostingRequestLog
|
79
|
+
|
80
|
+
module.exports = PublicHostingRequestLog
|
81
|
+
module.exports.default = PublicHostingRequestLog
|